Page 1 of 1

XML parsing and revXMLNodeContents

Posted: Wed Jun 19, 2013 3:26 pm
by garyth123
Hi,

Suppose I have some data

<XMLSOCCER>
<Team>
<Team_Id>45</Team_Id>
<Name>Aberdeen</Name>
<Country>Scotland</Country>
<Stadium>Pittodrie Stadium</Stadium>
<HomePageURL>www.afc.co.uk</HomePageURL>
<WIKILink>http://en.wikipedia.org/wiki/Aberdeen_F.C.</WIKILink>
</Team>
...
</XMLSOCCER>

and I want to use revXMLNodeContents to get the Name of a Team.

I haven't been able to extract this info and it is driving me a bit nuts as I'm not clear what I'm doing wrong. I have for instance tried

put revCreateXMLTree(tResponse, false, true, false) into tDocID
put revXMLNodeContents(tDocID,"XMLSOCCER/Team_Id/Name") into tResult

and
put revCreateXMLTree(tResponse, false, true, false) into tDocID
put revXMLNodeContents(tDocID,"/XMLSOCCER/Team_Id/Name") into tResult

but I always get an xmlerr can't find element.

Can anyone give any further info (obviously I've consulted the Docs) on how this command should be used.

Thanks in advance.

Re: XML parsing and revXMLNodeContents

Posted: Wed Jun 19, 2013 3:36 pm
by Klaus
Hi garyth,

shouldn't this be "Team" without "_Id":
...
put revXMLNodeContents(tDocID,"XMLSOCCER/Team/Name") into tResult
...


Best

Klaus

Re: XML parsing and revXMLNodeContents

Posted: Wed Jun 19, 2013 3:47 pm
by garyth123
Klaus wrote:Hi garyth,

shouldn't this be "Team" without "_Id":
...
put revXMLNodeContents(tDocID,"XMLSOCCER/Team/Name") into tResult
...


Best

Klaus
Hi Klaus,

Thanks for spotting the above error but what I've put above is a typo or an error from copying over my code and then editing in the forum entry. I have tried eg

put revXMLNodeContents(tDocID,"/XMLSOCCER/Team/Name") into tResult

and as I say I keep getting an xmlerr, can't find element.

Re: XML parsing and revXMLNodeContents

Posted: Wed Jun 19, 2013 3:58 pm
by garyth123
Thanks Klaus, your post has helped me now to see my mistake.

Re: XML parsing and revXMLNodeContents

Posted: Wed Jun 19, 2013 4:26 pm
by Klaus
And what was it?

Re: XML parsing and revXMLNodeContents

Posted: Wed Jun 19, 2013 5:03 pm
by garyth123
Klaus wrote:And what was it?
I didn't get that for the required path you would put /root/node/child_2 say but thought it would have to include all prior child nodes so /root/node/child_1/child_2. Of course now I feel a bit silly.

Thanks again for responding and pointing out the obvious to me.

Re: XML parsing and revXMLNodeContents

Posted: Wed Jun 19, 2013 6:52 pm
by garyth123
Now discovering that I can make use of some of the other revXML commands that better suit my purpose.