Page 1 of 1

Bad Document Id

Posted: Mon Apr 15, 2024 12:34 pm
by LXS98
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!

Re: Bad Document Id

Posted: Mon Apr 15, 2024 1:14 pm
by richmond62
Looks all a bit decontextualised really.

A bit more explanation might make things easier.

Re: Bad Document Id

Posted: Mon Apr 15, 2024 1:17 pm
by LXS98
My goal is to display the Result/Message using that XML.
But when I tried to run on it, it says bad document id.

Re: Bad Document Id

Posted: Mon Apr 15, 2024 2:17 pm
by richmond62
Display it where?

Re: Bad Document Id

Posted: Mon Apr 15, 2024 2:37 pm
by LXS98
Even just the use of "answer"

Re: Bad Document Id

Posted: Mon Apr 15, 2024 3:32 pm
by bn
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