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 Dave,

thanks for your response...

> > 
> > 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.
> I find the tone of your post to be offensive.  No one on this list owes 
> you anything in particular, and I suggest you be more polite in future 
> posts.

Sorry for that. Of course nobody owes me anything.
I just ran into this problem and read this thread.
This gave me the impression that a user demand
-that is obvious to me- is not really seen here (I am
talking about my impression). 
Besides English is not my native language so I do
not know if there is something very offensive in my words.
I just wanted to make my personal position very clear.
Besides I tended to always write "NOT" capitalized,
because I often read over this word and get the wrong 
message. A friend explained me that this is no good style
here because it overemphasizes what I wanted to say...

> > 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.
> Any XML parser that requires a newline between the XML declaration and 
> the root element, or after the root element, is non-conforming and 
> should be fixed.

Absolutely true. But XML is also read by humans.
I wrote an open-source tool (maven-plugin) that modifies 
XML that can be handwritten. Users tell me that there is a
bug in my product because newlines get lost.
I think they are right but my problem is that
I see the main problem in xalan-j.

> > 
> > Please provide a solution here.
> You can always post-process the document and 
> add the new line characters.

Of course I can do that. I already wrote about this option
before and the pitfalls one can run into with encodings, etc.
I was choosing Xalan-J because I used JAXP
and did not want to add thirdparty libs (like XOM, JDOM or 
Dom4j). But if I need such workaround I'd better use one
of those external libs instead.

Besides Xalan-J also stips a newline between XML-Comments
and the root-tag. I can not simply workaround this problem without
reimplementing an XML-Writer or just using an other product.

> Dave

Regards
  Jörg


-- 
View this message in context: http://www.nabble.com/Output-a-new-line-after-the-XML-declaration-using-indent%3D%22yes%22-tp15040090p24129270.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.