I would concur.  The default should probably be false.  However, I still
think the feature is very useful:  there’s a lot to be said for having the
default return readable.

 

Also, I know I suggested ‘indent’, but it should probably be ‘auto-format’
or ‘pretty-print’ or some such:  ‘indent’ sounds like it should be a number
(e.g., indent 4 characters).

 

Cliff Binstock
Coyote Reporting

  _____  

From: [email protected] [mailto:[email protected]] On Behalf Of Rémi
Dewitte
Sent: Friday, February 06, 2009 4:02 AM
To: [email protected]
Subject: Re: DOM formatting

 

Jérôme,

I have the feeling that defaulting it to true is not really the right thing
to do. I think you don't need very often to have the XML output in a
fashionable way and it will by default consume more resources for nothing.
Because most of the time xml is not meant to be consumed by humans (except
debugging).

Moreover, IE or FF are both able to display XML trees. 
If you use curl to test your XML Restlet, just do somthing like this : 
curl url | xmllint --format -
And you are done.

Rémi

On Fri, Feb 6, 2009 at 12:54, Jerome Louvel <[email protected]>
wrote:

Hi Cliff,

 

Good suggestion. I've just added this "indent" property to DomRepresentation
in SVN trunk. Its value is true by default.

 

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~  <http://www.restlet.org/>
http://www.restlet.org
Noelios Technologies ~ Co-founder ~  <http://www.noelios.com>
http://www.noelios.com

 


 

  _____  

De : Cliff Binstock [mailto:[email protected]] 
Envoyé : vendredi 6 février 2009 00:40
À : [email protected]
Objet : RE: DOM formatting

Stephen,

 

Thanks … for the input … still seems like it should be more trivial [
DomRepresentation#setIndent(boolean), perhaps ]

 

Cliff Binstock
Coyote Reporting

  _____  

From: Stephen Groucutt [mailto:[email protected]] 
Sent: Thursday, February 05, 2009 1:41 PM
To: [email protected]
Subject: Re: DOM formatting

 

Hi,

Have you considered subclassing DomRepresentation and overriding its
createTransformer() method to set the output properties you want (in your
case, OutputKeys.INDENT to yes)?  I had a case where I had to modify some
properties of the XML being produced, and I found that the easiest way to do
it was to subclass the representation in this way.

On Thu, Feb 5, 2009 at 4:12 PM, Cliff Binstock
<[email protected]> wrote:

The DOMRepresentation, writes out the DOM as-is.  Certainly this is great in
most cases.

 

However, it would be nice if there was "pretty-print" option that provided
easy-to-look at XML.  Of course, I can (and probably will) run the DOM
through my own transformation to pretty-print, but it seems like use case
might be a common desire.

My current use case is building a Document with Elements, but no Text nodes,
so the resultant XML is one unreadable line.

 

If there is an existing trivial way to do this, great.  If not, consider
this a feature request.

 

Thanks!

 

Cliff Binstock

Coyote Reporting

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1113782

Reply via email to