Specifiying the XPath exactly (/html[1]/body[1]/center[1]/table[4]/tr[1]/td[1]) works. Should be a good hint for the Xalan team, shouldn't it?
I'd added into XPathTestCase.java in avalon-excalibur/xmlutil:
// 9. Test
expr = "/test:root/test:element2/test:table[1]/test:tr/test:td[4]";
node = processor.selectSingleNode(document1, expr);
assertNotNull("Must select <test:td/> node, but got null", node);
assertEquals("Must select <test:td/> node", Node.ELEMENT_NODE, node.getNodeType());
assertEquals("Must select <test:td/> node", "td", node.getLocalName());
And:
static final String CONTENT1 =
"<?xml version=\"1.0\"?>" +
"<test:root xmlns:test=\"http://localhost/test\">" +
"<test:element1/>" +
"<test:element2>" +
"<test:table>" +
" <test:tr>" +
" <test:td>table1 tr1 td1</test:td>" +
" <test:td>table1 tr1 td2</test:td>" +
" <test:td>table1 tr1 td3</test:td>" +
" </test:tr>" +
" <test:tr>" +
" <test:td>table1 tr2 td1</test:td>" +
" <test:td>table1 tr2 td2</test:td>" +
" <test:td>table1 tr2 td3</test:td>" +
" <test:td>table1 tr2 td4</test:td>" +
" </test:tr>" +
" <test:tr>" +
" <test:td>table1 tr3 td1</test:td>" +
" <test:td>table1 tr3 td2</test:td>" +
" <test:td>table1 tr3 td3</test:td>" +
" </test:tr>" +
"</test:table>" +
"<test:table>" +
" <test:tr>" +
" <test:td>table2 tr1 td1</test:td>" +
" <test:td>table2 tr1 td2</test:td>" +
" <test:td>table2 tr1 td3</test:td>" +
" </test:tr>" +
" <test:tr>" +
" <test:td>table2 tr2 td1</test:td>" +
" <test:td>table2 tr2 td2</test:td>" +
" <test:td>table2 tr2 td3</test:td>" +
" </test:tr>" +
" <test:tr>" +
" <test:td>table2 tr3 td1</test:td>" +
" <test:td>table2 tr3 td2</test:td>" +
" <test:td>table2 tr3 td3</test:td>" +
" </test:tr>" +
"</test:table>" +
"</test:element2>" +
"</test:root>";Still works :-/
Can you reproduce this using excalibur's test case ("ant test" in avalon-excalibur/xmlutil)?
Vadim
Joerg
Joerg Heinicke wrote:
Vadim Gritsenko wrote:
Yahoo screenscrape example was not working for long time now. I had not had a chance to find a reason why. Search sample sitemaps, I had included yahoo screenscrape pipeline somewhere..... Oops, it's gone.
Found it in blocks/html/samples/sitemap.xmap. Does not work:
That happens only if used with the xpath parameter. I debugged a bit as far as possible (is it possible to tell Eclipse not to use the Xalan sources out of JDK's src.zip, but from the path I'm telling it?) and I found out:
org.apache.excalibur.xml.xpath.XPathProcessorImpl:265
final XObject result = XPathAPI.eval(contextNode, str, new XalanResolver(resolver));
works, but the next line
result.nodelist()
(converting the XNodeSet into a nodelist) results in the ArrayIndexOutOfBoundsException.
Found no relating bug in bugzilla.
Tried it with Xalan jar built from CVS and it did neither work.
Joerg
