Page 1 of 1

How To - get XML node name

Posted: Mon Oct 28, 2013 10:28 pm
by palanolho
Greetings Everyone,

I'm having a little trouble with a script I'm doing that work with XML trees.

I'm trying to get all the nodes from the XML tree (in memory) and add them to a dataArray to put on a datagrid form.
I'm using a loop with the revXMLFirstChild(...) and revXMLNextSibling(...) to iterate through the nodes and get the data I need.

However, one of the attributes need to add to the array is the node name.

Using the revXMLFirstChild(...) and revXMLNextSibling(...) functions the result is something like this: "/tokens/single[1]"

so, the information I need to set is only the "single".
I tried to search around for some function or way to do it but had no luck with it.

Anyone has any idea on how can I do this?

Many thanks ins advance,
- Miguel

Re: How To - get XML node name

Posted: Wed Oct 30, 2013 11:37 pm
by Mark
Hi Miguel,

Do you mean that you want to get the node name from the string "/tokens/single[1]"?

Code: Select all

set the itemDel to slash
put last item of myXmlPath into myNode --> single[1]
set the itemDel to "["
put item 1 of myNode into myNode --> single
Kind regards,

Mark

Re: How To - get XML node name

Posted: Thu Oct 31, 2013 10:22 am
by palanolho
Greetigns Mark
put last item of myXmlPath into myNode --> single[1]
this was very helpful!! thanks a lot :)

Many thanks
- Miguel