Erik,

Congratulations. You have now experienced the abomination which is the
"makeList" method of the XMLParser Xtra. Now...forget it.

Instead, keep the XMLParser Xtra object around after creation and parsing,
and use the Lingo interface it provides to access the nodes in the document
tree. To access the value for the "easy" attribute of the <quit> element,
you do this:

goXML = new(xtra "XMLParser")
goXML.parseString(lsMyXML)
lsAttrVal = goXML.child[1].attributeValue[1]

The first child of the XMLParser Xtra object is always the document element.
In this case, the <quiz> element. That child object has a list of attribute
names and values. It's an empty list if there are no attributes for the
element. In this case, the first item in those lists pertain to the first
attribute; attributeName[1] is the attribute's name ("easy"), and
attributeValue[1] is the attribute's value ("no way").

Using the dot-syntax Lingo interface from the Xtra is a whole heck of a lot
easier than trying to deal with the property list that the "makeList" method
returns.

<shamelessPlug>

In DOM-Lingo, you would go about it this way:

goDOMParser = new(script "DOM_Parser")
goDOMParser.parseString(lsMyXML)
lsAttrVal = goDOMParser.getDocument().getFirstChild().getAttribute("easy")

</shamelessPlug>

Christopher Watson
Sr. Software Engineer
Lightspan, Inc.


-----Original Message-----
From: Erik Phalet [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 5:43 AM
To: '[EMAIL PROTECTED]'
Subject: <lingo-l> Working with a list from XML


I want to use the xml Xtra in a project, with the makeList() method, and
just plain list-handling from there....

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]

Reply via email to