RE: [flexcoders] e4x help
Ahhh. YES! That fixed it. Thanks! Michael J. Regert Please consider the environment before printing this email. Confidentiality Notice | This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, immediately contact the sender by reply e-mail and destroy all copies of the original message. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Haykel BEN JEMIA Sent: Thursday, September 22, 2011 10:48 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] e4x help because the elements are then defined in the namespace "http://schemas.dell.com/wbem/biosattributeregistry/1";. To access them through e4x you have to create a corresponding namespace object, e.g.: private namespace biosattributeregistry = "http://schemas.dell.com/wbem/biosattributeregistry/1";; use namespace biosattributeregistry; Haykel Ben Jemia Allmas Web & RIA Development http://www.allmas-tn.com On Thu, Sep 22, 2011 at 4:32 PM, mailto:michael_reg...@dell.com>> wrote: I guess I should have copied the entire XML. http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://schemas.dell.com/wbem/biosattributeregistry/1 file:///C:/work/12G/Attribute%20Registry/DCIM_AttributeRegistry.xsd" xmlns="http://schemas.dell.com/wbem/biosattributeregistry/1";> Turns out if I just remove the last namespace, xmlns="http://schemas.dell.com/wbem/biosattributeregistry/1"; Then it works correctly. Any idea why this would cause it to not be able to find the children? Michael J. Regert Please consider the environment before printing this email. Confidentiality Notice | This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, immediately contact the sender by reply e-mail and destroy all copies of the original message. From: flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com>] On Behalf Of Brendan Meutzner Sent: Thursday, September 22, 2011 10:20 AM To: flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com> Subject: Re: [flexcoders] e4x help You shouldn't do a check on the length() for xmlRoot... that represents the REGISTRY level... otherwise your code looks fine. On Thu, Sep 22, 2011 at 4:54 PM, mailto:michael_reg...@dell.com>> wrote: I must be missing something simple here. I’m reading in XML that looks like this: Attr_1 Attr_2 Attr_3 I’m trying to get all nodes using the .. operator, but it always returns 0, even though xmlRoot looks fine. protected function xmlService_resultHandler(event:ResultEvent):void { if (event != null && event.result != null && event.result is XML) { var xmlRoot:XML = event.result as XML; if (xmlRoot && xmlRoot.length() > 0) { var lst:XMLList = xmlRoot..Attribute; trace("lst length = " + lst.length()); } } } Michael
Re: [flexcoders] e4x help
because the elements are then defined in the namespace " http://schemas.dell.com/wbem/biosattributeregistry/1";. To access them through e4x you have to create a corresponding namespace object, e.g.: private namespace biosattributeregistry = " http://schemas.dell.com/wbem/biosattributeregistry/1";; use namespace biosattributeregistry; Haykel Ben Jemia Allmas Web & RIA Development http://www.allmas-tn.com On Thu, Sep 22, 2011 at 4:32 PM, wrote: > ** > > > I guess I should have copied the entire XML. > > ** ** > > http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://schemas.dell.com/wbem/biosattributeregistry/1file:///C:/work/12G/Attribute%20Registry/DCIM_AttributeRegistry.xsd"; > *xmlns*="http://schemas.dell.com/wbem/biosattributeregistry/1";> > > ** ** > > Turns out if I just remove the last namespace, *xmlns*=" > http://schemas.dell.com/wbem/biosattributeregistry/1" > > ** ** > > Then it works correctly. > > ** ** > > Any idea why this would cause it to not be able to find the children? > > ** ** > > *Michael J. Regert* > > ** ** > > Please consider the environment before printing this email. > > ** ** > > Confidentiality Notice | This e-mail message, including any attachments, is > for the sole use of the intended recipient(s) and may contain confidential > or proprietary information. Any unauthorized review, use, disclosure or > distribution is prohibited. If you are not the intended recipient, > immediately contact the sender by reply e-mail and destroy all copies of the > original message. > > ** ** > > ** ** > > *From:* flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] *On > Behalf Of *Brendan Meutzner > *Sent:* Thursday, September 22, 2011 10:20 AM > *To:* flexcoders@yahoogroups.com > *Subject:* Re: [flexcoders] e4x help > > ** ** > > > > You shouldn't do a check on the length() for xmlRoot... that represents the > REGISTRY level... otherwise your code looks fine. > > ** ** > > ** ** > > On Thu, Sep 22, 2011 at 4:54 PM, wrote: > > > > I must be missing something simple here. I’m reading in XML that looks > like this: > > > > > > > > > > > > > > Attr_1 > > > > > > Attr_2 > > > > > > Attr_3 > > > > > > > > > > I’m trying to get all nodes using the .. operator, but it always > returns 0, even though xmlRoot looks fine. > > > > *protected* *function* xmlService_resultHandler(event:ResultEvent):*void** > *** > > { > > *if* (event != *null* && event.result != *null* && event.result > *is*XML) { > > > *var* xmlRoot:XML = event.result *as* XML; > > *if* (xmlRoot && xmlRoot.length() > 0) { > > *var* lst:XMLList = xmlRoot..Attribute; > > *trace*(*"lst length = "* + lst.length()); > > } > > } > > } > > > > > > *Michael* > > > > ** ** > > > > >
RE: [flexcoders] e4x help
I guess I should have copied the entire XML. http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://schemas.dell.com/wbem/biosattributeregistry/1 file:///C:/work/12G/Attribute%20Registry/DCIM_AttributeRegistry.xsd" xmlns="http://schemas.dell.com/wbem/biosattributeregistry/1";> Turns out if I just remove the last namespace, xmlns="http://schemas.dell.com/wbem/biosattributeregistry/1"; Then it works correctly. Any idea why this would cause it to not be able to find the children? Michael J. Regert Please consider the environment before printing this email. Confidentiality Notice | This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, immediately contact the sender by reply e-mail and destroy all copies of the original message. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Brendan Meutzner Sent: Thursday, September 22, 2011 10:20 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] e4x help You shouldn't do a check on the length() for xmlRoot... that represents the REGISTRY level... otherwise your code looks fine. On Thu, Sep 22, 2011 at 4:54 PM, mailto:michael_reg...@dell.com>> wrote: I must be missing something simple here. I’m reading in XML that looks like this: Attr_1 Attr_2 Attr_3 I’m trying to get all nodes using the .. operator, but it always returns 0, even though xmlRoot looks fine. protected function xmlService_resultHandler(event:ResultEvent):void { if (event != null && event.result != null && event.result is XML) { var xmlRoot:XML = event.result as XML; if (xmlRoot && xmlRoot.length() > 0) { var lst:XMLList = xmlRoot..Attribute; trace("lst length = " + lst.length()); } } } Michael
Re: [flexcoders] e4x help
working for me. here is the code I used for testing: package { import flash.display.Sprite; public class Test extends Sprite { private var xmlRoot:XML = Attr_1 Attr_2 Attr_3 ; public function Test() { if (xmlRoot && xmlRoot.length() > 0) { var lst:XMLList = xmlRoot..Attribute; trace("lst length = " + lst.length()); } } } } it outputs 'lst length = 3' as expected. Haykel Ben Jemia Allmas Web & RIA Development http://www.allmas-tn.com On Thu, Sep 22, 2011 at 3:54 PM, wrote: > ** > > > I must be missing something simple here. I’m reading in XML that looks > like this: > > ** ** > > > > > > > > > > > > Attr_1 > > > > > > Attr_2 > > > > > > Attr_3 > > > > > > > > ** ** > > I’m trying to get all nodes using the .. operator, but it always > returns 0, even though xmlRoot looks fine. > > ** ** > > *protected* *function* xmlService_resultHandler(event:ResultEvent):*void** > *** > > { > > *if* (event != *null* && event.result != *null* && event.result > *is*XML) { > > > *var* xmlRoot:XML = event.result *as* XML; > > *if* (xmlRoot && xmlRoot.length() > 0) { > > *var* lst:XMLList = xmlRoot..Attribute; > > *trace*(*"lst length = "* + lst.length()); > > } > > } > > } > > ** ** > > ** ** > > *Michael* > > ** ** > > >
Re: [flexcoders] e4x help
You shouldn't do a check on the length() for xmlRoot... that represents the REGISTRY level... otherwise your code looks fine. On Thu, Sep 22, 2011 at 4:54 PM, wrote: > ** > > > I must be missing something simple here. I’m reading in XML that looks > like this: > > ** ** > > > > > > > > > > > > Attr_1 > > > > > > Attr_2 > > > > > > Attr_3 > > > > > > > > ** ** > > I’m trying to get all nodes using the .. operator, but it always > returns 0, even though xmlRoot looks fine. > > ** ** > > *protected* *function* xmlService_resultHandler(event:ResultEvent):*void** > *** > > { > > *if* (event != *null* && event.result != *null* && event.result > *is*XML) { > > > *var* xmlRoot:XML = event.result *as* XML; > > *if* (xmlRoot && xmlRoot.length() > 0) { > > *var* lst:XMLList = xmlRoot..Attribute; > > *trace*(*"lst length = "* + lst.length()); > > } > > } > > } > > ** ** > > ** ** > > *Michael* > > ** ** > > >
Re: [flexcoders] E4X help?
node.da...@key == "type" ? If U want both values you should iterate ... Claudiu From: flexaustin To: flexcoders@yahoogroups.com Sent: Monday, February 16, 2009 1:58:46 AM Subject: [flexcoders] E4X help? Is it possible to get the value of "type" from this XML? Ed< /data> M< /data> − Christia an M< /data> So in this example end up with M for both?
Re: [flexcoders] E4X help?
Not sure exactly what you mean. Have you tried this: var typeNodes : XMLList = node.data.(attribute("key")=="type"); -Josh On Mon, Feb 16, 2009 at 9:58 AM, flexaustin wrote: > Is it possible to get the value of "type" from this XML? > > > Ed > M > > − > > Christiaan > M > > > So in this example end up with M for both? > > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." Josh 'G-Funk' McDonald - j...@joshmcdonald.info - http://twitter.com/sophistifunk - http://flex.joshmcdonald.info/