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/07/24 19:09:58 UTC

DO NOT REPLY [Bug 11136] New: - DOCTYPE wrong after serialization

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=11136>.
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=11136

DOCTYPE wrong after serialization

           Summary: DOCTYPE wrong after serialization
           Product: Xerces2-J
           Version: 2.0.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: cehjohnson@aol.com


Xerces_1_4_4

After serializing a document that validates at the w3 xhtml validator, the 
document no longer validates, as the name of the doctype has been changed to upper case 
(!DOCTYPE html becomes !DOCTYPE HTML).

This can be demonstrated by using the following code 
with the url http://www.cehjohnson.uklinux.net/Templates/reviewX.dwt as the source for 
the document:

/**
	 * Serialize an xhtml document to file
	 *
	 * @param  doc       The document to 
serialize
	 * @param  filename  The file to serialize to
	 */
	public static void 
serializeXhtml(Document doc, String filename) 
{
		org.apache.xml.serialize.XHTMLSerializer xs = 
null;
		org.apache.xml.serialize.OutputFormat of = null;
		try {
			of = new 
org.apache.xml.serialize.OutputFormat(doc);
			//DEBUG let's have a look at the Doctype 
before it's serialized!
			System.out.print("Name of the doctype (" + doc.hashCode() + ") 
BEFORE serialization is: 
");
			System.out.println(doc.getDoctype().getName());
			// This seems OK (!DOCTYPE 
html) - so the DOCTYPE *must* be being mangled during serialization
			java.io.FileWriter 
out = new java.io.FileWriter(filename);
			xs = new 
org.apache.xml.serialize.XHTMLSerializer(out, of);
			xs.serialize(doc);
		} catch 
(Exception e) {
			e.printStackTrace();
		}
	}

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org