> I'm retrieving an XML packet from an API that uses the XML-RPC standard
> (http://www.xmlrpc.com/spec).

First, have you looked at this?
http://support.journurl.com/users/admin/index.cfm?mode=article&entry=362

> When I connect to the Login method of this API, I need to pull the session ID 
> out of
> the packet. I can do that long-hand with this:
>
> <cfset local.loginResponseSID =
> local.requestXMLObject.XMLRoot.XMLChildren[1].XMLChildren[1].XMLChildren[1].
> XMLChildren[1].XMLChildren[1].XMLChildren[2].XMLChildren[1].XMLText />
>
> But, there must be a cleaner way to do this, right?

Almost certainly. In general, you can simply refer to XML elements as
nested arrays and structures, using the names of the elements; if
they're repeated within a single parent, you use array notation to get
to the one you want.

So, if you had a document like this in myXmlObj:

<xmldoc>
     <child>
          <grandchild>value1</grandchild>
     </child>
     <child>
          <grandchild>value2</grandchild>
     </child>
</xmldoc>

you could get to "value2" using:

myXmlObj.child[2].grandchild.xmlText

(Actually, since it's nearly 3am, I could very well have a minor error
in that, but the basic point stands.)

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324099
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to