XML pretty printer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jmm-list-gn

    #1

    XML pretty printer

    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)
  • Patrick TJ McPhee

    #2
    Re: XML pretty printer

    In article <FrGdnbkKOs4Tba ncRVn-uw@giganews.com >,
    jmm-list-gn <jmm-list.AXSPAMGN@s ohnen-moe.com> 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
    ptjm@interlog.c om

    Comment

    • Johnny Kent

      #3
      Re: XML pretty printer


      "jmm-list-gn" <jmm-list.AXSPAMGN@s ohnen-moe.com> wrote in message
      news:FrGdnbkKOs 4TbancRVn-uw@giganews.com ...[color=blue]
      > 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)[/color]

      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....


      Comment

      • Johnny Kent

        #4
        Re: XML pretty printer


        "Patrick TJ McPhee" <ptjm@interlog. com> wrote in message
        news:2pkjp7Fmbs djU2@uni-berlin.de...[color=blue]
        > In article <FrGdnbkKOs4Tba ncRVn-uw@giganews.com >,
        > jmm-list-gn <jmm-list.AXSPAMGN@s ohnen-moe.com> wrote:
        >
        > % Is there a "pretty printer" function somewhere that makes XML easier[/color]
        to[color=blue]
        > % read by adding the indenting?
        >
        > xmllint from the libxml distribution has a --format option which might
        > do what you want. http://xmlsoft.org
        >
        > --[/color]
        Thanks Patrick I didn't know about that, looks cool



        Comment

        • jmm-list-gn

          #5
          Re: XML pretty printer

          Patrick TJ McPhee wrote:[color=blue]
          >
          > % 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
          >[/color]
          Yes, that is exactly it. Thank you!

          --
          jmm dash list (at) sohnen-moe (dot) com
          (Remove .AXSPAMGN for email)

          Comment

          Working...