DCSIMG
GetListItems and Hebrew columns - Doron Goldberg

GetListItems and Hebrew columns

When calling GetListItems from /_vti_bin/lists.asmx to get records from a list which has columns with Hebrew names, the columns turn up to be empty after loading the xml to a DataSet.

The reason is probably because the columns name shows different in the ows_MetaInfo then name as it appears in the row data returned from the web service:

From the row:

ows__x05ea__x05d0__x05e8__x05d9__x05da__x05de_="2008-03-20 00:00:00"

From ows_MetaInfo:

תאריךמ:SW|2008-03-20T00:00:00Z

In order to transform the name of the columns back to Hebrew it needs to be replaced to a proper encoded format:

ows;תאריךמ

And then using HttpUtil.HtmlDecode it can be transformed to Hebrew.

I wrote a small method which fixes the column names of the retuned XML:

private string FixHebrew(string p)
{
    while (p.IndexOf("ows__x05") > 0)
    {
        int startindex = p.IndexOf("ows__x05");
        string substring = p.Substring(startindex, p.Length - startindex);
        int lastindex = substring.IndexOf("=");
        string fieldname = substring.Substring(0, lastindex-1).ToLower();
        string newfieldname = fieldname.Replace("__x05", ";&#x05");
        newfieldname += ";";
        fieldname += "_";
        p=p.Replace(fieldname , newfieldname);
    }
    return HttpUtility.HtmlDecode(p);
} 

So loading the DataSet looks like this:

XmlNode xmlresult = oList.GetListItems(
configData.ListName, 
GetViewGUID(), 
listQuery, 
listViewFields, 
string.Empty, 
listQueryOptions, 
GetWebID().ToString()); 

XmlTextReader reader = new XmlTextReader(
FixHebrew(xmlresult.OuterXml).Replace("ows_", "").Replace("ows;",""),
XmlNodeType.Element,
null);
ds.ReadXml(reader);

Comments

# re: GetListItems and Hebrew columns

Sunday, March 30, 2008 6:03 PM by אני רוצה הדרכה מהבסיס-

אני רוצה הדרכה מהבסיס- מה לבחור לWEB

(ןלא לWINFORM

דחוף!!!!!!!!!!!!!!!!

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: