Lists Home |
Date Index |
> Uche Ogbuji wrote:
> >>I am on the process of creating an XML document using JDOM API's for which
> >>need to add standalone="yes". How can this be done ?
> > I'm not familiar with JDOM, but I don't know of any XML "API" that allows such
> > fine control over the XML declaration. Your best bet is probably a text
> > processing step after serialization from DOM that changes the declaration
> > according to your needs. Since you'll probably have firm control over the
> > documents you're producing, you might be able to control the trickier aspects
> > of this.
> PerlSAX2 makes that information part of the start_document() call, and SAX
> writers should honour it. I suppose you could get Java SAX writers to honour the
> is-standalone property?
Yes. SAX2's LexicalHandler includes a "standalone" flag, so if one uses SAX
as an *output* format you should have control over that declaration. My
mistake (I wasn't thinking broadly enough, even though I've used SAX for
output a air bit before).
So I guess the solution might indeed be for the OP to switch to a Java SAX
writer. Might be more efficient, too.
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Introducing Anobind - http://www.xml.com/pub/a/2003/08/13/py-xml.html
XML Topic Maps by the book - http://www-106.ibm.com/developerworks/xml/library/
Charming Jython - http://www-106.ibm.com/developerworks/java/library/j-jython.h
Python, Web services, and XSLT - http://www-106.ibm.com/developerworks/xml/libr
Perspective on XML: What is this 'agility'? - http://www.adtmag.com/article.asp