Is it possible to search xml embedded in flex?

Is it possible to have a flex document do a query?

I have a simple project for work, where the items are loaded in a product tile window and I want it to be able to search.

The file needs to live on an network drive, and be safe contained no php etc.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="absolute" xmlns:ns1="*">
<mx:XML id="product">
	<product><anitem>	<itemID>	1	</itemID>	<itemName>	Light (1) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:26	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	2	</itemID>	<itemName>	Light (2) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Male  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:27	</crDate>	<isactive>	1	</isactive>	<imgURL>	</imgURL>	</anitem>
	<anitem>	<itemID>	3	</itemID>	<itemName>	Light Brown (3) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:28	</crDate>	<isactive>	1	</isactive>	<imgURL></imgURL>	</anitem>
	<anitem>	<itemID>	4	</itemID>	<itemName>	Dark Brown (4) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:28	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	5	</itemID>	<itemName>	Tanned (5) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:28	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	6	</itemID>	<itemName>	Light Brown (6) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Male  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:28	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	7	</itemID>	<itemName>	Dark Brown (7) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Male  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:28	</crDate>	<isactive>	1	</isactive>		<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	8	</itemID>	<itemName>	Tanned (8) 	</itemName>	<type>	Skin (1000)  	</type>	<gender>	Male  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:29	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	100	</itemID>	<itemName>	Green Eyes (100) 	</itemName>	<type>	Eyes (1001)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:29	</crDate>	<isactive>	1	</isactive>		<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	101	</itemID>	<itemName>	Blue Eyes (101) 	</itemName>	<type>	Eyes (1001)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:29	</crDate>	<isactive>	2	</isactive>		<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	102	</itemID>	<itemName>	Brown Eyes (102) 	</itemName>	<type>	Eyes (1001)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:29	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	103	</itemID>	<itemName>	Aqua Eyes (103) 	</itemName>	<type>	Eyes (1001)  	</type>	<gender>	Female  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:30	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	104	</itemID>	<itemName>	Blue Eyes (104) 	</itemName>	<type>	Eyes (1001)  	</type>	<gender>	Male  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:30	</crDate>	<isactive>	1	</isactive>		<imgURL>		</imgURL>	</anitem>
	<anitem>	<itemID>	105	</itemID>	<itemName>	Green Eyes (105) 	</itemName>	<type>	Eyes (1001)  	</type>	<gender>	Male  	</gender>	<price>	0	</price>	<crDate>	5/3/2008 20:30	</crDate>	<isactive>	1	</isactive>	<imgURL>		</imgURL>	</anitem>
	<mx:Panel x="379" y="10" width="635" height="445" layout="absolute">
		<mx:TileList itemRenderer="ProductTile" dataProvider="{product.anitem}" x="19" y="10" width="586" height="390" rowHeight="136" columnWidth="180">
	<mx:Panel x="29" y="189" width="342" height="266" layout="absolute">
		<mx:CheckBox x="196" y="194" label="YoCash Items"/>
		<mx:Text x="10" y="20" text="Name&#x9;" width="63"/>
		<mx:TextInput x="81" y="18"/>
		<mx:Text x="10" y="55" text="Max Price" width="63"/>
		<mx:TextInput x="81" y="53" width="81"/>
		<mx:Text x="10" y="85" text="Min Price" width="63"/>
		<mx:TextInput x="81" y="83" width="81"/>
		<mx:ComboBox x="10" y="161" dataProvider="{categories.category}" width="178" id = "cat"  click="traceCat()"></mx:ComboBox>
<mx:XML id = "categories">
<category>	Swimwear (2020)  	</category>
<category>	Rugs (2008)  	</category>
<category>	Toys and Games (2035)  	</category>
<category>	Homes (2029)  	</category>
<category>	Kitchen Appliances (2022)  	</category>
<category>	Pants (100)  	</category>
<category>	Bait (2049)  	</category>
	private var txt:String;
	public function traceCat():void
		txt =cat.selectedItem.text;
<?xml version="1.0" encoding="utf-8"?>
<mx:Tile xmlns:mx="" width="180" height="136">
	<mx:Canvas width="180" height="136">
		<mx:Image x="35.5" y="24" width="60" height="60" source="{data.imgURL}"/>
		<mx:Label x="10" y="9" width="155" text ="{data.itemName}"/>
		<mx:Label x="35.5" y="97" text = "{data.price}"/>

Open in new window

Who is Participating?
lexxwernConnect With a Mentor Commented:
Hmm .. XML object can be easily converted into an XMLList .. and .. there are nifty ways to search & filter .. see this:
Yes, you can use XMLLists and E4X. See this:
cflores89Author Commented:
So I would have it do my query, pass the results into an XMLLlist and then pass it into the tiles?
cflores89Author Commented:
Ok, I've been fiddling around with this and can't seem to get it to work.

I had dataprovider = "{search.anitem}" for the tile and it was blank

I then had
      var filterBy:String = "type";
       var filterValue:String = "Eyes";
       var items:XMLList;
  public function searchQuery():void
       items= product.anItem.(attribute(filterBy) == filterValue);


so not sure to set it up correctly
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.