Problem parsing XML from a SOAP call
Problem parsing XML from a SOAP call
- Subject: Problem parsing XML from a SOAP call
- From: Tim Jarrett <email@hidden>
- Date: Wed, 20 Feb 2002 15:37:22 -0500
Folks:
I'm having some interesting times parsing the XML from a SOAP call.
I'm using the SOAP API for the Manila content management engine. For
the most part the output is pretty straightforward, and I can go in
and grab the pieces I'm looking for by name. However, I'm having
problems with getting access to items in this XML structure (appended
at the end of the message).
AppleScript turns the XML into a list with named items, with each
item having the format
departmentname:{createdDate:timestamp, pictureshortcut:"picturename"}
where <departmentname> varies for each item in the list. My question:
how can I figure out what <departmentname> is for a given item? I
don't know enough syntax to figure it out... it's not as simple as
"get name of the first item of theList", because I get an error
message that AppleScript can't get item 1 of the whole variable.
Thanks
Tim
--
The script:
tell application "
http://mysite.editthispage.com/manila/sitePref"
set categories to call soap {method name:"get",
parameters:{username:"myusername",|password|:"mypassword",sitename:"mysite",prefName:"newsitems.departments"},
method namespace
uri:"
http://www.soapware.org",SOAPAction:"/manila/sitePref"}
end tell
The XML output:
<?xml version="1.0"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="
http://www.w3.org/1999/XMLSchema"
xmlns:xsi="
http://www.w3.org/1999/XMLSchema-instance">
<SOAP-ENV:Body>
<getResponse>
<Result>
<America>
<createdDate
xsi:type="xsd:timeInstant">2001-11-19T08:42:26-08:00</createdDate>
<pictureShortcut
xsi:type="xsd:string">topicAmerica</pictureShortcut>
</America>
<Boston>
<createdDate
xsi:type="xsd:timeInstant">2001-11-12T09:29:28-08:00</createdDate>
</Boston>
<E-52s>
<createdDate
xsi:type="xsd:timeInstant">2001-12-10T10:34:47-08:00</createdDate>
<pictureShortcut
xsi:type="xsd:string">topicE52s</pictureShortcut>
</E-52s>
</Result>
</getResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The contents of the AppleScript variable categories:
{america:{createddate:+data
isot323030312D31312D31395430383A34323A32362D30383A3030;,
pictureshortcut:"topicAmerica"}, boston:{createddate:+data
isot323030312D31312D31325430393A32393A32382D30383A3030;},
|e-52s|:{createddate:+data
isot323030312D31322D31305431303A33343A34372D30383A3030;,
pictureshortcut:"topicE52s"}}
--
Tim Jarrett
email@hidden
http://www.mit.edu/~tjarrett/
_______________________________________________
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.