XML parsing and revXMLNodeContents
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
XML parsing and revXMLNodeContents
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.
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
Hi garyth,
shouldn't this be "Team" without "_Id":
...
put revXMLNodeContents(tDocID,"XMLSOCCER/Team/Name") into tResult
...
Best
Klaus
shouldn't this be "Team" without "_Id":
...
put revXMLNodeContents(tDocID,"XMLSOCCER/Team/Name") into tResult
...
Best
Klaus
Re: XML parsing and revXMLNodeContents
Hi Klaus,Klaus wrote:Hi garyth,
shouldn't this be "Team" without "_Id":
...
put revXMLNodeContents(tDocID,"XMLSOCCER/Team/Name") into tResult
...
Best
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
Thanks Klaus, your post has helped me now to see my mistake.
Re: XML parsing and revXMLNodeContents
And what was it?
Re: XML parsing and revXMLNodeContents
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.Klaus wrote:And what was it?
Thanks again for responding and pointing out the obvious to me.
Re: XML parsing and revXMLNodeContents
Now discovering that I can make use of some of the other revXML commands that better suit my purpose.