PROBLEMS WITH XML!!
First...
global gParserObject
gParserObject = new(xtra "xmlparser")
I call this function with two parameters.
i.e "set getXML = xml_dialog(5,1)"
The function "search" my XML file(code) for
the node named "stage" with the attributeValue "5"
and wich contain a child node named "dialog" with a
attributeValue "1". When it find's it it should put
a certain node attributeValue.
The script works fine with this parameters
"set getXML = xml_dialog(5,1)"
but when I try to get the nodes with parameters:
"set getXML = xml_dialog(2,1)"
I doesn't return anything!?
WHY? Please help me on this,
it seems like I can't step through the
XML correctly!?
Here's my code, the XML is last.
--code------>
on xml_dialog stage_id, dialog_id
global gParserObject, stage_node
repeat with i = 1 to gParserObject.child[1].child[1].child.count-1
test1 = gParserObject.child[1].child[i].attributeValue[1]
if test1 = stage_id then
put gParserObject.child[1].child[i].attributeValue[1]
stage_node = i
set getXML = xml_dialog_num(dialog_id)
end if
end repeat
end
on xml_dialog_num dialog_id
global gParserObject, stage_node
repeat with i = 1 to gParserObject.child[1].child[stage_node].child[1].child.count-1
test2 = gParserObject.child[1].child[stage_node].child[i].attributeValue[1]
if test2 = dialog_id then
put gParserObject.child[1].child[stage_node].child[i].attributeValue[1]
put gParserObject.child[1].child[stage_node].child[i].child[1].attributeValue[1]
end if
end repeat
end
--XML------->
<?xml version="1.0" encoding="ISO-8859-1" ?>
<language value="english">
<stage id="5">
<dialog id="1">
<question text="Hello, I am Mr Harvey!./>
<answer text="Hello fellow!"/>
<answer text="Who are you?"/>
</dialog>
<dialog id="2">
<question text="Right now you should..."/>
<answer text="Yes, I assumed that!"/>
</dialog>
</stage>
<stage id="2">
<dialog id="1">
<question text="Read this..." />
<answer text="Okay!"/>
<answer text="No I don't want to!"/>
</dialog>
<dialog id="2">
<question text="Go to bathroom!"/>
<answer text="Okay right away!"/>
</dialog>
</stage>
</language>
<-----end--
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]