acrymble
06-12-2008, 03:03 PM
I am trying to split the following HTML content into an array that will look like this:
0 => Gladman (family)
1 => Gladman, George, 1765-1821
2 => Gladman, George, 1800-1863
3 => Gladman, Henry, 1834-1912
<TABLE CLASS="results">
<TR><TH>Creator:</TH><TD CLASS="data">Gladman (family)<br>Gladman, George, 1765-1821<br>Gladman, George, 1800-1863<br>Gladman, Henry, 1834-1912</TD></TR>
I have tried:
xPath1 = doc.evaluate(//table[@class="results"]/tbody/tr/td', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.split(/\n/));
This returns the correct content, but does not split it at all. The result is an array with 1 item.
I also tried the regExp (/\r/) to no avail.
I think that the xPath is not recognizing the <br> tags. Is there a way to split this?
Thanks
Adam
0 => Gladman (family)
1 => Gladman, George, 1765-1821
2 => Gladman, George, 1800-1863
3 => Gladman, Henry, 1834-1912
<TABLE CLASS="results">
<TR><TH>Creator:</TH><TD CLASS="data">Gladman (family)<br>Gladman, George, 1765-1821<br>Gladman, George, 1800-1863<br>Gladman, Henry, 1834-1912</TD></TR>
I have tried:
xPath1 = doc.evaluate(//table[@class="results"]/tbody/tr/td', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.split(/\n/));
This returns the correct content, but does not split it at all. The result is an array with 1 item.
I also tried the regExp (/\r/) to no avail.
I think that the xPath is not recognizing the <br> tags. Is there a way to split this?
Thanks
Adam