Menu

#104 xml ed mangles newline in attribute-value

all
closed-wont-fix
nobody
None
5
2013-10-22
2013-10-21
rainpumped
No

I've got the following xml-file:

cat test.xml
<?xml version="1.0"?>
<a>
  <b parm="gerg
wegreqwgwe
gwegwegwe
eg" />
</a>

and when I try to edit the file, xmlstarlet applies changes to the whitespace in the attribute-value:

xml ed -u a/b -v test /tmp/test.xml
<?xml version="1.0"?>
<a>
  <b parm="gerg wegreqwgwe gwegwegwe eg">test</b>
</a>

I use:

xml --version
1.5.0
compiled against libxml2 2.7.6, linked with 20706
compiled against libxslt 1.1.26, linked with 10126

Thanks & KR
Thomas

Discussion

  • Noam Postavsky

    Noam Postavsky - 2013-10-21

    Sorry, this can't really be fixed because xmlstarlet never gets to even see the value with newlines. It's based on libxml2 which follows the XML spec quite strictly:

    3.3.3 Attribute-Value Normalization

    Before the value of an attribute is passed to the application or checked for validity, the XML processor MUST normalize the attribute value by applying the algorithm below, or by using some other method such that the value passed to the application is the same as that produced by the algorithm.
    ...
    For a white space character (#x20, #xD, #xA, #x9), append a space character (#x20) to the normalized value.

     

    Last edit: Noam Postavsky 2013-10-22
  • Noam Postavsky

    Noam Postavsky - 2013-10-21
    • status: open --> closed-wont-fix
     
  • rainpumped

    rainpumped - 2013-10-22

    Thank you for clarifying!

    the application responsible for creating this portion of xml is already known for doing things not so right when it comes to creating xml... ;-)

     

    Last edit: rainpumped 2013-10-22

Log in to post a comment.

Auth0 Logo