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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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 "&lt;a&gt;" instead of "<a>")

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to