- From: Marco Spinetti <m.spinetti@pisa.iol.it>
- Date: Fri, 14 Sep 2001 03:50:44 -0400 (EDT)
- To: <html-tidy@w3.org>
- Message-ID: <004701c13cf2$37712a40$5be94cc1@pisa.iol.it>
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 .
My purpose is to build a Xml document of this form:
<page>
.....
<descr><p>...here formated text......</p><p>.....</p></descr>
</page>
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();
tidy.setMakeClean(true);
tidy.setXmlOut(true);
tidy.setXmlTags(true);
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++) {
descrizionee.appendChild((Element)ln.item(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