Diego,

Here is a starting point. There are probably bugs, it is bloated, 
and it is not completely tested, however, it is a starting point.

A final version of this, along with some actual example code, error 
handling and other dynamic tools will eventually be available in a 
devnet article. 

Used as follows:

import net.digitalprimates.utils.E4XParser;
var parser:E4XParser;
parser = new E4XParser();

var returnXML:XMLList;
//Use parser.evaluate( data:XML, expression:String );
returnXML = parser.evaluate( myXML, '..item.(@id==2)..price' );

If you find a bug, let me know off list. 

BTW, thanks on this and future releases also go to Alex Harui who 
started this pet project before I. (Although none of the blame for 
the bad code that currently permeates it)

http://www.digitalprimates.net/src/e4x.zip

--Mike


--- In flexcoders@yahoogroups.com, "Diego Guebel" 
<[EMAIL PROTECTED]> wrote:
>
> Hi all,
> I'm wondering if there is any method to "apply" an e4x expression 
passed  
> as a string to an xml.
> For example I have this variable:
> private var sourceXML:XML = <order>
>          <book ISBN="0942407296">
>              <title>Baking Extravagant Pastries with 
Kumquats</title>
>              <author>
>                  <lastName>Contino</lastName>
>                  <firstName>Chuck</firstName>
>              </author>
>              <pageCount>238</pageCount>
>          </book>
>          <book ISBN="0865436401">
>              <title>Emu Care and Breeding</title>
>              <editor>
>                  <lastName>Case</lastName>
>                  <firstName>Justin</firstName>
>              </editor>
>              <pageCount>115</pageCount>
>          </book>
>      </order>
> 
> and a method like this:
> 
> private  function testExpression(s:String):void
> {
>       // somehow, I want to apply that string as e4x expression to 
the xml
>       result_txt.text = sourceXML.apply(s);
> }
> 
> Any clue?
> Thanks in advance.
> Diego.
>





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

Reply via email to