Bad Document Id

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
LXS98
Posts: 6
Joined: Tue Apr 02, 2024 7:09 am

Bad Document Id

Post by LXS98 » Mon Apr 15, 2024 12:34 pm

Hi, I've been stuck using this code:

put "<ResultInfo>
<ErrorNumber>0</ErrorNumber>
<Result>Success</Result>
<Message>The codes for your meeting have been emailed to John along with some instructions</Message>
</ResultInfo>" into tXMLData

put revCreateXMLTree(tXMLData, true, true) into tTreeID
put revXMLNodeContents(tTreeID, "ResultInfo/Message") into tMessage

answer tMessage

Does anyone know why it does not display the Message from the XML response and it always says, bad document id?
Thanks for the help!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9393
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Bad Document Id

Post by richmond62 » Mon Apr 15, 2024 1:14 pm

Looks all a bit decontextualised really.

A bit more explanation might make things easier.

LXS98
Posts: 6
Joined: Tue Apr 02, 2024 7:09 am

Re: Bad Document Id

Post by LXS98 » Mon Apr 15, 2024 1:17 pm

My goal is to display the Result/Message using that XML.
But when I tried to run on it, it says bad document id.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9393
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Bad Document Id

Post by richmond62 » Mon Apr 15, 2024 2:17 pm

Display it where?

LXS98
Posts: 6
Joined: Tue Apr 02, 2024 7:09 am

Re: Bad Document Id

Post by LXS98 » Mon Apr 15, 2024 2:37 pm

Even just the use of "answer"

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Bad Document Id

Post by bn » Mon Apr 15, 2024 3:32 pm

Hi LXs98,

if you want to construct your xml from code inside the script try this:

Code: Select all

on mouseUp
   put "<ResultInfo>" &  \
         "<ErrorNumber>0</ErrorNumber>" &  \
         "<Result>Success</Result>" &  \
         "<Message>The codes for your meeting have been emailed to John along with some instructions</Message>" &  \
         "</ResultInfo>" into tXMLData
   put revCreateXMLTree(tXMLData, true, true) into tTreeID
   put revXMLNodeContents(tTreeID, "resultInfo/message") into tMessage
   
end mouseUp
or you could put your xml into a field
<ResultInfo>
<ErrorNumber>0</ErrorNumber>
<Result>Success</Result>
<Message>The codes for your meeting have been emailed to John along with some instructions</Message>
</ResultInfo>

and then code:

Code: Select all

on mouseUp
   put field 1 into tXMLData
   put revCreateXMLTree(tXMLData, true, true) into tTreeID
   put revXMLNodeContents(tTreeID, "resultInfo/message") into tMessage
end mouseUp
Both methods work for me, the one with the field is a bit easier to build.

Kind regards
Bernd

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”