You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Cezar Andrei (JIRA)" <xm...@xml.apache.org> on 2009/10/26 22:02:59 UTC

[jira] Resolved: (XMLBEANS-384) Using the pretty print option results in invalid XML if processing instructions are embedded in enumerated elements

     [ https://issues.apache.org/jira/browse/XMLBEANS-384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cezar Andrei resolved XMLBEANS-384.
-----------------------------------

    Resolution: Won't Fix

Pretty print option works by introducing spaces, if in your application the spaces might have semantics do not use pretty print option (or toString() which implies pretty print).

> 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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org