[flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread ben.clinkinbeard
http://www.returnundefined.com/2006/07/dealing-with-default-namespaces-in-flex-2as3/

Ben
http://www.returnundefined.com/

--- In flexcoders@yahoogroups.com, 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/ 
 
  
 bHi/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/ 
 
  
 bHi/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 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread Tom Lee
Thanks, Ben - I've seen this before (I believe you directed me to this page
on a previous issue).  However, I don't understand how it applies to my
particular problem - how would you fix my example using the namespace
directive?

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ben.clinkinbeard
Sent: Wednesday, August 16, 2006 12:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns

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

Ben
http://www.returnundefined.com/

--- In flexcoders@yahoogroups.com, 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/ 
 
  
 bHi/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/ 
 
  
 bHi/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 
Yahoo! Groups Links



 






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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




RE: [flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread Gordon Smith












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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of ben.clinkinbeard
Sent: Wednesday, August 16, 2006
9:46 AM
To: flexcoders@yahoogroups.com
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 flexcoders@yahoogroups.com,
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/

 
 
 bHi/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/

 
 
 bHi/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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






[flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread ben.clinkinbeard
Hi Tom,

Sorry, I've not used the descendants method before and I just assumed
the approach I use would work. If you use .. instead it will work as
expected.

namespace temp = http://tempuri.org/;;
use namespace temp;
trace(Node B from myXML2:  + myXML2..b);

HTH,
Ben


--- In flexcoders@yahoogroups.com, Tom Lee [EMAIL PROTECTED] wrote:

 Thanks, Ben - I've seen this before (I believe you directed me to
this page
 on a previous issue).  However, I don't understand how it applies to my
 particular problem - how would you fix my example using the namespace
 directive?
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of ben.clinkinbeard
 Sent: Wednesday, August 16, 2006 12:46 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
 

http://www.returnundefined.com/2006/07/dealing-with-default-namespaces-in-fl
 ex-2as3/
 
 Ben
 http://www.returnundefined.com/
 
 --- In flexcoders@yahoogroups.com, Tom Lee design@ 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/ 
  
   
  bHi/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/ 
  
   
  bHi/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 
 Yahoo! Groups Links







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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread Tom Lee












At the risk of seeming dense: how would I
fix my second example? Ive been through the help docs and Bens
examples, but Im just not getting it.











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
Sent: Wednesday, August 16, 2006
1:26 PM
To: flexcoders@yahoogroups.com
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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of ben.clinkinbeard
Sent: Wednesday, August 16, 2006
9:46 AM
To: flexcoders@yahoogroups.com
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 flexcoders@yahoogroups.com,
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/

 
 
 bHi/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/

 
 
 bHi/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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___





RE: [flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread Tom Lee
Awesome!  That's got it!  Thanks so much.  Seems odd that we have to
manually declare these namespaces just to parse a little XML, doesn't it?

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ben.clinkinbeard
Sent: Wednesday, August 16, 2006 2:31 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns

Hi Tom,

Sorry, I've not used the descendants method before and I just assumed
the approach I use would work. If you use .. instead it will work as
expected.

namespace temp = http://tempuri.org/;;
use namespace temp;
trace(Node B from myXML2:  + myXML2..b);

HTH,
Ben


--- In flexcoders@yahoogroups.com, Tom Lee [EMAIL PROTECTED] wrote:

 Thanks, Ben - I've seen this before (I believe you directed me to
this page
 on a previous issue).  However, I don't understand how it applies to my
 particular problem - how would you fix my example using the namespace
 directive?
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of ben.clinkinbeard
 Sent: Wednesday, August 16, 2006 12:46 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
 

http://www.returnundefined.com/2006/07/dealing-with-default-namespaces-in-fl
 ex-2as3/
 
 Ben
 http://www.returnundefined.com/
 
 --- In flexcoders@yahoogroups.com, Tom Lee design@ 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/ 
  
   
  bHi/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/ 
  
   
  bHi/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 
 Yahoo! Groups Links







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



 






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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread ben.clinkinbeard
Don't get me started on default namespaces in Flex/AS3... :)

--- In flexcoders@yahoogroups.com, Tom Lee [EMAIL PROTECTED] wrote:

 Awesome!  That's got it!  Thanks so much.  Seems odd that we have to
 manually declare these namespaces just to parse a little XML,
doesn't it?
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of ben.clinkinbeard
 Sent: Wednesday, August 16, 2006 2:31 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
 
 Hi Tom,
 
 Sorry, I've not used the descendants method before and I just assumed
 the approach I use would work. If you use .. instead it will work as
 expected.
 
 namespace temp = http://tempuri.org/;;
 use namespace temp;
 trace(Node B from myXML2:  + myXML2..b);
 
 HTH,
 Ben
 
 
 --- In flexcoders@yahoogroups.com, Tom Lee design@ wrote:
 
  Thanks, Ben - I've seen this before (I believe you directed me to
 this page
  on a previous issue).  However, I don't understand how it applies
to my
  particular problem - how would you fix my example using the namespace
  directive?
  
  -Original Message-
  From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On
  Behalf Of ben.clinkinbeard
  Sent: Wednesday, August 16, 2006 12:46 PM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
  
 

http://www.returnundefined.com/2006/07/dealing-with-default-namespaces-in-fl
  ex-2as3/
  
  Ben
  http://www.returnundefined.com/
  
  --- In flexcoders@yahoogroups.com, Tom Lee design@ 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/ 
   

   bHi/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/ 
   

   bHi/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 
  Yahoo! Groups Links
 
 
 
 
 
 
 
 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
 Yahoo! Groups Links








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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




RE: [flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread Tom Lee
I've been debating about whether it might not be worth it just to strip out
all the xmlns declarations with a little regex... I talked it over briefly
with the web service developers and they couldn't even really explain why
those are present or what they are for... Just that Visual Studio puts them
in by default.  I understand that they might prevent collisions between
nodes of the same name, but in our case that's irrelevant since we never use
the same node name for multiple purposes.

Another idea I had would be to automagically loop through all the nodes in
the XML, find all the namespaces, and declare them... But frankly, I don't
know enough about the topic to understand the downsides of doing something
like that.  What do you think of the idea?

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ben.clinkinbeard
Sent: Wednesday, August 16, 2006 3:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns

Don't get me started on default namespaces in Flex/AS3... :)

--- In flexcoders@yahoogroups.com, Tom Lee [EMAIL PROTECTED] wrote:

 Awesome!  That's got it!  Thanks so much.  Seems odd that we have to
 manually declare these namespaces just to parse a little XML,
doesn't it?
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of ben.clinkinbeard
 Sent: Wednesday, August 16, 2006 2:31 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
 
 Hi Tom,
 
 Sorry, I've not used the descendants method before and I just assumed
 the approach I use would work. If you use .. instead it will work as
 expected.
 
 namespace temp = http://tempuri.org/;;
 use namespace temp;
 trace(Node B from myXML2:  + myXML2..b);
 
 HTH,
 Ben
 
 
 --- In flexcoders@yahoogroups.com, Tom Lee design@ wrote:
 
  Thanks, Ben - I've seen this before (I believe you directed me to
 this page
  on a previous issue).  However, I don't understand how it applies
to my
  particular problem - how would you fix my example using the namespace
  directive?
  
  -Original Message-
  From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On
  Behalf Of ben.clinkinbeard
  Sent: Wednesday, August 16, 2006 12:46 PM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
  
 

http://www.returnundefined.com/2006/07/dealing-with-default-namespaces-in-fl
  ex-2as3/
  
  Ben
  http://www.returnundefined.com/
  
  --- In flexcoders@yahoogroups.com, Tom Lee design@ 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/ 
   

   bHi/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/ 
   

   bHi/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

Re: [flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread Claus Wahlers

 Another idea I had would be to automagically loop through all the nodes in
 the XML, find all the namespaces, and declare them... But frankly, I don't
 know enough about the topic to understand the downsides of doing something
 like that.  What do you think of the idea?

Class XML:
AS3 function XML.namespaceDeclarations():Array
Lists namespace declarations associated with the XML object in the 
context of its parent.

Does that help?
Cheers,
Claus.



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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Re: XML parser chokes on un-typed xmlns

2006-08-16 Thread Tom Lee
Thanks for your help on this, Claus and Ben.  I'll keep looking into it and
see if I can come up with something a little more dynamic.

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ben.clinkinbeard
Sent: Wednesday, August 16, 2006 4:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns

I went round and round with different ideas about how to deal with
these issues shortly after I started working with Flex. I even had
some issues using namespaceDeclarations() which, as Claus points out,
should work in retrieving them.

The solution I posted on my site was the best I was able to devise
because the 'use namespace' directive provided the most flexible way
to work with XML, but you can only define those types of namespaces
with compile-time constants. For instance, you can't do this:

namespace def = myXML.namespaceDeclarations()[0];
use namespace def;

If someone figures out an easier and/or more flexible way I am
definitely all ears though.

Ben


--- In flexcoders@yahoogroups.com, Tom Lee [EMAIL PROTECTED] wrote:

 I've been debating about whether it might not be worth it just to
strip out
 all the xmlns declarations with a little regex... I talked it over
briefly
 with the web service developers and they couldn't even really
explain why
 those are present or what they are for... Just that Visual Studio
puts them
 in by default.  I understand that they might prevent collisions between
 nodes of the same name, but in our case that's irrelevant since we
never use
 the same node name for multiple purposes.
 
 Another idea I had would be to automagically loop through all the
nodes in
 the XML, find all the namespaces, and declare them... But frankly, I
don't
 know enough about the topic to understand the downsides of doing
something
 like that.  What do you think of the idea?
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of ben.clinkinbeard
 Sent: Wednesday, August 16, 2006 3:18 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
 
 Don't get me started on default namespaces in Flex/AS3... :)
 
 --- In flexcoders@yahoogroups.com, Tom Lee design@ wrote:
 
  Awesome!  That's got it!  Thanks so much.  Seems odd that we have to
  manually declare these namespaces just to parse a little XML,
 doesn't it?
  
  -Original Message-
  From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On
  Behalf Of ben.clinkinbeard
  Sent: Wednesday, August 16, 2006 2:31 PM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
  
  Hi Tom,
  
  Sorry, I've not used the descendants method before and I just assumed
  the approach I use would work. If you use .. instead it will work as
  expected.
  
  namespace temp = http://tempuri.org/;;
  use namespace temp;
  trace(Node B from myXML2:  + myXML2..b);
  
  HTH,
  Ben
  
  
  --- In flexcoders@yahoogroups.com, Tom Lee design@ wrote:
  
   Thanks, Ben - I've seen this before (I believe you directed me to
  this page
   on a previous issue).  However, I don't understand how it applies
 to my
   particular problem - how would you fix my example using the
namespace
   directive?
   
   -Original Message-
   From: flexcoders@yahoogroups.com
 [mailto:[EMAIL PROTECTED] On
   Behalf Of ben.clinkinbeard
   Sent: Wednesday, August 16, 2006 12:46 PM
   To: flexcoders@yahoogroups.com
   Subject: [flexcoders] Re: XML parser chokes on un-typed xmlns
   
  
 

http://www.returnundefined.com/2006/07/dealing-with-default-namespaces-in-fl
   ex-2as3/
   
   Ben
   http://www.returnundefined.com/
   
   --- In flexcoders@yahoogroups.com, Tom Lee design@ 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/ 

 
bHi/b

 
/a

 
/soap:Body

 
/soap:Envelope

trace(Node B from
   myXML:
+myXML.descendants(b