At the risk of seeming dense: how would I fix my second example?  I’ve been through the help docs and Ben’s examples, but I’m just not getting it.

 


From: [email protected] [mailto:[email protected]] On Behalf Of Gordon Smith
Sent: Wednesday, August 16, 2006 1:26 PM
To: [email protected]
Subject: RE: [flexcoders] Re: XML parser chokes on un-typed xmlns

 

More explanation...

 

Tom, the behavior you saw was correct.

 

In your first case, defining the soap namespace prefix on <a> doesn't affect <b>, because <b> has no namespace prefix and is therefore in the undefined default namespace, not in the soap namespace.

 

In your second case, you are defining a default namespace on <a>, which affects the child tag <b>. So descendants("b") doesn't find <b>.

 

I didn't look at Ben's links, but they presumably explain how to programmatically access tags and attributes when you define a default namespace.

 

- Gordon

 


From: [email protected] [mailto:[email protected]] On Behalf Of ben.clinkinbeard
Sent: Wednesday, August 16, 2006 9:46 AM
To: [email protected]
Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns

 

http://www.returnundefined.com/2006/07/dealing-with-default-namespaces-in-flex-2as3/

Ben
http://www.returnundefined.com/

--- In [email protected], "Tom Lee" <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
>
>
> I am having some difficulty parsing .Net web service results. The
problem
> lies in the fact that Flex's XML parser doesn't like un-typed xmlns
> declarations of the type found by default in .Net web services. Try the
> following:
>
>
>
>
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
> creationComplete="doIt()">
>
> <mx:Script>
>
> <![CDATA[
>
> function doIt(){
>
> var myXML:XML =
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
>
> <soap:Body>
>
>
> <a xmlns:soap="http://tempuri.org/ ">
>
>
> <b>Hi</b>
>
>
> </a>
>
>
> </soap:Body>
>
>
> </soap:Envelope>
>
> trace("Node B from
myXML:
> "+myXML.descendants("b"));
>
>
>
> var myXML2:XML =
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
>
> <soap:Body>
>
>
> <a xmlns="http://tempuri.org/ ">
>
>
> <b>Hi</b>
>
>
> </a>
>
>
> </soap:Body>
>
>
> </soap:Envelope>
>
> trace("Node B from
myXML2:
> "+myXML2.descendants("b"));
>
> }
>
> ]]>
>
> </mx:Script>
>
> </mx:Application>
>
>
>
>
>
>
>
> This code results in the following traces:
>
>
>
> Node B from myXML: Hi
>
> Node B from myXML2:
>
>
>
> As you can see, the only difference between the two blocks of XML is
that
> the successful one uses "xmlns:soap=" while the unsuccessful one uses
> "xmlns=". While I am no SOAP expert, I don't believe the 2nd one is
invalid
> syntax, so there should be no reason for the XML parser to ignore
it, right?
>
>
>
> Anyone have a workaround for me that doesn't require modifying the web
> services? (I don't have administrative access to them).
>
>
>
> Thanks!
>
>
>
> -tom
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to