Your example works fine for me:
var foo:XML = <labels>
<label>
<category_key>0</category_key>
<keyword_type_key>2</keyword_type_key>
<keyword_type_id>Taa Daaa</keyword_type_id>
<keyword_value_key>8</keyword_value_key>
<keyword_value_id>Reason 2</keyword_value_id>
</label>
<label>
<category_key>0</category_key>
<keyword_type_key>3</keyword_type_key>
<keyword_type_id>Reason B</keyword_type_id>
<keyword_value_key>6</keyword_value_key>
<keyword_value_id>Reason B Value</keyword_value_id>
</label>
<label>
<category_key>1</category_key>
<keyword_type_key>23</keyword_type_key>
<keyword_type_id>Reason A</keyword_type_id>
<keyword_value_key>33</keyword_value_key>
<keyword_value_id>Reason A Value</keyword_value_id>
</label>
</labels>;
var bar:XMLList = foo.label.(category_key != 0);
var baz:XMLList = foo.label.(category_key == 0);
trace("bar", bar.toXMLString());
trace("baz", baz.toXMLString());
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Manu Dhanda
Sent: Thursday, September 13, 2007 7:54 PM
To: [email protected]
Subject: [flexcoders] RE: creating two child lists from one XMLList
based on one element value
yes, I have tried the query on base XML as well like below. But it is
not
working.
categoryXMLList = myXML.labels.label.(category_key != 0);
keywordXMLList = myXML.labels.label.(category_key == 0);
It always give me this error: "TypeError: Error #1088: The markup in the
document following the root
element must be well-formed."
Although I tried to alert popup the values of
[categoryXMLList/keywordXMLList] length, which it is returning correct.
Now, where I am making mistake, I couldn't find that.
Any help will be great.
Thanks.
Alex Harui wrote:
>
> Are you sure the queries are returning the error, or do you have an
> error in the xml itself?
>
> Did you try the query on the base XML and not the XMLList?
>
>
>
> ________________________________
>
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Manu Dhanda
> Sent: Thursday, September 13, 2007 1:25 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] creating two child lists from one XMLList based
on
> one element value
>
>
>
>
> Hii
>
> I have one XMLList named "keywordActionXMLList" based on the following
> XML:
>
> <labels>
> <label>
> <category_key>0</category_key>
> <keyword_type_key>2</keyword_type_key>
> <keyword_type_id>Taa Daaa</keyword_type_id>
> <keyword_value_key>8</keyword_value_key>
> <keyword_value_id>Reason 2</keyword_value_id>
> </label>
> <label>
> <category_key>0</category_key>
> <keyword_type_key>3</keyword_type_key>
> <keyword_type_id>Reason B</keyword_type_id>
> <keyword_value_key>6</keyword_value_key>
> <keyword_value_id>Reason B Value</keyword_value_id>
> </label>
> <label>
> <category_key>1</category_key>
> <keyword_type_key>23</keyword_type_key>
> <keyword_type_id>Reason A</keyword_type_id>
> <keyword_value_key>33</keyword_value_key>
> <keyword_value_id>Reason A Value</keyword_value_id>
> </label>
> </labels>
>
> Now based on the element <category_key> value, I want to create
separate
> XMLList's from this one.
> One list for "category_key == 0" and another list for "category_key !=
> 0".
>
> I am trying to do something like:
>
> categoryXMLList = keywordActionXMLList.label.(category_key != 0);
> keywordXMLList = keywordActionXMLList.label.(category_key == 0);
>
> But am getting this error.
>
> "TypeError: Error #1088: The markup in the document following the root
> element must be well-formed."
>
> Can anyone guide me like where am making mistake??
>
> Thanks,
> Manu.
> --
> View this message in context:
>
http://www.nabble.com/creating-two-child-lists-from-one-XMLList-based-on
<http://www.nabble.com/creating-two-child-lists-from-one-XMLList-based-o
n>
> -one-element-value-tf4434296.html#a12650609
>
<http://www.nabble.com/creating-two-child-lists-from-one-XMLList-based-o
<http://www.nabble.com/creating-two-child-lists-from-one-XMLList-based-o
>
> n-one-element-value-tf4434296.html#a12650609>
> Sent from the FlexCoders mailing list archive at Nabble.com.
>
>
>
>
>
--
View this message in context:
http://www.nabble.com/creating-two-child-lists-from-one-XMLList-based-on
-one-element-value-tf4434451.html#a12667611
<http://www.nabble.com/creating-two-child-lists-from-one-XMLList-based-o
n-one-element-value-tf4434451.html#a12667611>
Sent from the FlexCoders mailing list archive at Nabble.com.