I'm parsing an XML document with VTD-XML library and need to get version tag from the document.
My document looks like this;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rootNode>
<items>
<item>
<name>XXX</name>
<lastName>YYY</lastName>
<number>1234</number>
</item>
<item>
<name>AAA</name>
<lastName>BBB</lastName>
<number>5678</number>
</item>
<item>
<name>CCC</name>
<lastName>DDD</lastName>
<number>9012</number>
</item>
</items>
</rootNode>
I need to get this line.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
How can I do it?
If you just need the token "1.0", get the TOKEN_DEC_ATTR_NAME token index corresponding to "version" the next one (index+1) is the one. Just iterate thru the tokens with the right token type and test the index value with built-in methods of Vtdnav class.