public class XMLBinding extends AbstractBinding
Modifier and Type | Class and Description |
---|---|
protected static class |
XMLBinding.RootNodeSerializer |
Modifier and Type | Field and Description |
---|---|
protected ModelSet |
beanModelSet |
protected List<XMLElementSerializationNode> |
graphs |
protected boolean |
omitXMLDeclaration |
protected Set<QName> |
rootElementNames |
protected Map<Class,XMLBinding.RootNodeSerializer> |
serializers |
allConfigsAdded, initialized, reportPath, smooks
Constructor and Description |
---|
XMLBinding()
Public constructor.
|
XMLBinding(org.smooks.Smooks smooks)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
XMLBinding |
add(InputStream smooksConfigStream)
Add Smooks binding configurations to the binding instance.
|
XMLBinding |
add(String smooksConfigURI)
Add Smooks binding configurations to the binding instance.
|
protected void |
addNamespaceAttributes(XMLElementSerializationNode serializer) |
protected void |
assertSelectorOK(org.smooks.api.resource.config.ResourceConfig resourceConfig) |
protected XMLSerializationNode |
constructNodePath(org.smooks.api.resource.config.xpath.SelectorPath selectorPath,
List<XMLElementSerializationNode> graphRoots) |
protected List<XMLElementSerializationNode> |
createExpandedXMLOutputGraphs(org.smooks.api.resource.config.ResourceConfigSeq resourceConfigSeq) |
protected void |
createRootSerializers(List<XMLElementSerializationNode> graphs) |
protected XMLSerializationNode |
findNode(List<XMLElementSerializationNode> graphs,
org.smooks.api.resource.config.xpath.SelectorPath selectorPath) |
<T> T |
fromXML(org.smooks.api.io.Source inputSource,
Class<T> toType)
Bind from the XML into the Java Object model.
|
<T> T |
fromXML(String inputSource,
Class<T> toType)
Bind from the XML into the Java Object model.
|
XMLBinding |
initialise()
Initialize the binding instance.
|
protected void |
merge(XMLElementSerializationNode serializer,
Bean bean) |
protected void |
mergeBeanModelsIntoXMLGraphs() |
XMLBinding |
setOmitXMLDeclaration(boolean omitXMLDeclaration)
Turn on/off outputting of the XML declaration when executing the
toXML(Object, java.io.Writer) method. |
XMLBinding |
setReportPath(String reportPath)
Set the execution report output path.
|
String |
toXML(Object object)
Write the supplied Object instance to XML.
|
<W extends Writer> |
toXML(Object object,
W outputWriter)
Write the supplied Object instance to XML.
|
addToContextualGetter, assertInitialized, assertNotAllConfigsAdded, assertNotInitialized, bind, constructContextualGetter, constructContextualGetter, getSmooks, getUserDefinedResourceList
protected ModelSet beanModelSet
protected List<XMLElementSerializationNode> graphs
protected final Map<Class,XMLBinding.RootNodeSerializer> serializers
protected boolean omitXMLDeclaration
public XMLBinding()
add(java.io.InputStream)
(or add(String)
) method
and then the initialise()
method.public XMLBinding(org.smooks.Smooks smooks)
smooks
- The pre-configured Smooks instance.public XMLBinding add(String smooksConfigURI) throws IOException, SAXException
AbstractBinding
add
in class AbstractBinding
smooksConfigURI
- Smooks configuration.IOException
- Error reading resource stream.SAXException
- Error parsing the resource stream.public XMLBinding add(InputStream smooksConfigStream) throws IOException, SAXException
AbstractBinding
add
in class AbstractBinding
smooksConfigStream
- Smooks configuration.IOException
- Error reading resource stream.SAXException
- Error parsing the resource stream.public XMLBinding setReportPath(String reportPath)
AbstractBinding
setReportPath
in class AbstractBinding
reportPath
- The execution report output path.public XMLBinding initialise()
AbstractBinding
initialise
in class AbstractBinding
public XMLBinding setOmitXMLDeclaration(boolean omitXMLDeclaration)
toXML(Object, java.io.Writer)
method.omitXMLDeclaration
- True if the order is to be omitted, otherwise false.this
instance.public <T> T fromXML(String inputSource, Class<T> toType)
T
- The Java type to which the XML data is to be bound.inputSource
- The XML input.toType
- The Java type to which the XML data is to be bound.public <T> T fromXML(org.smooks.api.io.Source inputSource, Class<T> toType) throws IOException
T
- The Java type to which the XML data is to be bound.inputSource
- The XML input.toType
- The Java type to which the XML data is to be bound.IOException
public <W extends Writer> W toXML(Object object, W outputWriter) throws BeanSerializationException, IOException
W
- The Writer type.object
- The Object instance.outputWriter
- The output writer.Writer
instance}.BeanSerializationException
- Error serializing the bean.IOException
- Error writing to the supplied Writer instance.public String toXML(Object object) throws BeanSerializationException
toXML(Object, java.io.Writer)
method.object
- The Object instance.BeanSerializationException
- Error serializing the bean.protected void mergeBeanModelsIntoXMLGraphs()
protected void merge(XMLElementSerializationNode serializer, Bean bean)
protected void createRootSerializers(List<XMLElementSerializationNode> graphs)
protected void addNamespaceAttributes(XMLElementSerializationNode serializer)
protected List<XMLElementSerializationNode> createExpandedXMLOutputGraphs(org.smooks.api.resource.config.ResourceConfigSeq resourceConfigSeq)
protected XMLSerializationNode constructNodePath(org.smooks.api.resource.config.xpath.SelectorPath selectorPath, List<XMLElementSerializationNode> graphRoots)
protected XMLSerializationNode findNode(List<XMLElementSerializationNode> graphs, org.smooks.api.resource.config.xpath.SelectorPath selectorPath)
protected void assertSelectorOK(org.smooks.api.resource.config.ResourceConfig resourceConfig)
Copyright © 2024. All rights reserved.