Also, to search on a substring, you could do the following:
 
/card[contains(name, "Aaron")]
----- Original Message -----
Sent: Friday, June 14, 2002 2:07 AM
Subject: Re: [Jaxen] trying to understand element string value

Watch the whitesapce. I think you mean /card[name=" Hank Aaron "]
 
you could use the normalize-space() function to trim whitespace inside the element text
 
/card[normalize-space(name)="Hank Aaron"]

James
----- Original Message -----
Sent: Thursday, June 13, 2002 3:44 PM
Subject: [Jaxen] trying to understand element string value

I can build a node set and select nodes with the following syntax and included xml file, but how do I select based on an element's string value? I am trying to learn the w3c recommendations but it is not easily digested. I am using Jaxen 1.0. Also, there is a preceding / in front of the following syntax but my email app enjoys doing something I don't want it to do ..
 
/card (builds a node set of 2)
/card[year=1973] (builds a nodeset of 1)
/card[name="Hank Aaron"] (builds a nodeset of 0, why, what is the correct syntax?, is it possible to search based on a substring of this, for example, "Aaron"?)
<?xml version="1.0"?>
<cards>
    <card>
        <name> Hank Aaron </name>
        <year> 1973 </position>
    </card>
    <card>
        <name> Brooks Robinson </name>
        <year> 1980 </position>
    </card>
</cards>
 

---
 
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.370 / Virus Database: 205 - Release Date: 7/06/2002

Reply via email to