Using the pretty print option results in invalid XML if processing instructions
are embedded in enumerated elements
-------------------------------------------------------------------------------------------------------------------
Key: XMLBEANS-384
URL: https://issues.apache.org/jira/browse/XMLBEANS-384
Project: XMLBeans
Issue Type: Bug
Affects Versions: Version 2.4
Reporter: Scott Roeske
Priority: Minor
If an element contains a processing instruction, it is separated into multiple
lines when using the pretty print option.
For example:
<elem><?proc_instr?>text</elem>
Becomes:
<elem>
<?proc_instr?>
text
</elem>
This causes problems if the element is an enumerated type since the extra
whitespace results in invalid XML. If the output is subsequently parsed, then
the following exception is raised when trying to validate the document or
trying to access the value:
org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: string value '
text
' is not a valid enumeration value for type of elem element in type of
element doc
In this case, the newlines that have been introduced have resulted in a value
that does not match any of the valid enumerated types.
The workaround is to use the "strip whitespace" option when parsing the output,
which collapses the value back to a single line and results in valid XML again.
However, this workaround may not always be possible or desirable, and it would
be preferable if the pretty print output could result in valid XML from the
outset.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]