This commit is contained in:
Arjen Poutsma 2009-02-25 11:18:20 +00:00
parent 516cc02d23
commit d83b601de0
3 changed files with 22 additions and 23 deletions

View File

@ -30,14 +30,14 @@ import javax.xml.stream.XMLStreamWriter;
import org.exolab.castor.mapping.Mapping; import org.exolab.castor.mapping.Mapping;
import org.exolab.castor.mapping.MappingException; import org.exolab.castor.mapping.MappingException;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.ResolverException; import org.exolab.castor.xml.ResolverException;
import org.exolab.castor.xml.UnmarshalHandler; import org.exolab.castor.xml.UnmarshalHandler;
import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.exolab.castor.xml.XMLContext; import org.exolab.castor.xml.XMLContext;
import org.exolab.castor.xml.XMLException; import org.exolab.castor.xml.XMLException;
import org.exolab.castor.xml.ValidationException;
import org.exolab.castor.xml.MarshalException;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.xml.sax.ContentHandler; import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
@ -47,11 +47,11 @@ import org.xml.sax.ext.LexicalHandler;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.oxm.UnmarshallingFailureException;
import org.springframework.oxm.XmlMappingException;
import org.springframework.oxm.ValidationFailureException;
import org.springframework.oxm.MarshallingFailureException; import org.springframework.oxm.MarshallingFailureException;
import org.springframework.oxm.UncategorizedMappingException; import org.springframework.oxm.UncategorizedMappingException;
import org.springframework.oxm.UnmarshallingFailureException;
import org.springframework.oxm.ValidationFailureException;
import org.springframework.oxm.XmlMappingException;
import org.springframework.oxm.support.AbstractMarshaller; import org.springframework.oxm.support.AbstractMarshaller;
import org.springframework.oxm.support.SaxResourceUtils; import org.springframework.oxm.support.SaxResourceUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -296,7 +296,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
* Template method that allows for customizing of the given Castor {@link Marshaller}. * Template method that allows for customizing of the given Castor {@link Marshaller}.
* <p>The default implementation invokes {@link Marshaller#setValidation(boolean)} * <p>The default implementation invokes {@link Marshaller#setValidation(boolean)}
* with the property set on this marshaller, and calls {@link Marshaller#setNamespaceMapping(String, String)} * with the property set on this marshaller, and calls {@link Marshaller#setNamespaceMapping(String, String)}
* with the {@linkplain #setNamespaceMappings(java.util.Properties) namespace mappings}. * with the {@linkplain #setNamespaceMappings(java.util.Map) namespace mappings}.
*/ */
protected void customizeMarshaller(Marshaller marshaller) { protected void customizeMarshaller(Marshaller marshaller) {
marshaller.setValidation(this.validating); marshaller.setValidation(this.validating);
@ -410,7 +410,6 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
* @param marshalling indicates whether the exception occurs during marshalling (<code>true</code>), * @param marshalling indicates whether the exception occurs during marshalling (<code>true</code>),
* or unmarshalling (<code>false</code>) * or unmarshalling (<code>false</code>)
* @return the corresponding <code>XmlMappingException</code> * @return the corresponding <code>XmlMappingException</code>
* @see CastorUtils#convertCastorException
*/ */
protected XmlMappingException convertCastorException(XMLException ex, boolean marshalling) { protected XmlMappingException convertCastorException(XMLException ex, boolean marshalling) {
if (ex instanceof ValidationException) { if (ex instanceof ValidationException) {

View File

@ -95,7 +95,7 @@ import org.springframework.util.xml.StaxUtils;
* @see #setUnmarshallerProperties(Map) * @see #setUnmarshallerProperties(Map)
* @see #setSchema(Resource) * @see #setSchema(Resource)
* @see #setSchemas(Resource[]) * @see #setSchemas(Resource[])
* @see #setMarshallerListener(Marshaller.Listener) * @see #setMarshallerListener(javax.xml.bind.Marshaller.Listener)
* @see #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener) * @see #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener)
* @see #setAdapters(XmlAdapter[]) * @see #setAdapters(XmlAdapter[])
* @since 3.0 * @since 3.0
@ -178,11 +178,11 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, BeanCl
* Set the JAXB <code>Marshaller</code> properties. These properties will be set on the * Set the JAXB <code>Marshaller</code> properties. These properties will be set on the
* underlying JAXB <code>Marshaller</code>, and allow for features such as indentation. * underlying JAXB <code>Marshaller</code>, and allow for features such as indentation.
* @param properties the properties * @param properties the properties
* @see Marshaller#setProperty(String,Object) * @see javax.xml.bind.Marshaller#setProperty(String,Object)
* @see Marshaller#JAXB_ENCODING * @see javax.xml.bind.Marshaller#JAXB_ENCODING
* @see Marshaller#JAXB_FORMATTED_OUTPUT * @see javax.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
* @see Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION * @see javax.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
* @see Marshaller#JAXB_SCHEMA_LOCATION * @see javax.xml.bind.Marshaller#JAXB_SCHEMA_LOCATION
*/ */
public void setMarshallerProperties(Map<String, Object> properties) { public void setMarshallerProperties(Map<String, Object> properties) {
this.marshallerProperties = properties; this.marshallerProperties = properties;
@ -424,8 +424,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, BeanCl
* Gets called after creation of JAXB <code>Marshaller</code>, and after the respective properties have been set. * Gets called after creation of JAXB <code>Marshaller</code>, and after the respective properties have been set.
* <p>The default implementation sets the {@link #setMarshallerProperties(Map) defined properties}, the {@link * <p>The default implementation sets the {@link #setMarshallerProperties(Map) defined properties}, the {@link
* #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[]) * #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[])
* schemas}, {@link #setMarshallerListener(Marshaller.Listener) listener}, and {@link #setAdapters(XmlAdapter[]) * schemas}, {@link #setMarshallerListener(javax.xml.bind.Marshaller.Listener) listener}, and
* adapters}. * {@link #setAdapters(XmlAdapter[]) adapters}.
*/ */
protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException { protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException {
if (this.marshallerProperties != null) { if (this.marshallerProperties != null) {
@ -509,8 +509,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, BeanCl
* Gets called after creation of JAXB <code>Marshaller</code>, and after the respective properties have been set. * Gets called after creation of JAXB <code>Marshaller</code>, and after the respective properties have been set.
* <p>The default implementation sets the {@link #setUnmarshallerProperties(Map) defined properties}, the {@link * <p>The default implementation sets the {@link #setUnmarshallerProperties(Map) defined properties}, the {@link
* #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[]) * #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[])
* schemas}, {@link #setUnmarshallerListener(Unmarshaller.Listener) listener}, and {@link #setAdapters(XmlAdapter[]) * schemas}, {@link #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener) listener}, and
* adapters}. * {@link #setAdapters(XmlAdapter[]) adapters}.
*/ */
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException { protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException {
if (this.unmarshallerProperties != null) { if (this.unmarshallerProperties != null) {

View File

@ -28,13 +28,13 @@ import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter; import javax.xml.stream.XMLStreamWriter;
import org.apache.xmlbeans.XMLStreamValidationException;
import org.apache.xmlbeans.XmlError; import org.apache.xmlbeans.XmlError;
import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions; import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlSaxHandler; import org.apache.xmlbeans.XmlSaxHandler;
import org.apache.xmlbeans.XmlValidationError; import org.apache.xmlbeans.XmlValidationError;
import org.apache.xmlbeans.XMLStreamValidationException;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
@ -47,11 +47,11 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler; import org.xml.sax.ext.LexicalHandler;
import org.springframework.oxm.Marshaller; import org.springframework.oxm.Marshaller;
import org.springframework.oxm.MarshallingFailureException;
import org.springframework.oxm.UncategorizedMappingException;
import org.springframework.oxm.UnmarshallingFailureException;
import org.springframework.oxm.ValidationFailureException; import org.springframework.oxm.ValidationFailureException;
import org.springframework.oxm.XmlMappingException; import org.springframework.oxm.XmlMappingException;
import org.springframework.oxm.MarshallingFailureException;
import org.springframework.oxm.UnmarshallingFailureException;
import org.springframework.oxm.UncategorizedMappingException;
import org.springframework.oxm.support.AbstractMarshaller; import org.springframework.oxm.support.AbstractMarshaller;
import org.springframework.util.xml.StaxUtils; import org.springframework.util.xml.StaxUtils;
@ -63,7 +63,7 @@ import org.springframework.util.xml.StaxUtils;
* *
* <p>Unmarshalled objects can be validated by setting the <code>validating</code> property, * <p>Unmarshalled objects can be validated by setting the <code>validating</code> property,
* or by calling the {@link #validate(XmlObject)} method directly. Invalid objects will * or by calling the {@link #validate(XmlObject)} method directly. Invalid objects will
* result in an {@link XmlBeansValidationFailureException}. * result in an {@link ValidationFailureException}.
* *
* <p><b>NOTE:</b> Due to the nature of XMLBeans, this marshaller requires * <p><b>NOTE:</b> Due to the nature of XMLBeans, this marshaller requires
* all passed objects to be of type {@link XmlObject}. * all passed objects to be of type {@link XmlObject}.
@ -257,7 +257,7 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
/** /**
* Validate the given <code>XmlObject</code>. * Validate the given <code>XmlObject</code>.
* @param object the xml object to validate * @param object the xml object to validate
* @throws XmlBeansValidationFailureException if the given object is not valid * @throws ValidationFailureException if the given object is not valid
*/ */
protected void validate(XmlObject object) throws ValidationFailureException { protected void validate(XmlObject object) throws ValidationFailureException {
if (isValidating() && object != null) { if (isValidating() && object != null) {