[jQuery] Using jQuery to Parse XML in AIR

[jQuery] Using jQuery to Parse XML in AIR


I'm trying to get Adobe(TM)(R) AIR to work with jQuery kinda friendly-
like. I'm sending off an xml-rpc request as follows:
                this.packageRequest = function(method, secure, params, callback) {
                    var msg = new XMLRPCMessage(method);
                    msg.addParameter(params);
                    urn = (secure) ? this.SecureUrn : this.Urn;
                    urn += this.istockEndPoint;
                    $.ajax({
                        url: urn,
                        data: msg.xml(),
                        dataType: 'xml',
                        type: 'POST',
                        contentType: 'text/xml',
                        success: callback
                    });
                }
All well and good, and for simple response groups, this works great.
The callback function is invoked and the xml sanitized. I'm not
certain why, but I have to do this dance in the callback:
function myFineCallback(data) {
xmlObjectTree = $($(data).text());
}
The problem I'm really bumping up against is the case where the XML
looks like:
<root>
<animals>
<category name="reptiles" />
<category name="mammals" />
<category name="marsupials" />
</animals>
</root>
You get the picture. The tags have no content. One would expect that:
xmlObjectTree.find('animals category').each( ... )
would iterate the animals tags, allowing me to pull the name attribute
out, but I'm getting a zero-length result. Same for xmlObjectTree.find
('category').
Any thoughts>