You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Alan Crocker <ac...@home.com> on 2001/03/02 06:20:19 UTC

Cannot resolve Document.importNode

I’m using Xerces-1.3.0 on Windows 2000 with JDK 1.3.0.

I cannot use org.w3c.dom.Document.importNode. It’s in the API doc and it’s
in the source, but the Java compiler cannot resolve it. Here’s some sample
code:

  import org.w3c.dom.Node;
  import org.w3c.dom.Element;
  import org.w3c.dom.Document;

  public Node testClone(Document d, Node n, boolean b)
  {
     return d.importNode(n, b);
  }

Here’s the error message:

C:\…\util\sample.java:156: cannot resolve symbol
symbol  : method importNode  (org.w3c.dom.Node,boolean)
location: interface org.w3c.dom.Document
            return d.importNode(n, b);

I also cannot use some other methods such as getElementsByTagNameNS which
are marked as DOM Level 2 in the API Doc. What’s wrong? Shouldn’t I be able
to use these methods?

Any help would be appreciated.
Thanks,

Alan Crocker


Re: Cannot resolve Document.importNode

Posted by Ian Roberts <ir...@decisionsoft.com>.
On Thu, 1 Mar 2001, Alan Crocker wrote:

> I’m using Xerces-1.3.0 on Windows 2000 with JDK 1.3.0.
> 
> I cannot use org.w3c.dom.Document.importNode. It’s in the API doc and it’s
> in the source, but the Java compiler cannot resolve it. Here’s some sample
> code:

[snip]

> I also cannot use some other methods such as getElementsByTagNameNS which
> are marked as DOM Level 2 in the API Doc. What’s wrong? Shouldn’t I be able
> to use these methods?
> 
> Any help would be appreciated.
> Thanks,

It looks like you've got another version of the DOM interfaces in your
classpath before the Xerces ones.  Try putting xerces.jar as the first
entry in your classpath and see if that helps.

Ian

-- 
Ian Roberts, Software Engineer        DecisionSoft Ltd.
tel: +44-1865-203192                  http://www.decisionsoft.com