I can’t believe how crap I am at XML.
I have the following xml structure derived from a larger xml document using xpath:
XmlName HomeTeam
XmlNsPrefix null
XmlNsURI null
XmlText France
XmlComment null
XmlAttributes
alternateId 409
id 21
The coldfusion code for narrowing the document down to this structure is:
<cfset homeTeam = XmlSearch(myXml,"/SportalData/Sport/LiveScores/Competition/Match/HomeTeam/") />
Now, all I want to do is access the XMLText value (“France”) and use it in my html.
How do I do this?
Presuming the variable
homeTeamis the result of anxmlSearch()call thenhomeTeamis an array so this should work:Obviously, just be aware that the array length can be zero if the node is not found.
Hope that helps.