> Essentially, the XML parser brings your data into a property list--
> probably a list of lists. It's confusing, though, to see every entry in
> the list prefaced with !ATTRIBUTES: [:] as the first property, all the
> way through the node tree.
Walking a document tree exposed by the XMLParser Xtra is possible (and
easier) via its interface. You don't have to rely on the horrendous property
list that the makeList( ) method returns (althought there are some good uses
for it). The object returned by the Xtra is equivalent to the document
declaration, and the first child of that object is the document element.
That document element object is the parent node for all the children in the
document.
loParser = new(xtra "XMLParser")
liErr = loParser.parseString(member("XML").text)
if voidP(liErr) then
-- document element is the first child of the parse object
loDocElem = loParser.child[1]
-- the count property of any node reveals the number of children
repeat with i = 1 to loDocElem.child.count
-- the children of a node are found in the child list
loChildNode = loDocElem.child[i]
-- the tag name for each child is in its name property
lsTagName = loChildNode.name
-- any attributes of an element are accessed through other properties
repeat with j = 1 to loChildNode.attributeName.count
lsAttrName = loChildNode.attributeName[j]
lsAttrValue = loChildNode.attributeValue[j]
end repeat
end repeat
end if
Actually, it's pretty nice. I'd change a few things, but overall I think it
does a good job.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Christopher Watson
Sr. Software Engineer
Lightspan, Inc.
http://www.lightspan.com/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[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!]