RE: [Flashcoders] Error check for parseXML()
Good point. One optional tweak: var xml:XML = new XML(); xml.ignoreWhite = true; xml.parseXML(someTextVar); xml.onLoad = function(success:Boolean):Void { if (this.status == 0) { trace(Success!); } else { trace(Error in XML! Code: + this.status); } } The scope should probably be this instead of xml in this case. ― Mike Keesey -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Ray Chuan Sent: Saturday, October 07, 2006 2:21 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] Error check for parseXML() Hi, you should put the conditional in a callback, because when execution reaches the conditional xml parsing might not have finished parsing. var xml:XML = new XML(); xml.ignoreWhite = true; xml.parseXML(someTextVar); xml.onLoad = function(success:Boolean):Void { if (xml.status == 0) { trace(Success!); } else { trace(Error in XML! Code: + xml.status); } } Note that the success argument can be ignored if you're using functions like parseXML(), because it's got to do with the success of loading a document using XML.load() or XML.sendAndLoad(). On 10/7/06, Mike Keesey [EMAIL PROTECTED] wrote: Use the XML.status field. var xml:XML = new XML(); xml.ignoreWhite = true; xml.parseXML(someTextVar); if (xml.status == 0) { trace(Success!); } else { trace(Error in XML! Code: + xml.status); } ― Mike Keesey -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael Sent: Friday, October 06, 2006 6:50 AM To: Flashcoders mailing list Subject: [Flashcoders] Error check for parseXML() Hi list... According to the help docs, public parseXML(value:String) : Void doesn't return an integer or anything to indicate successful parsing of the xml. How can I be certain that I've passed in some error free xml and it was able to parse? Thanks, - Michael M. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Cheers, Ray Chuan ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Error check for parseXML()
Hi, you should put the conditional in a callback, because when execution reaches the conditional xml parsing might not have finished parsing. var xml:XML = new XML(); xml.ignoreWhite = true; xml.parseXML(someTextVar); xml.onLoad = function(success:Boolean):Void { if (xml.status == 0) { trace(Success!); } else { trace(Error in XML! Code: + xml.status); } } Note that the success argument can be ignored if you're using functions like parseXML(), because it's got to do with the success of loading a document using XML.load() or XML.sendAndLoad(). On 10/7/06, Mike Keesey [EMAIL PROTECTED] wrote: Use the XML.status field. var xml:XML = new XML(); xml.ignoreWhite = true; xml.parseXML(someTextVar); if (xml.status == 0) { trace(Success!); } else { trace(Error in XML! Code: + xml.status); } ― Mike Keesey -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael Sent: Friday, October 06, 2006 6:50 AM To: Flashcoders mailing list Subject: [Flashcoders] Error check for parseXML() Hi list... According to the help docs, public parseXML(value:String) : Void doesn't return an integer or anything to indicate successful parsing of the xml. How can I be certain that I've passed in some error free xml and it was able to parse? Thanks, - Michael M. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Cheers, Ray Chuan ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Error check for parseXML()
Mendelsohn, Michael escreveu: Hi list... According to the help docs, public parseXML(value:String) : Void I think that when did you use :Void , the function doesn´t return any value ... try it public parseXML(value:String):String { } -- Gustavo Teider ( gugateider ) www.gugateider.com Curitiba - PR doesn't return an integer or anything to indicate successful parsing of the xml. How can I be certain that I've passed in some error free xml and it was able to parse? Thanks, - Michael M. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Error check for parseXML()
Mendelsohn, Michael schrieb: Hi list... According to the help docs, public parseXML(value:String) : Void doesn't return an integer or anything to indicate successful parsing of the xml. How can I be certain that I've passed in some error free xml and it was able to parse? the XML-Object itself has such a thing. kinda ugly but hey :-) micha ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Error check for parseXML()
How about xmlobj.status ? If the xml is successfully loaded and parsed, you get 0 on the output panel. Otherwise, you get a negative number (-2 , ... -10). -2: A CDATA is not closed -3: The initial XML declaration is malformed -4: The DOCTYPE declaration is malformed -5: A comment has no closed syntax -6: An element node is malformed -7: Out of memory -8: An attribute is malformed -9: A start tag has no matching close tag -10: An end tag has no matching start tag hth, -- Anggie Bratadinata www.masputih.com I N D O N E S I A Mendelsohn, Michael wrote: Hi list... According to the help docs, public parseXML(value:String) : Void doesn't return an integer or anything to indicate successful parsing of the xml. How can I be certain that I've passed in some error free xml and it was able to parse? Thanks, - Michael M. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] Error check for parseXML()
Use the XML.status field. var xml:XML = new XML(); xml.ignoreWhite = true; xml.parseXML(someTextVar); if (xml.status == 0) { trace(Success!); } else { trace(Error in XML! Code: + xml.status); } ― Mike Keesey -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael Sent: Friday, October 06, 2006 6:50 AM To: Flashcoders mailing list Subject: [Flashcoders] Error check for parseXML() Hi list... According to the help docs, public parseXML(value:String) : Void doesn't return an integer or anything to indicate successful parsing of the xml. How can I be certain that I've passed in some error free xml and it was able to parse? Thanks, - Michael M. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com