You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/01/30 00:39:35 UTC
DO NOT REPLY [Bug 6116] New: -
Error in the serialization of TextNode containing markup.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6116>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6116
Error in the serialization of TextNode containing markup.
Summary: Error in the serialization of TextNode containing
markup.
Product: Xerces2-J
Version: 2.0.0 [beta 4]
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: DOM
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: achille@us.ibm.com
Xerces 2[beta4] does not serialize correctly DOM TextNode containing markup.
The output is not wellformed!
CODE :
package xercesTest;
import org.apache.xml.serialize.*;
import org.apache.xerces.dom.*;
import org.w3c.dom.*;
import java.io.*;
class Test {
public static void main(String[] args) throws Exception {
Document doc=new DocumentImpl();
Element root=doc.createElement("root");
doc.appendChild(root);
root.appendChild(doc.createTextNode("<a> is not a markup!!!"));
save(doc,new File("C:\\temp\\test1.xml"));
}
public static void save(Document doc, File file,String encoding)
throws IOException {
Writer out=new OutputStreamWriter(new FileOutputStream(file));
save(doc,out);
out.close();
}
protected static void save(Document doc, Writer writer) throws
IOException {
OutputFormat format=new OutputFormat(doc);
format.setIndenting(true);
MLSerializer serializer=new XMLSerializer(writer,format );
serializer.serialize(doc);
writer.flush();
}
}
THE OUTPUT is not well-formed
<?xml version="1.0" encoding="UTF-8"?>
<root><a> is not a markup!!!</root>
(Note: Xerces 1.4.3 would write out "<a>" instead of "<a>")
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org