Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Query xml with text()

Reply
Thread Tools

Query xml with text()

 
 
Ciccio Pasticcio
Guest
Posts: n/a
 
      07-04-2008
Hi,

i've some problems when i use text()

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


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-04-2008
Ciccio Pasticcio wrote:
> Hi,
>
> i've some problems when i use text()
>
> on page
> http://orario.trenitalia.com/b2c/Tim...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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
magic/xml vs XML/Query Tomasz Wegrzanowski Ruby 0 08-10-2006 11:13 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Query Against XML File (not just XML data) Jeremy S. ASP .Net 1 09-07-2005 10:39 PM
simple(?) xml/xsl problem with xml from sql query dSchwartz XML 1 03-06-2004 02:06 AM
Update XML files using XML query language? Jim Cheng XML 2 07-28-2003 09:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57