>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).
So I figured out today--you're right on the money. I abandoned the property
list approach after seeing Jakob's post last night. While my solution isn't
as all-encompassing as his, it is a different approach.
Here's the XML to be parsed:
<crosswords>
<puzzle level="beginning">
<title>Business Across Cultures</title>
<entry>
<answer>Breed</answer>
<clue>A particular kind of person</clue>
</entry>
<entry>
<answer>Discriminate</answer>
<clue>Show perceptive judgment</clue>
</entry>
</puzzle>
<puzzle level="Intermediate">
<title>Hot Ideas</title>
<entry>
<answer>per</answer>
<clue>for each</clue>
</entry>
</puzzle>
</crosswords>
and I did it with this code, quite similar to your approach:
gParserObject = new(xtra "xmlparser")
err = gParserObject.parseString(xmlStr) --xmlStr downloaded from URL
if voidP(err) then
numPuzzles=gParserObject.child[1].child.count
repeat with i = 1 to numPuzzles
add gPuzzleNumList, i
-- Get the level
lPuzzleLevel = gParserObject.child[1].child[i].attributeValue["level"]
add gLevelList, lPuzzleLevel
--Get the title
lPuzzleTitle = gParserObject.child[1].child[i].child[1].child[1].text
add gTitleList, lPuzzleTitle
numEntries = gParserObject.child[1].child[i].child.count
repeat with j = 1 to numEntries
if gParserObject.child[1].child[i].child[j].name="entry" then
wrd = gParserObject.child[1].child[i].child[j].child[1].child[1].text
--uppercase the word
repeat with k = 1 to wrd.length
put convertToCaps(wrd.char[k]) into char k of wrd
end repeat
clue =
gParserObject.child[1].child[i].child[j].child[2].child[1].text
add lPuzzleList, [#word: wrd, #clue: clue]
end if
end repeat
add gPuzzleList, lPuzzleList
end repeat
Cordially,
Kerry Thompson
Learning Network
[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!]