I have this XML file (content.opf, part of an ePub package)
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="uuid_id">
<metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata" xmlns:dc="http://purl.org/dc/elements/1.1/">
<meta name="calibre:rating" content="2"/>
<meta name="calibre:series_index" content="1"/>
<dc:language>UND</dc:language>
<meta name="calibre:timestamp" content="2010-01-05T22:00:00"/>
<dc:title>Avontuur in het Verleden</dc:title>
<meta name="cover" content="cover"/>
<dc:date>2010-01-05 00:00:00+01:00</dc:date>
<dc:contributor opf:role="bkp">calibre (0.6.31) [http://calibre-ebook.com]</dc:contributor>
<dc:identifier id="uuid_id" opf:scheme="uuid">ec46162e-c1e6-48a9-8a31-1c95db70ba9e</dc:identifier>
<dc:identifier opf:scheme="ISBN"></dc:identifier>
<dc:description></dc:description>
<dc:creator opf:role="aut" opf:file-as="Anderson, Poul">Poul Anderson</dc:creator>
<dc:publisher>Prisma-boeken</dc:publisher>
<dc:subject>Science Fiction</dc:subject>
</metadata>
<manifest>
<item href="Ops/1.html" id="id1" media-type="application/xhtml+xml"/>
<item href="Ops/2.html" id="id2" media-type="application/xhtml+xml"/>
<item href="Ops/3.html" id="id3" media-type="application/xhtml+xml"/>
<item href="Ops/4.html" id="id4" media-type="application/xhtml+xml"/>
<item href="Ops/5.html" id="id5" media-type="application/xhtml+xml"/>
<item href="Ops/6.html" id="id6" media-type="application/xhtml+xml"/>
<item href="Ops/7.html" id="id7" media-type="application/xhtml+xml"/>
<item href="cover.jpg" id="cover" media-type="image/jpeg"/>
<item href="stylesheet.css" id="css" media-type="text/css"/>
<item href="titlepage.xhtml" id="titlepage" media-type="application/xhtml+xml"/>
<item href="toc.ncx" media-type="application/x-dtbncx+xml" id="ncx"/>
</manifest>
<spine toc="ncx">
<itemref idref="titlepage"/>
<itemref idref="id1"/>
<itemref idref="id2"/>
<itemref idref="id3"/>
<itemref idref="id4"/>
<itemref idref="id5"/>
<itemref idref="id6"/>
<itemref idref="id7"/>
</spine>
<guide>
<reference href="titlepage.xhtml" type="cover" title="Cover"/>
</guide>
</package>
I want to read all ‘dc:’ elements
My code:
[code]'opens the XML file
dim xmlDoc as new XmlDocument
dim aNodeList as XMLNodeList
dim i,j as Integer
xmlDoc.LoadXML(XMLFile)
'perform xql query
aNodeList = xmlDoc.Xql("/package[1]/metadata[1]/*")
'loop through nodelist and check siblings
for i = 0 to aNodelist.Length-1
for j = 0 to aNodeList.Item(i).ChildCount-1
Msgbox(aNodeList.Item(i).Name)
next
next[/code]
That performs ok, I get all the dc: info but I want the content of the specific sibling, not only the name.
aNodeList.Item(i).ToString
does not work, that shows the total node information. I think it must be something like
aNodeList.Item(i).GetAttribute(theAttribute)
But what if I don’t know the name of the attributes?