Hi everyone,
I just want to say before I begin that i have, of course, looked at the different topics here about my matter AND read the documentation.
With that being said, my matter is that i want to get TAG values from XML String.
I insist on the TAG value and NOT attribute value.
Here is an exemple XML i use :
<?xml version="1.0" encoding="UTF-8"?>
<prestashop
xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
<id>
<![CDATA[41]]>
</id>
<id_manufacturer></id_manufacturer>
<id_supplier></id_supplier>
<id_category_default></id_category_default>
<new></new>
<cache_default_attribute></cache_default_attribute>
...
</product>
</prestashop>
And then, here’s the code I wrote so that i can get the ID value :
1. Var contentXML as new XmlDocument(content)
2. Var ids as XmlNodeList = contentXML.XQL("//id")
3. Var id as XmlNode = ids.Item(0)
So, with the first instruction, i import the XML which is in the “content” variable (String).
Secondly, I get all “id” nodes
Finally, i get the first “id” node.
Result :
< id>
< ![CDATA[41]]>
< /id>
THIS is exactly what I don’t want. How do i access the id node value ?
I’m taking this simple exemple here but i have XML with hundred of properties and i would like to parse all of them (or specific ones) and get their values. How can I do that?
The code I wrote was to get the closest possible to my need but I don’t need node or anything, I just want “//produt/id” value. I’ve seen TONS of topics explaining how to get attributes values, i don’t have any so it won’t help me
Thanks in advance for your help!