ID 281274 - `FnAttribute` XML serialization is invalid with `FnAttribute::DelimiterEncode()` values

Follow

Problem summary:

When serialising FnAttribute.Attribute objects which contain the result of a call to FnAttribute::DelimiterEncode() as values of string attributes to an XML string, and then attempting to parse that XML string back to an FnAttribute, an exception is raised.

getXML() does not appear to escape non-printable characters, and parseXML() does not appear to support parsing of non-printable characters.

Steps to reproduce:

  1. Execute the following snippet of code in a Python tab:

gb = FnAttribute.GroupBuilder()inputAttr = gb.set(FnAttribute.DelimiterEncode('/root/world/taco'), 'xxx').build()print(inputAttr.getXML())outputAttr = FnAttribute.Attribute.parseXML(inputAttr.getXML())print(outputAttr.getXML())

Expected behaviour:

The resulting output should be the following:


<attr type="GroupAttr">  <attr name="�root�world�taco" tupleSize="1" type="StringAttr">    <sample size="1" time="0">      <str value="xxx"/>    </sample>  </attr></attr><attr type="GroupAttr">  <attr name="�root�world�taco" tupleSize="1" type="StringAttr">    <sample size="1" time="0">      <str value="xxx"/>    </sample>  </attr></attr>

Actual behaviour:

The resulting output is the following:


<attr type="GroupAttr">  <attr name="�root�world�taco" tupleSize="1" type="StringAttr">    <sample size="1" time="0">      <str value="xxx"/>    </sample>  </attr></attr>File "<string>", line 4, in <module>    outputAttr = FnAttribute.Attribute.parseXML(inputAttr.getXML())ValueError: Given string is not valid FnAttribute XML

Workaround:

Instead of serialising to XML text, the binary form of an attribute can be used for the round-tripping:


outputAttr = FnAttribute.Attribute.parseBinary(inputAttr.getBinary())

Reproduced versions/platforms:

  • 2.0v1/Linux
  • 2.6v1/Linux

Customer version/platform:

Not supplied.

    We're sorry to hear that

    Please tell us why