Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
XML Parsing Problem ..Any suggestions
#1
Not Solved
iterating through the xml message works great when the results all have the same number of nodes but what do I do when a node is missing. For Ex. When I ask it to get the LastName value for PlayerID 17486 it grabs it from the next player (84636). I'd like it to be return the correct values within the PlayerFound tag.

Code:
Set nodes = xmlDoc.SelectNodes("/bookstore/book/title/text()")
' get their values
For i = 0 To (nodes.Length - 1)
    Title = nodes(i).NodeValue
    MsgBox "Title #" & (i + 1) & ": " & Title
Next

Set xmlPlayerID = xmlDoc.SelectNodes("CRMAcresMessage/Body/PlayerFind2/PlayersFound/PlayerFound/PlayerID/text()")
Set xmlFirstName = xmlDoc.SelectNodes("CRMAcresMessage/Body/PlayerFind2/PlayersFound/PlayerFound/FirstName/text()")
Set xmlLastName = xmlDoc.SelectNodes("CRMAcresMessage/Body/PlayerFind2/PlayersFound/PlayerFound/LastName/text()")
Set xmlPreferredName = xmlDoc.SelectNodes("CRMAcresMessage/Body/PlayerFind2/PlayersFound/PlayerFound/PreferredName/text()")
Set xmlRanking = xmlDoc.SelectNodes("CRMAcresMessage/Body/PlayerFind2/PlayersFound/PlayerFound/Ranking/text()")
Set xmlCreditAccount = xmlDoc.SelectNodes("CRMAcresMessage/Body/PlayerFind2/PlayersFound/PlayerFound/CreditAccount/text()")

<PlayerFound>
<PlayerID>84636</PlayerID>
<LastName>ACOSTA</LastName>
<FirstName>MATEO</FirstName>
<PreferredName>MATEO</PreferredName>
<CreditAccount>No</CreditAccount>
<Ranking>Level 1</Ranking>
</PlayerFound>

<PlayerFound>
<PlayerID>84642</PlayerID>
<LastName>ACOSTA</LastName>
<FirstName>MAURICIO</FirstName>
<PreferredName>MAURICIO</PreferredName>
<CreditAccount>No</CreditAccount>
<Ranking>Level 1</Ranking>
</PlayerFound>
Reply


Messages In This Thread
XML Parsing Problem ..Any suggestions - by Reed - 08-02-2011, 04:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting an 'Error in XML document' Error when submitting web services XML luckyexpert 0 3,157 08-20-2013, 10:23 PM
Last Post: luckyexpert
  Problem with creating an XML file Orbitz1 1 3,053 09-22-2009, 10:58 AM
Last Post: Saket
  Parsing value to report janriis 1 2,327 04-21-2009, 06:19 PM
Last Post: dvkbabu
  Need URGENT help how to read xml string / xml tag value in web page using QTP VQTP 2 5,969 04-16-2009, 02:27 AM
Last Post: VQTP

Forum Jump:


Users browsing this thread: 1 Guest(s)