I like how I responded two hours before Tracy and it just now appeared.... 
Whatever.   The other thing is that you could have a "memory reference loop".  
How are you calling the function?


--- In flexcoders@yahoogroups.com, "zyzzx00_99" <jer...@...> wrote:
>
> Your method works fine for me.  The problem is most likely that you're 
> passing in an XMLNode in to objectToXML and you're getting into a loop inside 
> of encodeValue.  Debug and start hitting f5 and f6 down the chain of the 
> framework if you really want to understand it.  Otherwise just say 
> if(obj is XMLNode) 
>    return obj;
> 
> 
> --- In flexcoders@yahoogroups.com, "Tracy Spratt" <tracy@> wrote:
> >
> > Look up XMLNode in the docs, you will understand why.
> > 
> >  
> > 
> > Tracy Spratt,
> > 
> > Lariat Services, development services available
> > 
> >   _____  
> > 
> > From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> > Behalf Of markgoldin_2000
> > Sent: Monday, April 20, 2009 5:50 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Stack overflow
> > 
> >  
> > 
> > 
> > 
> > 
> > 
> > 
> > Well, this crashes too:
> > public function objectToXML(obj:Object):XMLNode 
> > {
> > var qName:QName = new QName("root");
> > var xmlDocument:XMLDocument = new XMLDocument();
> > var simpleXMLEncoder:SimpleXMLEncoder = new SimpleXMLEncoder(xmlDocument);
> > var xmlNode:XMLNode = simpleXMLEncoder.encodeValue(obj, qName, xmlDocument);
> > return xmlNode;
> > }
> > 
> > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> > "Tracy Spratt" <tracy@> wrote:
> > >
> > > You are mixing up the XML implementation versions.
> > > 
> > > 
> > > 
> > > XMLDocument and simpleDecoder are legacy AS2 classes, included in AS3 only
> > > for backwards compatibility.
> > > 
> > > 
> > > 
> > > You cannot use them with XML() which is an e4x implementation.
> > > 
> > > 
> > > 
> > > Tracy Spratt,
> > > 
> > > Lariat Services, development services available
> > > 
> > > _____ 
> > > 
> > > From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> > [mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com]
> > On
> > > Behalf Of markgoldin_2000
> > > Sent: Monday, April 20, 2009 4:21 PM
> > > To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> > > Subject: [flexcoders] Stack overflow
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > I am getting the following:
> > > Error: Error #1023: Stack overflow occurred.
> > > at flash.xml::XMLNode()
> > > at flash.xml::XMLDocument/createElement()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > at mx.rpc.xml::SimpleXMLEncoder/encodeValue()
> > > 
> > > In this function after the 4th line:
> > > public function objectToXML(obj:Object):XML 
> > > {
> > > var qName:QName = new QName("root");
> > > var xmlDocument:XMLDocument = new XMLDocument();
> > > var simpleXMLEncoder:SimpleXMLEncoder = new SimpleXMLEncoder(xmlDocument);
> > > var xmlNode:XMLNode = simpleXMLEncoder.encodeValue(obj, qName,
> > xmlDocument);
> > > var xml:XML = new XML(xmlDocument.toString());
> > > return xml;
> > > }
> > > 
> > > Interesting that it works once, but second call to this function generates
> > > the error.
> > > 
> > > Thanks for help.
> > >
> >
>


Reply via email to