EDN Admin
Well-known member
Hi,
I am ashamed to ask this question but I tried for at least 15 minutes and I didnt manage to do it.<br/>
I have a simple xml file as shown below :
<pre class="prettyprint <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="ean" version="2.0
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/
<dc:title>Roméo et Juliette</dc:title>
</metadata>
<manifest>
<item id="pt page-template.xpgt" media-type="application/vnd.adobe.page-template+xml"/>
<item id="style 9789999997049_css.css" media-type="text/css"/>
<item id="tp 9789999997049_tp.html" media-type="application/xhtml+xml"/>
</manifest>
</package>[/code]
<br/>
And I want to enumerate the item elements so I tried this :
<pre class="prettyprint var query = from item in xmlDoc.Descendants("item")
select new
{
Id = item.Attribute("id"),
Href = item.Attribute("href")
};[/code]
How can I enumerate my items elements ?
Thanks
View the full article
I am ashamed to ask this question but I tried for at least 15 minutes and I didnt manage to do it.<br/>
I have a simple xml file as shown below :
<pre class="prettyprint <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="ean" version="2.0
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/
<dc:title>Roméo et Juliette</dc:title>
</metadata>
<manifest>
<item id="pt page-template.xpgt" media-type="application/vnd.adobe.page-template+xml"/>
<item id="style 9789999997049_css.css" media-type="text/css"/>
<item id="tp 9789999997049_tp.html" media-type="application/xhtml+xml"/>
</manifest>
</package>[/code]
<br/>
And I want to enumerate the item elements so I tried this :
<pre class="prettyprint var query = from item in xmlDoc.Descendants("item")
select new
{
Id = item.Attribute("id"),
Href = item.Attribute("href")
};[/code]
How can I enumerate my items elements ?
Thanks
View the full article