try using "or" for the xpath query
Localidades/Localidad[idLocalidad=83 or idComunidadAutonoma=15]
sample:
import mx.xpath.XPathAPI;
z = new XML('<Localidades><Localidad><idLocalidad
type="number">83</idLocalidad><idProvincia
type="number">34</idProvincia><idComunidadAutonoma
type="number">15</idComunidadAutonoma></Localidad><Localidad><idLocalidad
type="number">106</idLocalidad><idProvincia
type="number">35</idProvincia><idComunidadAutonoma
type="number">15</idComunidadAutonoma></Localidad></Localidades>');
var thePath_str:String = "Localidades/Localidad[idLocalidad=83 or
idComunidadAutonoma=15]";
var result_array:Array = XPathAPI.selectNodeList(z.firstChild,thePath_str);
for (var i:Number = 0; i < result_array.length; i++) {
trace(result_array[i].firstChild.toString());
}
i'm just tracing out the firstChild but the query will contain the whole node.
regards.
kada.
On 3/1/06, julian atienza <[EMAIL PROTECTED]> wrote:
> I have this XML
> <Localidades>
> <Localidad>
> <idLocalidad type="number">83</idLocalidad>
> <idProvincia type="number">34</idProvincia>
> <idComunidadAutonoma type="number">15</idComunidadAutonoma>
> </Localidad>
> <Localidad>
> <idLocalidad type="number">106</idLocalidad>
> <idProvincia type="number">35</idProvincia>
> <idComunidadAutonoma type="number">15</idComunidadAutonoma>
> </Localidad>
> </Localidades>
>
>
> And want to generate a XPATH to select all nodes that f.e, are from "
> idLocalidad=83 " OR with " idComunidadAutonoma = 15"
>
> that query that i will made with a SELECT in SQL
>
> SELECT * FROM LOCALIDADES
> WHERE idLocalidad = 83 OR idComunidadAutonoma = 15
>
> ¿¿is it possible??
>
> i'm trying with a lot of things like
>
> "Localidades/Localidad[idLocalidad = 83] |
> Localidades/Localidad[idComunidadAutonoma = 15]";
>
> but it returns 3 elements (1 for idLocalidad = 83, and two for
> idComunidadAutonoma, when i really would like to receive 2...
>
> thanks in advance
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com