Hello there, this is only my 2nd post to the forums, I am new to LiveCode and coding in general.
Also because this is only my 2nd post I could not post URL's so I have put all of my code i refer to in this post inside a sample livecode stack.
The app I am trying to build sends a request to a SOAP web service and returns XML data, I am trying to parse that XML data.
To begin with I have been following the lesson "How to read in data from an XML file" on the LiveCode Lessons website.
I replaced the sample XML file in this lesson with the XML data shown in the attached sample file (The XML is included in the bottom field - note in my actual app this is located in a file called preferences.xml - just like the lesson suggests)
Then following the lesson, and some assumptions I was making, I edited the code for parsing the XML to suit my XML file. ( the code for this is included on the button in my sample file )
In my live app when I press the button, I get this error "xmlerr, bad document id"
I am hoping someone can spot what I am clearly doing wrong and help point me in the right direction
Thanks in advance for taking the time to look at this
Parsing XML - xmlerr, bad document id
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller
-
- Posts: 7
- Joined: Sun Aug 06, 2017 1:54 pm
Parsing XML - xmlerr, bad document id
- Attachments
-
- samplecode.livecode.zip
- The parsing code is on the button in this stack and the sample XML file I am trying to parse I have just put into a field on the bottom of this stack. In my actual app this is in a file called preferences.xml as per the lesson
- (2.8 KiB) Downloaded 59 times
Re: Parsing XML - xmlerr, bad document id
Hi William,
you passed a param named pTree to your private command, but you do not use it in the handler:
Hint: Next train at: 12:29
Best
Klaus
you passed a param named pTree to your private command, but you do not use it in the handler:
Code: Select all
private command processPreferencesTree pTree
local tStd
## put revXMLNodeContents(tTreeID, "/Envelope/Body/GetDepartureBoardResponse/GetStationBoardResult/trainServices/service/std") into tStd
put revXMLNodeContents(pTree, "/Envelope/Body/GetDepartureBoardResponse/GetStationBoardResult/trainServices/service/std") into tStd
...

Best
Klaus
Re: Parsing XML - xmlerr, bad document id
Oh, and welcome to the forum! 

-
- Posts: 7
- Joined: Sun Aug 06, 2017 1:54 pm
Re: Parsing XML - xmlerr, bad document id
Amazing thank you. That works perfectly.
Thank you for taking the time to get back to me and explaining where I went wrong. It's much appreciated.
Thank you for taking the time to get back to me and explaining where I went wrong. It's much appreciated.