[
https://issues.apache.org/jira/browse/XERCESJ-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Glavassevich resolved XERCESJ-1560.
-------------------------------------------
Resolution: Invalid
Usage error. You are literally making the element's value '<![CDATA[foo]]>'.
That is not a CDATA section.
> Facet Validation Fails while Serializing with CDATA elements
> ------------------------------------------------------------
>
> Key: XERCESJ-1560
> URL: https://issues.apache.org/jira/browse/XERCESJ-1560
> Project: Xerces2-J
> Issue Type: Bug
> Components: JAXP (javax.xml.validation)
> Affects Versions: 2.10.0
> Reporter: Michael Ernst
> Attachments: testproject.zip
>
>
> While marshalling a document with JAXB, I get the following error:
> [org.xml.sax.SAXParseException: cvc-maxLength-valid: Value '<![CDATA[foo]]>'
> with length = '15' is not facet-valid with respect to maxLength '3' for type
> '#AnonType_test'.]
> The document itself is valid when I parse it from a file. I tried it with DOM
> and SAX.
> I attached a simple maven test project. Executing the main class
> {{TestJaxbValidate}} creates the following exception.
> {noformat}
> Exception in thread "main" javax.xml.bind.MarshalException
> - with linked exception:
> [org.xml.sax.SAXParseException: cvc-maxLength-valid: Value '<![CDATA[foo]]>'
> with length = '15' is not facet-valid with respect to maxLength '3' for type
> '#AnonType_test'.]
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:326)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
> at
> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
> at TestJaxbValidate.main(TestJaxbValidate.java:23)
> Caused by: org.xml.sax.SAXParseException: cvc-maxLength-valid: Value
> '<![CDATA[foo]]>' with length = '15' is not facet-valid with respect to
> maxLength '3' for type '#AnonType_test'.
> at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(Unknown Source)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown
> Source)
> at
> org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.endElement(Unknown
> Source)
> at org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
> at
> com.sun.xml.bind.v2.runtime.output.SAXOutput.endTag(SAXOutput.java:132)
> at
> com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl.endTag(XmlOutputAbstractImpl.java:124)
> at
> com.sun.xml.bind.v2.runtime.output.ForkXmlOutput.endTag(ForkXmlOutput.java:91)
> at
> com.sun.xml.bind.v2.runtime.output.NamespaceContextImpl$Element.endElement(NamespaceContextImpl.java:504)
> at
> com.sun.xml.bind.v2.runtime.XMLSerializer.endElement(XMLSerializer.java:315)
> at
> com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:345)
> at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1052)
> at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringImplImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:1031)
> at
> com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:256)
> at
> com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:129)
> at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:161)
> at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:131)
> at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:333)
> at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:340)
> at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:76)
> at
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
> ... 3 more{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]