Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#36 preserve original formatting/spaces between attributes

default
closed-wont-fix
nobody
None
4
2014-08-09
2009-09-14
Alain Knaff
No

The options --pf (preserve original formatting) and --ps (preserve non-significant spaces) only work partially.

Any tag which has line breaks between attributes is collapsed on a single line.

See example before and after.

xmlstarlet ed --pf --ps -u "/server/mbean/@code" -v org.mobicents.servlet.sip.startup.jboss.JBossSip before.xml >after.xml

Discussion

  • Alain Knaff
    Alain Knaff
    2009-09-14

    Before

     
    Attachments
  • Alain Knaff
    Alain Knaff
    2009-09-14

    After

     
    Attachments
  • Noam Postavsky
    Noam Postavsky
    2010-11-26

    • priority: 5 --> 4
    • status: open --> open-accepted
     
  • Noam Postavsky
    Noam Postavsky
    2010-11-26

    The example doesn't seem to apply but I can confirm the bug:

    $ cat ws.xml
    <doc
    a="foo"/>
    $ xml ed --ps --pf ws.xml
    <?xml version="1.0"?>
    <doc a="foo"/>

    Fixing this will be tricky, I haven't quite figured out how whitespace is handled but patching libxml2 will likely be required.

     
  • Noam Postavsky
    Noam Postavsky
    2011-01-15

    So currently --pf and --ps are indentical and don't work entirely as advertised: they preserve whitespace nodes in the tree, which means whitespace inside a tag is lost. I'm currently leaning towards just changing the documentation to reflect this rather than trying to fix it.

     
  • Noam Postavsky
    Noam Postavsky
    2011-03-11

    I've changed the --help message to describe the actual behaviour in commit dee21ea7e1357835fc90394e604a946a168be079.

    I'm moving this to feature requests.

     
  • Noam Postavsky
    Noam Postavsky
    2011-03-11

    • labels: 475157 -->
    • summary: preserve original formatting/spaces don't work --> preserve original formatting/spaces between attributes
    • status: open-accepted --> open
     
  • Noam Postavsky
    Noam Postavsky
    2014-08-09

    I don't think there is a realistic prospect of ever implementing this, short of completely rewriting xmlstarlet.

     
  • Noam Postavsky
    Noam Postavsky
    2014-08-09

    • status: open --> closed-wont-fix
    • Group: --> default