Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Query xml with text()

Question posted by: Ciccio Pasticcio (Guest) on July 4th, 2008 01:25 PM
Hi,

i've some problems when i use text()

on page
http://orario.trenitalia.com/b2c/Ti...=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


Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
July 4th, 2008
01:25 PM
#2

Re: Query xml with text()
Ciccio Pasticcio wrote:
Quote:
Hi,
>
i've some problems when i use text()
>
on page
http://orario.trenitalia.com/b2c/Ti...=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."]


--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Not the answer you were looking for? Post your question . . .
189,075 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors