My code outputs fine:
public static String serializeDoc(Element doc){
String xmlString = new String();
StringWriter stringOut = new StringWriter();
OutputFormat opfrmt = new OutputFormat(doc.getOwnerDocument(), "UTF-8",
true);
opfrmt.setIndenting(true);
opfrmt.setPreserveSpace(false);
XMLSerializer serial = new XMLSerializer(stringOut, opfrmt);
try{
serial.asDOMSerializer();
serial.serialize( doc );
xmlString = stringOut.toString();
} catch(java.io.IOException ioe){
xmlString=null;
}
return xmlString;
}
Let me know if you still have problems
----- Original Message -----
From: "Eric" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 2:30 PM
Subject: problems formatting output
> I've been having some troubling problems using OutputFormat to write
> out a DOM. I'm basically parsing some ugly XML (spaces before '>'s,
> no newlines, etc.) into a DOM and then writing it back
> out. I've traversed the DOM and it looks like it gets parsed just
> fine, but when I use OutputFormat to write it out, the output still
> has ugliness (although different from the input). Tags are
> word-wrapped so that they split over lines, etc. It looks like this:
>
> <time>15:04:27</time> <anten
> type="broadcast"> <Station num="17650">
>
> What am I doing wrong???
>
> Thanks,
> Eric.
>
> --
> _____ _
> | ____|(_) http://ir.iit.edu/~ej
> | _| | | Page me via ICQ at
> | |___ | | http://wwp.mirabilis.com/19022931
> |______/ | or by mailing [EMAIL PROTECTED]
> |__/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]