473,326 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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 xsl:output 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?

--
si***@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
... a mild, inoffensive sadist...

Feb 11 '06 #1
2 1179
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
Feb 11 '06 #2
(More generally: Most of the features of the xsl:output 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
Feb 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: java_helloworld | last post by:
I am trying to print from an applet using the Java Print API. If I run the applet on appletviewer then things work fine i.e. I am able to get the print out. If I run the applet on a browser then...
1
by: mark | last post by:
Adding an applet to a web page through the <object> tag, allows you to target the JVM in 2 ways. (ref. http://java.sun.com/products/plugin/versions.html ) 1. "Dynamic Versioning", which ...
5
by: GoodMorningSky | last post by:
In java I can make documentation of all API I created. In C#, there is tags such as <summary> for documentation. However I don't know the tool like java tool. How to do so? Thank you.
4
by: Alan Wang | last post by:
Hi there: I am just wondering if I could call java library using C#. The reason to do that is my application wants to automate OpenOffice and create document. Thanks in advance Alan
2
by: Manoj Kumar P | last post by:
Hi, I'm new to python. I would like to know whether is it possible to access Java/C++ APIs from python. I have two applications written in Java and API, I wanted to call the APIs of these...
15
by: RAM | last post by:
Hello, I graduated computer science faculty and decided to became a programmer. Please help me to make a decision: Java or Microsoft .NET? What is the future of Java? Thanks! /RAM/
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
2
by: ramasubramanian.rahul | last post by:
hi i am trying to call some java APIs from c . i use the standatd JNI calls to load the JVM from a c program and call all java functions by using a pointer to the jvm which was returned by the JNI...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.