Latest Inquiries - Data Extraction Software

Error with text() in xpath

Submitted: 3/7/2016
I'm trying to get only the text inside a html code, but my lack of knowledge has led me to an error.  Here is an example of the HTML code I have:
  Text needed
  <a href></a>

Testing it in the browser this xpath got me what i needed: //td[2]/text()[normalize-space()]

The first problem is when I use only //td[2]/text() is I get this error:
Error parsing xpath: Unable to cast object of type 'System.String' to type 'mshtml.IHTMLElement'.

Furthermore when I try to remove blank space with normalize-space with //td[2]/text()[normalize-space()] then I get an error like this:
Error parsing xpath: Invalid custom method normalize-space

I've selected capture type as text currently, but I tried it with different capture types as well.

Thanks in advance.
Replied: 3/8/2016 2:21:28 AM

The xpath you did is wrong, thought the 'Text needed' content couldn't use xpath to select as usual,

You might try to firstly select <td> with xpath: //TD[2], then setting content transfromation regex scripts to extract the specific content: