[jdom-interest] XMLOutputter and newlines after declaration/d octype

Norrman Per per.norrman at canovia.se
Wed Dec 18 16:00:58 PST 2002


Actually, your suggestion produces exactly the same output
as
   XMLOutputter.output(document, out);


I think Vadim is right. XMLOutputter#printDocType (and other methods)
should respect the newLines flag. If I parse the document

<?xml version="1.0" ?><!DOCTYPE repository SYSTEM "repository.dtd"
><repository/>

it should not come back as

<?xml version="1.0" ?>
<!DOCTYPE repository SYSTEM "repository.dtd" >
<repository/>

especially when considering this excerpt from XMLOutputter javadoc:

Several modes are available to effect the way textual content is printed.
All modes are configurable through corresponding set*() methods. Below is a
table which explains the modes and the effect on the resulting output. 

Text Mode    Resulting behavior.  
Default      All content is printed in the format it was created, no
             whitespace or line separators are are added or removed.  

Just my opinion.

/pmn


-----Original Message-----
From: Bradley S. Huffman
To: Vadim.Strizhevsky at morganstanley.com
Cc: jdom-interest at jdom.org
Sent: 2002-12-18 23:44
Subject: Re: [jdom-interest] XMLOutputter and newlines after
declaration/doctype 

Vadim Strizhevsky writes:

> For now I will have XMLOutputter subclass that duplicates
> printDeclaration and printDocType methods and doesn't print the
newlines
> when newline option is set to false.

Or use a sequence like

       out.write("<?xml version=\"1.0\"?>");
       XMLOutputter.output(document.get DocType, out);
       XMLOutputter.output(document.getRootElement(), out);

> Also I noticed a signle use  of "\n" instead of lineSeparator in the
> latest printDocType code.

Hmm, thought that was changed.

Brad
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/



More information about the jdom-interest mailing list