W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2001

Question about Tidy

From: Marco Spinetti <m.spinetti@pisa.iol.it>
Date: Fri, 14 Sep 2001 03:50:44 -0400 (EDT)
Message-ID: <004701c13cf2$37712a40$5be94cc1@pisa.iol.it>
To: <html-tidy@w3.org>
Hi all,
I'm a italian student and I am doing the thesis in Java. In one of my files I use Tidy.jar but I have a big problem. 
I take a string (<p>...here formated text......</p><p>.....</p>) where the spaces have been replaced by &nbsp;. 
My purpose is to build a Xml document of this form:

<descr><p>...here formated text......</p><p>.....</p></descr>


To do this, my idea is build a Xml document with the taken string:

String document = "><p>...here formated text......</p><p>.....</p>";
descrizione ="<descrizione>" + descrizione + "</descrizione>";
and parsing the document with tidy. I have tried to use this code :
              StringBufferInputStream in1 = new StringBufferInputStream(descrizione);
              Tidy tidy = new Tidy();
              org.w3c.dom.Document doc1 = tidy.parseDOM(in1,null);
              Element body = (Element)doc1.getElementsByTagName("descrzione").item(0);
              NodeList ln = body.getChildNodes();
              Element descrizionee = doc1.createElement("descrizione");
              for (int i=0; i<ln.getLength();i++) {
but I obtain the following mistake:

org.w3c.dom.DOMException: DOM005 Wrong document

Why wrong document? I have tried to change the code but the error is always the same. 
Where is my error?
please help me. I am blocked with the thesis since many days for this mistake.
I hope that you will answer me. 
Best regards
Marco Spinetti 
Received on Monday, 17 September 2001 15:41:42 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:50 UTC