nullPointerException in importNode

Extending a bit in my previous message: this what I want to do. Get a file,
tidy it, and then convert it to xerces DOM (to eventually show it on a web
page).

public class TestDOM3 {

  public TestDOM3() {}

  public static void main(String args[]) {

    FileInputStream in;
    Tidy tidy = new Tidy();
    TestDOM3 t = new TestDOM3();

    try {
      in = new FileInputStream("kk2.html");
      tidy.setMakeClean(true);
      tidy.setXmlTags(true);
      Node myNode = tidy.parseDOM(in, null);
      Document myDoc = new DocumentImpl();
      myDoc.appendChild( myDoc.importNode( myNode, false ));
    }
    catch ( IOException e ) {
      System.err.println( "IO Exception " + e.toString() );
    }

  }

--

This seems pretty much straight forward, but I get this exception:
C:\progs\jakarta-tomcat\webapps\cocoon\mixsp>java -classpath
.;c:\progs\jtidy-04
aug2000r5\build\Tidy.jar;c:\progs\xerces-1_2_1\tools\xerces.jar TestDOM3
Exception in thread "main" java.lang.NullPointerException
        at
org.apache.xerces.dom.DocumentImpl.importNode(DocumentImpl.java:698)
        at TestDOM3.main(TestDOM3.java:27)

---

Is there something else that must be done to import a Node? Same goes if I
import with "true" as second argument.

Thanks for any hint!

Name: Juan J. Merelo
Title: Consultant
Civista
Telephone:   +44 (0) 20 84086.....
Mobile:        +34 627 397239
Facsimile:    +44 (0) 20 84086399
Email:jj.merelo@civista.com
http://www.civista.com

Services and Applications for a Wireless World
This e-mail and the information that it contains may be confidential and
protected by law and is for access by the intended recipient only. Any
liability (in negligence or otherwise) arising from any third party acting,
or refraining from acting, on any information contained in this e-mail is
hereby excluded. If you are not the intended recipient, please notify the
sender immediately and do not disclose the contents to any other person, use
it for any purpose, or store or copy the information in any medium.
Copyright in this e-mail and any attachments belongs to Civista Limited
and/or its subsidiary companies.
While this message is virus checked, Civista can not be held responsible for
its integrity.

Received on Tuesday, 7 November 2000 08:38:05 UTC