Restore XML conformant logic for escaping < and > characters #2965
Restore XML conformant logic for escaping < and > characters #2965kwokcb wants to merge 3 commits into
Conversation
…< and > characters. Expose a "strict" XML mode on XMLWriteOptions. Default is false which means to not escape. As read supports both and escaped and non-escaped < and > support has not changed. Added test case to allow writing of either and check for read of escaped.
|
Pinging @ashwinbhat, @ld-kerley, and @jstone-lucasfilm for feedback / review. I'm not sure why |
| REQUIRE(fileInput != nullptr); | ||
| std::string unescaped_string = fileInput->getValueString(); | ||
| // There should not be any escaped characters in the value string | ||
| REQUIRE(unescaped_string.find("<>") == std::string::npos); |
There was a problem hiding this comment.
This was always the logic as read always unescapes.
|
HI @kwokcb having the option is helpful but it does create a situtation where mtlx generated by MaterialX will be non-conformant. As per UDIM tags are have < and >, should this be updated to mention that these should be encoded for XML?
|
|
I have put this up to allow maintaining "previous" (undesired) behaviour for discussion. I would advocate to remove this option and always require encoding for any SGML derivatives (XML, HTML etc). Hence the spec would need the clarification you note. |
|
After discussing with @ashwinbhat offline, I have made this restore PugiXML behaviour for |
Changes
Update #2956
From a user point of all run-time strings will still show
<and>. The only difference is this enforces writing conformant escaped characters to file. This does not disallow users from using unescaped characters by hand editing.Implementation
Replace MaterialX specific code for writing unescaped characters
<and>with originalPugiXMLlogic.Tests
Example
Here is an original UDIM test file:
Here is the escaped version written out:
Loading either one in results in the same unescaped user string be stored at run-time and shown the UI. This is using the GraphEditor: