[flexcoders] e4x help

2011-09-22 Thread michael_regert
I must be missing something simple here.  I'm reading in XML that looks like 
this:

?xml version=1.0 encoding=UTF-8?
REGISTRY
  REGISTRY_DECLARATION/
  REGISTRY_ENTRIES
Attribute
  AttributeNameAttr_1/AttributeName
/Attribute
Attribute
  AttributeNameAttr_2/AttributeName
/Attribute
Attribute
  AttributeNameAttr_3/AttributeName
/Attribute
  /REGISTRY_ENTRIES
/REGISTRY

I'm trying to get all Atribute 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

2011-09-22 Thread Brendan Meutzner
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, michael_reg...@dell.com wrote:

 **


 I must be missing something simple here.  I’m reading in XML that looks
 like this:

 ** **

 ?*xml* version=1.0 encoding=UTF-8?

 REGISTRY

   REGISTRY_DECLARATION/

   REGISTRY_ENTRIES

 Attribute

   AttributeNameAttr_1/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_2/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_3/AttributeName

 /Attribute

   /REGISTRY_ENTRIES

 /REGISTRY

 ** **

 I’m trying to get all Atribute 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

2011-09-22 Thread Haykel BEN JEMIA
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 =
REGISTRY
REGISTRY_DECLARATION/
REGISTRY_ENTRIES
Attribute
AttributeNameAttr_1/AttributeName
/Attribute
Attribute
AttributeNameAttr_2/AttributeName
/Attribute
Attribute
AttributeNameAttr_3/AttributeName
/Attribute
/REGISTRY_ENTRIES
/REGISTRY;

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, michael_reg...@dell.com wrote:

 **


 I must be missing something simple here.  I’m reading in XML that looks
 like this:

 ** **

 ?*xml* version=1.0 encoding=UTF-8?

 REGISTRY

   REGISTRY_DECLARATION/

   REGISTRY_ENTRIES

 Attribute

   AttributeNameAttr_1/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_2/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_3/AttributeName

 /Attribute

   /REGISTRY_ENTRIES

 /REGISTRY

 ** **

 I’m trying to get all Atribute 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

2011-09-22 Thread michael_regert
I guess I should have copied the entire XML.

REGISTRY xmlns:xsi=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, 
michael_reg...@dell.commailto:michael_reg...@dell.com wrote:

I must be missing something simple here.  I’m reading in XML that looks like 
this:

?xml version=1.0 encoding=UTF-8?
REGISTRY
  REGISTRY_DECLARATION/
  REGISTRY_ENTRIES
Attribute
  AttributeNameAttr_1/AttributeName
/Attribute
Attribute
  AttributeNameAttr_2/AttributeName
/Attribute
Attribute
  AttributeNameAttr_3/AttributeName
/Attribute
  /REGISTRY_ENTRIES
/REGISTRY

I’m trying to get all Atribute 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

2011-09-22 Thread Haykel BEN JEMIA
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, michael_reg...@dell.com wrote:

 **


 I guess I should have copied the entire XML.

 ** **

 REGISTRY xmlns:xsi=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, michael_reg...@dell.com wrote:

   

 I must be missing something simple here.  I’m reading in XML that looks
 like this:

  

 ?*xml* version=1.0 encoding=UTF-8?

 REGISTRY

   REGISTRY_DECLARATION/

   REGISTRY_ENTRIES

 Attribute

   AttributeNameAttr_1/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_2/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_3/AttributeName

 /Attribute

   /REGISTRY_ENTRIES

 /REGISTRY

  

 I’m trying to get all Atribute 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

2011-09-22 Thread michael_regert
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, 
michael_reg...@dell.commailto:michael_reg...@dell.com wrote:

I guess I should have copied the entire XML.

REGISTRY xmlns:xsi=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.commailto:flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com] On 
Behalf Of Brendan Meutzner
Sent: Thursday, September 22, 2011 10:20 AM
To: flexcoders@yahoogroups.commailto: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, 
michael_reg...@dell.commailto:michael_reg...@dell.com wrote:

I must be missing something simple here.  I’m reading in XML that looks like 
this:

?xml version=1.0 encoding=UTF-8?
REGISTRY
  REGISTRY_DECLARATION/
  REGISTRY_ENTRIES
Attribute
  AttributeNameAttr_1/AttributeName
/Attribute
Attribute
  AttributeNameAttr_2/AttributeName
/Attribute
Attribute
  AttributeNameAttr_3/AttributeName
/Attribute
  /REGISTRY_ENTRIES
/REGISTRY

I’m trying to get all Atribute 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






[flexcoders] E4X help?

2009-02-15 Thread flexaustin
Is it possible to get the value of type from this XML?

node id=2
data key=nameEd/data
data key=typeM/data
/node
#8722;
node id=3
data key=nameChristiaan/data
data key=typeM/data
/node

So in this example end up with M for both?



Re: [flexcoders] E4X help?

2009-02-15 Thread Josh McDonald
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 flexaus...@yahoo.com wrote:

   Is it possible to get the value of type from this XML?

 node id=2
 data key=nameEd/data
 data key=typeM/data
 /node
 #8722;
 node id=3
 data key=nameChristiaan/data
 data key=typeM/data
 /node

 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/


Re: [flexcoders] E4X help?

2009-02-15 Thread claudiu ursica
node.da...@key == type ? If U want both values you should iterate ...
Claudiu





From: flexaustin flexaus...@yahoo.com
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?

node id=2
data key=nameEd /data
data key=typeM /data
/node
#8722;
node id=3
data key=nameChristia an/data
data key=typeM /data
/node

So in this example end up with M for both?


   


  

[flexcoders] E4X Help

2006-10-20 Thread Tan
I try writing two comboboxes to facilitate selection of the following XML,

data
state label=Texas data=Texas
county label=Jones data=123 /
county label=Taylor data=124 /
...
/state
state label=Virginia data=Virginia
county label=Alexandria data=223 /
county label=Arlington data=224 /
...
/state
...


The first combo box is named _combo1 that is populated by state data, and I
want to get an XML or XMLList of the counties using AS3, I wonder whether I
can write it in E4X syntax that looks somewhat like

var selected:String = _combo1.selectedItem.toString();
var counties:XMLList = _myXml.state.(@label = {selected}).county;

I get a compiler error for the last line, and I have searched through some
E4X samples, didn't seem to find any help.  Any advice?

Thanks!

- Tangent

P.S.  Or should I use XmlViewCollection, Descriptor or things like that?



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

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

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