Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

RE: [jdom-interest] RE: Getting xml header for every input into xml
 file

Edelson, Justin

2006-10-27


>I got your point but it wont print xml header at all,
>the problem is xml version is printed for every entry in the
>xml file as
>shown below.
>
><?xml version="1.0" encoding="UTF-8"?>
><root><name>Mukunda</name><age>26</age></root>
><?xml version="1.0" encoding="UTF-8"?>
><root><name>a</name><age>30</age></root>
>
>I dont want to print version headers to each and every input.
>

Why do you want to have a false declaration -- the document isn't XML
1.0, so why claim it to be?

If you insist on including an XML declaration in an invalid file, you
could just have a boolean that you switch after writing the first
document and then use that boolean to determine how to create a new
XMLOutputter. But I have to say that I (and I suspect others) think this
is a bad idea. You should either produce valid XML or admit that what
you're doing isn't XML. There's a reason standards exist.

Justin

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.