Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support XML strings in XMLTextInfosetInputter/Outputter
- When outputting string elements with the stringAsXml runtime property set to true, instead of escaping the simple element content, we instead output the content to raw XML as if it were part of the infoset. When inputting, we read the XML and convert it back to a string as the simple content. When the XML is added to the infoset, a wrapper element called "stringAsXml" is added to ensure the default namespace is reset. As an example: Infoset without the stringAsXml property: <foo><payload>content</payload></foo> Infoset with the stringAsXml property: <foo><stringAsXml xmlns=""><payload>content</payload></stringAsXml></foo> Note that there are multiple ways to read/write XML that are syntactically different but semantically the same, making it unlikely that unparsed XML will be byte-for-byte the same as the original XML. Also note that the result of the XMLTextInfosetOutputter is used for "full" validation. Because this changes its output, essentially converting a simple string type into a complex type, this will break full validation if stringAsXml is used. If full validation is needed, one must use external validation with a modified schema. And example of this schema is included in new tests. - We currently ignore the return value of InfosetOutputter functions, and any exceptions thrown just bubble to the top and appear as an unexpected exception. Instead, if the InfosetOutputter throws an exception, we create an SDE. The logic for finalizing the walker is moved into the doParse function so that the SDE is caught and correctly added as a diagnostic. This is need to handle non-well-formed XML. Additionally, InfosetOutputter's returning false has been deprecated and will result in a usage error. - We cannot use normal TDML tests to test this behavior because the XMLTextInfosetOutputter outputs a different infoset than the other infoset outputters, hand written tests added to verify the correct behavior. DAFFODIL-2708
- Loading branch information