AS records & LNS XML Tools
AS records & LNS XML Tools
- Subject: AS records & LNS XML Tools
- From: Phi Sanders <email@hidden>
- Date: Mon, 19 Aug 2002 16:26:59 -0400
Can someone point me in the right direction please? I need to parse some
XML (using the free LNS XML tools) and I've written everything around
recursion but can't get my test to work.
on recurseElements(iElement)
-- because we don't KNOW how deep a particular element will be
-- we have to use recursion to get to a level without records
if iElement contains |XML contents| then
--recurse until we hit a leaf element
recurseElements(|XML contents| of iElement)
else
-- leaf node!
-- process tag
set vResult to processElement(iElement)
return vResult
end if
end recurseElements
So - I need help with determing whether or not the current applescript
record has an "XML Contents" item in the record... Example XML data below
>
MoonShark
-- raw XML
<library>
<topic title="Books by Topic">
<subject title="Autobiography">
<item vid="4-9-813-1970" title="Alexander - My life as a Geek"/>
</subject>
<divider />
<subject title="Fantasy">
<item vid="1-888-444-3845" title="Mephisto - What is Evil?"/>
</subject>
</topic>
</library>
-- parsed XML becomes nested AS records
{class:XML document, XML tag:"library", XML contents:{
{class:XML element, XML tag:"topic", XML attributes:{title:"Books by
Topic"}, XML contents:{
{class:XML element, XML tag:"subject", XML
attributes:{title:"Autobiography"}, XML contents:{
{class:XML element, XML tag:"item", XML attributes:{vid:"4-9-813-
1970", title:"Alexander - My life as a Geek"}}
}},
{class:XML element, XML tag:"divider"},
{class:XML element, XML tag:"subject", XML
attributes:{title:"Fantasy"}, XML contents:{
{class:XML element, XML tag:"item", XML attributes:{vid:"1-888-444-
4673", title:"Mephisto - What is Evil?"}}
}}
}}
}}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.