Re: Output a new line after the XML declaration using indent="yes"

Jörg Hohwiller <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <[email protected]>
Hi there,


Brian Minchau wrote:
> 
> Hi Stanimir.
> 
> The Xalan
> serializer doesn't know about whether the serialized XML will
> be used in the the future as an external general parsed
> entity and included in yet another XML file.
> 
> It is possible that the XML will be included next to a text node that
> is not all whitespace and the extra whitespace that we inject after the
> XML header would be included next to non-whitespace
> text and become part of that text node, modifying it.
> 
> Extra whitespace added for indentation is done in ignorable locations,
> but this particular one (just after the header) might not be ignored.
> 
> Added indentation or extra whitespace before the document element
> is not always correct, so Xalan doesn't do it.
> 
> There is no Xalan specific option to control this behavior.
> 
> - Brian
> 

1. Could you please give an example or a link to the
XML-specification to point out why a newline after
XML-declation or at the end of the file should make the 
XML illegal. I am NOT talking about your problems
to implement this properly, but why
<?xml ....?>^n
<root>...</root>^n
should be illegal!?!?

2. Having a newline after XML-declaration as well
as at the end of the file is a common need that
JAXP users have. I can NOT accept your point
saying that this is generally NOT supported because
it could cause some trouble you may have implementing this.
This has a large impact after everybody has to eat this
when just using a plain JDK. It is a lot worse if people
start adding newlines manually to OutputStream,
because this will cause real trouble with encodings, especially
if the encoding is NOT 8-bit-wise (e.g. UTF-16) and a newlines
get broken because hackers of such workaround do NOT think
of such problems.

Please provide a solution here.

Thanks
  Jörg


-- 
View this message in context: http://www.nabble.com/Output-a-new-line-after-the-XML-declaration-using-indent%3D%22yes%22-tp15040090p24017219.html
Sent from the Xalan - J - Users mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.