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 Schomisch <sm...@bonn.iz-soz.de> on 2000/04/04 15:41:36 UTC

XML Serialization

Hello, 

Here's my code for to write out a DOM to a file (generated XML_file):

...
OutputFormat format = new OutputFormat(doc);
format.setIndent(2);
format.setDoctype(format.getDoctypeSystem(), dtd_file);
StringWriter  stringOut = new StringWriter();
XMLSerializer    serial = new XMLSerializer(stringOut, format);
serial.serialize(doc.getDocumentElement());
//System.out.println(stringOut.toString());
xmlfilewriter = new FileWriter(file_name);
xmlfilewriter.write(stringOut.toString());
stringOut.close();
xmlfilewriter.close();
...

If the generated XML-File is over a certain size (about 60 KB), then
I have a correct output, otherwise the carriage return of a line (item) is
not done
and I have a incorrect output.
If I save this incorrect file in the "PFE-Editor" with the setting "not"
in "UNIX-Format" I get then the correct output with the carriage return.

Which code is missing above to reach at once correct carriage return also
in small sized files?

Thanks for Help!

with best regards

Siegfried Schomisch
--------------
InformationsZentrum Sozialwissenschaften
Abt. Forschung und Entwicklung
Siegfried Schomisch, M.A. 
Lennestr. 30, D-53113 Bonn
Tel.: (+49) 228 2281 168
Fax: (+49) 228 2281 120 
E-mail: sm@bonn.iz-soz.de
IZ: http://www.bonn.iz-soz.de/

Re: HTML

Posted by Brett McLaughlin <br...@earthlink.net>.

Boris Garbuzov wrote:
> 
> This is what file I produced using Xerces HTML library.  Netscape does not
> read it. Perhaps because it has self-closing tags. Is it forbidden by HTML
> standard?
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd">
> <HTML><HEAD><TITLE/></HEAD><BODYNAME id="bodyId" text="bodyText"/></HTML>

Do:

<HTML><HEAD><TITLE /></HEAD><BODYNAME id="bodyID" text="bodyText"
/></HTML>

Netscape requires that there be a space between the end of tag content
and the "/>" to denote and empty element.

-brett

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

HTML

Posted by Boris Garbuzov <bo...@keystrokenet.com>.
This is what file I produced using Xerces HTML library.  Netscape does not
read it. Perhaps because it has self-closing tags. Is it forbidden by HTML
standard?


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd">
<HTML><HEAD><TITLE/></HEAD><BODYNAME id="bodyId" text="bodyText"/></HTML>