L
Learning Rocks
Guest
Hello Everyone,
what's wrong in below code. i am unable to fetch <IMGID> here.
pls help me. below is my code block and xml document
<IMAGE_LIST>
<ROW Key="1001">
<IMAGE seq="1001">
<IMGID>1001</IMGID>
<IMAGEDATA>/9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJ</IMAGEDATA>
<IMAGETHUMBNAIL>/9j/4AAQSkZJRgABAQAAAQABAA</IMAGETHUMBNAIL>
</IMAGE>
</ROW>
<ROW Key="1002">
<IMAGE seq="1002">
<IMGID>1002</IMGID>
<IMAGEDATA>Yg/2KaW9X5v3bL8m0YIIywb8F/GgDqKK4248QXdlpOnC1e3jY2STtH9kuLyQ8dNsfKr</IMAGEDATA>
<IMAGETHUMBNAIL>/8F/GgDqKK4248QXdlpO</IMAGETHUMBNAIL>
</IMAGE>
</ROW>
</IMAGE_LIST>
foreach (XElement el in doc.Root.Elements())
{
if (el != null && el.Elements() != null && el.Elements().Count() > 0)
{
picture pic = new picture
{
pictureId = Convert.ToInt32(el.Elements().FirstOrDefault(x => x.Name.LocalName.Equals("IMGID", StringComparison.InvariantCultureIgnoreCase)).Value),
pictureData = el.Elements().FirstOrDefault(x => x.Name.LocalName.Equals("IMAGEDATA", StringComparison.InvariantCultureIgnoreCase)).Value,
pictureThumbnailData = el.Elements().FirstOrDefault(x => x.Name.LocalName.Equals("IMAGETHUMBNAIL", StringComparison.InvariantCultureIgnoreCase)).Value
};
picList.Add(pic);
}
}
Thanks
Continue reading...
what's wrong in below code. i am unable to fetch <IMGID> here.
pls help me. below is my code block and xml document
<IMAGE_LIST>
<ROW Key="1001">
<IMAGE seq="1001">
<IMGID>1001</IMGID>
<IMAGEDATA>/9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJ</IMAGEDATA>
<IMAGETHUMBNAIL>/9j/4AAQSkZJRgABAQAAAQABAA</IMAGETHUMBNAIL>
</IMAGE>
</ROW>
<ROW Key="1002">
<IMAGE seq="1002">
<IMGID>1002</IMGID>
<IMAGEDATA>Yg/2KaW9X5v3bL8m0YIIywb8F/GgDqKK4248QXdlpOnC1e3jY2STtH9kuLyQ8dNsfKr</IMAGEDATA>
<IMAGETHUMBNAIL>/8F/GgDqKK4248QXdlpO</IMAGETHUMBNAIL>
</IMAGE>
</ROW>
</IMAGE_LIST>
foreach (XElement el in doc.Root.Elements())
{
if (el != null && el.Elements() != null && el.Elements().Count() > 0)
{
picture pic = new picture
{
pictureId = Convert.ToInt32(el.Elements().FirstOrDefault(x => x.Name.LocalName.Equals("IMGID", StringComparison.InvariantCultureIgnoreCase)).Value),
pictureData = el.Elements().FirstOrDefault(x => x.Name.LocalName.Equals("IMAGEDATA", StringComparison.InvariantCultureIgnoreCase)).Value,
pictureThumbnailData = el.Elements().FirstOrDefault(x => x.Name.LocalName.Equals("IMAGETHUMBNAIL", StringComparison.InvariantCultureIgnoreCase)).Value
};
picList.Add(pic);
}
}
Thanks
Continue reading...