mshaji
asked on
Reading XML File showing an error: The ':' character, hexadecimal value 0x3A, cannot be included in a name.
Dears,
I have a SharePoint picture library list and i got the corresponding XML file which contains the data like
- <xml xmlns:s="uuid:BDC6E3F0-6DA 3-11d1-A2A 3-00AA00C1 4882" xmlns:dt="uuid:C2F41010-65 B3-11d1-A2 9F-00AA00C 14882" xmlns:rs="urn:schemas-micr osoft-com: rowset" xmlns:z="#RowsetSchema">
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly" rs:CommandTimeout="30">
- <s:AttributeType name="ows_SelectedFlag" rs:name="Selection Checkbox" rs:number="1">
<s:datatype dt:type="ui1" dt:maxLength="4" />
</s:AttributeType>
- <s:AttributeType name="ows_DocIcon" rs:name="Type" rs:number="2">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
- <s:AttributeType name="ows_NameOrTitle" rs:name="Name" rs:number="3">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
- <s:AttributeType name="ows_ImageSize" rs:name="Picture Size" rs:number="4">
<s:datatype dt:type="i4" dt:maxLength="4" />
</s:AttributeType>
- <s:AttributeType name="ows_FileSizeDisplay" rs:name="File Size" rs:number="5">
<s:datatype dt:type="i4" dt:maxLength="4" />
</s:AttributeType>
- <s:AttributeType name="ows_RequiredField" rs:name="Required Field" rs:number="6">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
- <s:AttributeType name="ows_Details" rs:name="Details" rs:number="7">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
</s:ElementType>
</s:Schema>
- <rs:data>
<z:row ows_SelectedFlag="0" ows_DocIcon="jpg" ows_NameOrTitle="Desert.jp g" ows_ImageSize="1024" ows_FileSizeDisplay="84594 1" ows_RequiredField="English /it/Silver LightLibra ry/Desert. jpg" ows_Details="Details here" />
<z:row ows_SelectedFlag="0" ows_DocIcon="jpg" ows_NameOrTitle="SD.jpg" ows_ImageSize="754" ows_FileSizeDisplay="12224 8" ows_RequiredField="English /it/Silver LightLibra ry/SD.jpg" ows_Details="SD Details here" />
</rs:data>
</xml>
Here I wanted to get the Name of Image, Details of image by using C# code, for that I wrote the code inside a foreach loop to fetch all data from this XML
void webClient_DownloadStringCo mpleted(ob ject sender, DownloadStringCompletedEve ntArgs e)
{
XDocument xDoc = XDocument.Parse(e.Result);
foreach (XElement xMovieInfo in xDoc.Descendants("rs:data" ))
{
try
{
MovieTrailer trailer = new MovieTrailer(xMovieInfo);
trailers.Add(trailer);
}
catch { }
}
}
Here this code throwing an error : The ':' character, hexadecimal value 0x3A, cannot be included in a name.
My aim is how to get the image name, image path and image details from the above XML file by using C# code.
Thanks in advance
Regards
I have a SharePoint picture library list and i got the corresponding XML file which contains the data like
- <xml xmlns:s="uuid:BDC6E3F0-6DA
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly" rs:CommandTimeout="30">
- <s:AttributeType name="ows_SelectedFlag" rs:name="Selection Checkbox" rs:number="1">
<s:datatype dt:type="ui1" dt:maxLength="4" />
</s:AttributeType>
- <s:AttributeType name="ows_DocIcon" rs:name="Type" rs:number="2">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
- <s:AttributeType name="ows_NameOrTitle" rs:name="Name" rs:number="3">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
- <s:AttributeType name="ows_ImageSize" rs:name="Picture Size" rs:number="4">
<s:datatype dt:type="i4" dt:maxLength="4" />
</s:AttributeType>
- <s:AttributeType name="ows_FileSizeDisplay"
<s:datatype dt:type="i4" dt:maxLength="4" />
</s:AttributeType>
- <s:AttributeType name="ows_RequiredField" rs:name="Required Field" rs:number="6">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
- <s:AttributeType name="ows_Details" rs:name="Details" rs:number="7">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
</s:ElementType>
</s:Schema>
- <rs:data>
<z:row ows_SelectedFlag="0" ows_DocIcon="jpg" ows_NameOrTitle="Desert.jp
<z:row ows_SelectedFlag="0" ows_DocIcon="jpg" ows_NameOrTitle="SD.jpg" ows_ImageSize="754" ows_FileSizeDisplay="12224
</rs:data>
</xml>
Here I wanted to get the Name of Image, Details of image by using C# code, for that I wrote the code inside a foreach loop to fetch all data from this XML
void webClient_DownloadStringCo
{
XDocument xDoc = XDocument.Parse(e.Result);
foreach (XElement xMovieInfo in xDoc.Descendants("rs:data"
{
try
{
MovieTrailer trailer = new MovieTrailer(xMovieInfo);
trailers.Add(trailer);
}
catch { }
}
}
Here this code throwing an error : The ':' character, hexadecimal value 0x3A, cannot be included in a name.
My aim is how to get the image name, image path and image details from the above XML file by using C# code.
Thanks in advance
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear,
I really appreciate and thanks for the kind help. Your modified code solved my issue for ever.
Thank you so much dear.
I really appreciate and thanks for the kind help. Your modified code solved my issue for ever.
Thank you so much dear.
Open in new window