State:Closed|icon_bug|icon_katana|database:public|Resolution:Fixed|TargetRelease:4.5v1|BugID:281274|
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:
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:
Customer version/platform:
Not supplied.
We're sorry to hear that
Please tell us why