|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -218,7 +218,8 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe |
|
|
|
if (this.targetClass != null) { |
|
|
|
if (this.targetClass != null) { |
|
|
|
if (StringUtils.hasLength(this.bindingName)) { |
|
|
|
if (StringUtils.hasLength(this.bindingName)) { |
|
|
|
if (logger.isInfoEnabled()) { |
|
|
|
if (logger.isInfoEnabled()) { |
|
|
|
logger.info("Configured for target class [" + this.targetClass + "] using binding [" + this.bindingName + "]"); |
|
|
|
logger.info("Configured for target class [" + this.targetClass + |
|
|
|
|
|
|
|
"] using binding [" + this.bindingName + "]"); |
|
|
|
} |
|
|
|
} |
|
|
|
this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetClass); |
|
|
|
this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetClass); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -230,11 +231,12 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (this.targetPackage != null) { |
|
|
|
else if (this.targetPackage != null) { |
|
|
|
if (!StringUtils.hasLength(bindingName)) { |
|
|
|
if (!StringUtils.hasLength(this.bindingName)) { |
|
|
|
bindingName = DEFAULT_BINDING_NAME; |
|
|
|
this.bindingName = DEFAULT_BINDING_NAME; |
|
|
|
} |
|
|
|
} |
|
|
|
if (logger.isInfoEnabled()) { |
|
|
|
if (logger.isInfoEnabled()) { |
|
|
|
logger.info("Configured for target package [" + this.targetPackage + "] using binding [" + this.bindingName + "]"); |
|
|
|
logger.info("Configured for target package [" + this.targetPackage + |
|
|
|
|
|
|
|
"] using binding [" + this.bindingName + "]"); |
|
|
|
} |
|
|
|
} |
|
|
|
this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetPackage); |
|
|
|
this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetPackage); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -290,9 +292,10 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void marshalDocument(IMarshallingContext marshallingContext, Object graph) throws IOException, JiBXException { |
|
|
|
private void marshalDocument(IMarshallingContext marshallingContext, Object graph) throws IOException, JiBXException { |
|
|
|
if (StringUtils.hasLength(docTypeRootElementName)) { |
|
|
|
if (StringUtils.hasLength(this.docTypeRootElementName)) { |
|
|
|
IXMLWriter xmlWriter = marshallingContext.getXmlWriter(); |
|
|
|
IXMLWriter xmlWriter = marshallingContext.getXmlWriter(); |
|
|
|
xmlWriter.writeDocType(docTypeRootElementName, docTypeSystemId, docTypePublicId, docTypeInternalSubset); |
|
|
|
xmlWriter.writeDocType(this.docTypeRootElementName, this.docTypeSystemId, |
|
|
|
|
|
|
|
this.docTypePublicId, this.docTypeInternalSubset); |
|
|
|
} |
|
|
|
} |
|
|
|
marshallingContext.marshalDocument(graph); |
|
|
|
marshallingContext.marshalDocument(graph); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -391,7 +394,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe |
|
|
|
protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException { |
|
|
|
protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException { |
|
|
|
try { |
|
|
|
try { |
|
|
|
IUnmarshallingContext unmarshallingContext = createUnmarshallingContext(); |
|
|
|
IUnmarshallingContext unmarshallingContext = createUnmarshallingContext(); |
|
|
|
return unmarshallingContext.unmarshalDocument(inputStream, encoding); |
|
|
|
return unmarshallingContext.unmarshalDocument(inputStream, this.encoding); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (JiBXException ex) { |
|
|
|
catch (JiBXException ex) { |
|
|
|
throw convertJibxException(ex, false); |
|
|
|
throw convertJibxException(ex, false); |
|
|
|
|