Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML APIs (Java): how do I know if a document wants to be prettyprinted?

Reply
Thread Tools

XML APIs (Java): how do I know if a document wants to be prettyprinted?

 
 
Simon Brooke
Guest
Posts: n/a
 
      02-11-2006
This relates to my earlier questions about namespaces...

When I use

javax.xml.transformer.Transformer.transform(
javax.xml.transform.Source, javax.xml.transform.Result)

then, if I pass a DOMResult object as the second argument, there's
nothing that I can see which I can get back from the DOMResult that
tells me that it wants the document to be pretty-printed. I can get back
the node which is the result of the transformation, and that node will
will in practice be either a document node or an element node. But I
can't see anything in either the DOM2 or DOM3 specifications for
Document, Element or Node which says whether they want to be pretty
printed - and, indeed, nor should there be, because a document is just a
bit of data and should be agnostic about its representation.

But the xslutput directive takes 'indent="yes"' as a possible
attribute-value pair. An XSL transform has to be able to tell me that it
wants to be pretty printed, and it would seem it has to pass that back
to me in the Result or DOMResult specifications. I just don't see it.

Am I being stupid?

--
http://www.velocityreviews.com/forums/(E-Mail Removed) (Simon Brooke) http://www.jasmine.org.uk/~simon/


... a mild, inoffensive sadist...

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      02-11-2006
Simon Brooke wrote:
> then, if I pass a DOMResult object as the second argument, there's
> nothing that I can see which I can get back from the DOMResult that
> tells me that it wants the document to be pretty-printed.


Pretty-printing is the serializer's responsibiltiy. If you do a
transform to SAX or DOM rather than through the serializer, indent will
generally be ignored, because you're bypassing that portion of the
processor.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      02-12-2006
(More generally: Most of the features of the xslutput directive are
implemented by the serializer and apply only when outputting as a text
stream... or at most become annotations on the internal XML form, which
the serializer later acts upon. And the form of those annotations may or
may not be publicly exposed; check your particular XSLT processor's
documentation. For example: In some cases, Xalan used to pass hints to
its own serializers via a processing instruction which the serializer
acted on and discarded; I haven't checked whether that's still true or
whether those PIs are suppressed when outputting as DOM or SAX.)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: DBMS versus XML APIs (was "any (preferably open source) staticanalysis tool or methodologies/studies to translate ANSI [C|C++] or javacode to XML?") Joe Kesselman XML 0 09-27-2011 12:52 PM
Refer to an XML document from within an XML document Manish Hatwalne XML 1 07-13-2004 10:24 AM
I know, I know, I don't know Andries Perl Misc 3 04-23-2004 02:17 AM
XQuery APIs -- how do you identify the XML source Benjamin G. Jones XML 0 01-08-2004 05:39 PM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments