XML pretty printer

Discussion in 'XML' started by jmm-list-gn, Aug 31, 2004.

  1. jmm-list-gn

    jmm-list-gn Guest

    Hello,
    Most XML examples have the content neatly laid out with newlines and
    indenting. A DOM parser, however, does not bother with such niceties when
    creating an XML file.
    Is there a "pretty printer" function somewhere that makes XML easier to
    read by adding the indenting?

    --
    jmm dash list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
     
    jmm-list-gn, Aug 31, 2004
    #1
    1. Advertising

  2. In article <>,
    jmm-list-gn <> wrote:

    % Is there a "pretty printer" function somewhere that makes XML easier to
    % read by adding the indenting?

    xmllint from the libxml distribution has a --format option which might
    do what you want. http://xmlsoft.org

    --

    Patrick TJ McPhee
    East York Canada
     
    Patrick TJ McPhee, Sep 1, 2004
    #2
    1. Advertising

  3. jmm-list-gn

    Johnny Kent Guest

    "jmm-list-gn" <> wrote in message
    news:...
    > Hello,
    > Most XML examples have the content neatly laid out with newlines and
    > indenting. A DOM parser, however, does not bother with such niceties when
    > creating an XML file.
    > Is there a "pretty printer" function somewhere that makes XML easier to
    > read by adding the indenting?
    >
    > --
    > jmm dash list (at) sohnen-moe (dot) com
    > (Remove .AXSPAMGN for email)


    Not sure how you are reading the XML.
    Most browsers will render XML all pretty like you want. The XML itself
    doesn't care about the formatting so it's really up to the viewer you use. A
    simple text editor will not do what you want as I'm sure you've found.
    Here's a similar discussion
    http://tinyurl.com/68zkg
    OTOH you could use XSLT to transform your XML to the format you want....
     
    Johnny Kent, Sep 1, 2004
    #3
  4. jmm-list-gn

    Johnny Kent Guest

    "Patrick TJ McPhee" <> wrote in message
    news:...
    > In article <>,
    > jmm-list-gn <> wrote:
    >
    > % Is there a "pretty printer" function somewhere that makes XML easier

    to
    > % read by adding the indenting?
    >
    > xmllint from the libxml distribution has a --format option which might
    > do what you want. http://xmlsoft.org
    >
    > --

    Thanks Patrick I didn't know about that, looks cool
    http://xmlsoft.org/xmllint.html
     
    Johnny Kent, Sep 1, 2004
    #4
  5. jmm-list-gn

    jmm-list-gn Guest

    Patrick TJ McPhee wrote:
    >
    > % Is there a "pretty printer" function somewhere that makes XML easier to
    > % read by adding the indenting?
    >
    > xmllint from the libxml distribution has a --format option which might
    > do what you want. http://xmlsoft.org
    >

    Yes, that is exactly it. Thank you!

    --
    jmm dash list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
     
    jmm-list-gn, Sep 1, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rene Guenther
    Replies:
    0
    Views:
    467
    Rene Guenther
    Jul 28, 2003
  2. Jabadoo
    Replies:
    0
    Views:
    412
    Jabadoo
    Apr 4, 2004
  3. Roedy Green

    Work in progress, pretty printer

    Roedy Green, May 3, 2004, in forum: Java
    Replies:
    5
    Views:
    355
    Andrew Thompson
    May 4, 2004
  4. Chris
    Replies:
    12
    Views:
    3,059
    Jaakko Kangasharju
    Sep 29, 2005
  5. Ben Butler-Cole
    Replies:
    3
    Views:
    712
    Robert Bossy
    Feb 29, 2008
Loading...

Share This Page