Query xml with text()

  • Thread starter Ciccio Pasticcio
  • Start date
C

Ciccio Pasticcio

Hi,

i've some problems when i use text()

on page
http://orario.trenitalia.com/b2c/Ti...timsm=09&x=20&y=7&lang=it&nreq=5&channel=tcom
if i do //B/text() it returns to me "Stazione di partenza: nessuna stazione
corrisponde ai criteri di ricerca impostati."
but if i try to do //B[text()="Stazione di partenza: nessuna stazione
corrisponde ai criteri di ricerca impostati."] it doesn't found any element.

i'm using the library javaXpCom to do the query on the webpage.

What's wrong on this query?

Thanks and sorry for my bad english
 
M

Martin Honnen

Ciccio said:
Hi,

i've some problems when i use text()

on page
http://orario.trenitalia.com/b2c/Ti...timsm=09&x=20&y=7&lang=it&nreq=5&channel=tcom
if i do //B/text() it returns to me "Stazione di partenza: nessuna stazione
corrisponde ai criteri di ricerca impostati."
but if i try to do //B[text()="Stazione di partenza: nessuna stazione
corrisponde ai criteri di ricerca impostati."] it doesn't found any element.

Maybe it is an issue with leading and/or trailing white space. The
source of that page contains

<b>Stazione di partenza: nessuna stazione corrisponde ai criteri di
ricerca impostati.
</b>
so there is white space at the end of that sentence.

Try
//b[contains(., "Stazione di partenza: nessuna stazione
corrisponde ai criteri di ricerca impostati.")]
or
//b[normalize-space() = ""Stazione di partenza: nessuna stazione
corrisponde ai criteri di ricerca impostati."]
or
//b[normalize-space(text()) = ""Stazione di partenza: nessuna stazione
corrisponde ai criteri di ricerca impostati."]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top