It looks as if the DOM implementation you are using (part of JTidy) doesn't implement the version of the DOM interface that Saxon is using (DOM level 3). Saxon tries to use DOM level 3 methods only if the implementation supports them, but in this case the exception thrown when the method is not there isn't one of the exceptions that Saxon is testing for. The code in net.sf.saxon.dom.NodeWrapper reads:
 
            try {
                Class[] argClasses = {Node.class};
                Method isSameNode = Node.class.getMethod("isSameNode", argClasses);
                Object[] args = {((NodeWrapper)other).node};
                Boolean b = (Boolean)(isSameNode.invoke(node, args));
                return b.booleanValue();
            } catch (NoSuchMethodException e) {
                // use fallback implementation
            } catch (IllegalAccessException e) {
                // use fallback implementation
            } catch (InvocationTargetException e) {
                // use fallback implementation
            }
 
and it seems that AbstractMethodError should be added to the list.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Julien Chambert
Sent: 19 July 2006 15:28
To: saxon-help@lists.sourceforge.net
Subject: [saxon] problem with xquery

hello,

      i'm new in use of Xquery. I have to parse a web site and i try to use xquery Api Saxon. but i have some problems with the exception generated:

     to made the query, I use a function wioch take in arguments the query and Document
here is the code:

         public static List runXQuery(Document dom, String query) throws XPathException {
        Configuration configuration = new Configuration();
        StaticQueryContext staticContext = new StaticQueryContext(configuration);
        XQueryExpression queryExpression = staticContext.compileQuery(query);
        DynamicQueryContext dynamicContext = new DynamicQueryContext(configuration);
        dynamicContext.setContextNode(new DocumentWrapper(dom, "", configuration));

        return queryExpression.evaluate(dynamicContext);
    }

the exception generated :
Exception in thread "main" java.lang.AbstractMethodError: org.w3c.tidy.DOMElementImpl.isSameNode(Lorg/w3c/dom/Node;)Z
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at net.sf.saxon.dom.NodeWrapper.isSameNodeInfo(NodeWrapper.java:200)
    at net.sf.saxon.dom.NodeWrapper.compareOrder(NodeWrapper.java:278)
    at net.sf.saxon.sort.LocalOrderComparer.compare(LocalOrderComparer.java:30)
    at net.sf.saxon.sort.DocumentOrderIterator.compare(DocumentOrderIterator.java:53)
    at net.sf.saxon.sort.GenericSorter.quickSort1(GenericSorter.java :226)
    at net.sf.saxon.sort.GenericSorter.quickSort(GenericSorter.java:183)
    at net.sf.saxon.sort.DocumentOrderIterator.<init>(DocumentOrderIterator.java:34)
    at net.sf.saxon.sort.DocumentSorter.iterate (DocumentSorter.java:66)
    at net.sf.saxon.expr.ForExpression.iterate(ForExpression.java:514)
    at net.sf.saxon.query.XQueryExpression.iterator(XQueryExpression.java:199)
    at net.sf.saxon.query.XQueryExpression.evaluate (XQueryExpression.java:119)
    at hu.midori.kosmos.server.util.WebCrawlingUtils.runXQuery(WebCrawlingUtils.java:98)

 and the query:

for $d in //table/tr
return
  <dummy>
            { data(fn:normalize-space($d/child::td[1]/text())) }|
            { data(fn:normalize-space($d/child::td[2]/child::a/text())) }
  </dummy>

Please, someone can explain me where is the mistake?

  perhaps my website can't be parsed with this technique. Are there conditions to parse html?