|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmagoffin.matt.ma2.util.XmlHelper
public class XmlHelper
Utility class for working with XML data.
com.sun.xml.bind.namespacePrefixMapper
property.
| Constructor Summary | |
|---|---|
XmlHelper()
|
|
| Method Summary | |
|---|---|
void |
debugJaxbObject(java.lang.String notice,
java.lang.Object jaxbObject,
org.apache.log4j.Logger aLog)
Marshal a JAXB object as XML to the specifiec Logger. |
void |
debugXml(java.lang.String notice,
javax.xml.transform.Source xml,
org.apache.log4j.Logger aLog)
Debug an XML Source to a Logger. |
java.lang.Object |
evaluateXPath(java.lang.Object object,
java.lang.String xpath,
javax.xml.namespace.QName returnType)
Evaluate an XPath expression and return the result. |
org.w3c.dom.Document |
getDocument(org.xml.sax.InputSource xmlSource)
Get a Document object from an XML InputSource. |
org.w3c.dom.Document |
getDocument(java.io.InputStream xmlInput)
Get a Document object from an XML data stream. |
org.w3c.dom.Document |
getDocument(java.lang.String xml)
Get a Document object from an XML string. |
javax.xml.parsers.DocumentBuilderFactory |
getDocumentBuilderFactory()
|
javax.xml.bind.JAXBContext |
getJaxbContext()
|
javax.xml.bind.Marshaller |
getMarshaller()
Get a JAXB Marshaller, configured for our context. |
java.util.Map<java.lang.String,java.lang.String> |
getMarshallerProperties()
|
org.w3c.dom.Document |
getNewDocument()
Get a new Document instance. |
ObjectFactory |
getObjectFactory()
|
net.sf.ehcache.Ehcache |
getSchemaCache()
|
javax.xml.validation.Schema |
getSchemaFromResource(org.springframework.core.io.Resource schemaResource)
Get a Schema, possibly from cache. |
javax.xml.transform.TransformerFactory |
getTransformerFactory()
|
java.lang.String |
getXmlString(java.io.InputStream xmlInput)
Get XML data as a String. |
javax.xml.xpath.XPathFactory |
getXpathFactory()
|
javax.xml.namespace.NamespaceContext |
getXpathNamespaceContext()
|
void |
init()
Initialize this instance. |
void |
setDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)
|
void |
setJaxbContext(javax.xml.bind.JAXBContext jaxbContext)
|
void |
setMarshallerProperties(java.util.Map<java.lang.String,java.lang.String> marshallerProperties)
|
void |
setObjectFactory(ObjectFactory objectFactory)
|
void |
setSchemaCache(net.sf.ehcache.Ehcache schemaCache)
|
void |
setTransformerFactory(javax.xml.transform.TransformerFactory transformerFactory)
|
void |
setXpathFactory(javax.xml.xpath.XPathFactory xpathFactory)
|
void |
setXpathNamespaceContext(javax.xml.namespace.NamespaceContext xpathNamespaceContext)
|
void |
transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result)
Perform an copy transformation (copy XML from source to result). |
void |
transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result,
java.util.Map<java.lang.String,?> xsltParameters)
Perform an copy transformation (copy XML from source to result). |
void |
transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result,
javax.xml.transform.Templates xslt)
Perform an XSLT transformation. |
void |
transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result,
javax.xml.transform.Templates xslt,
java.util.Map<java.lang.String,?> xsltParameters)
Perform an XSLT transformation with parameters. |
void |
validateXml(javax.xml.transform.Source xml,
org.springframework.core.io.Resource schemaResource)
Validate XLM against a schema. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlHelper()
| Method Detail |
|---|
public void init()
This method should be called after setting all properties and before using any (non-property) methods.
public java.lang.Object evaluateXPath(java.lang.Object object,
java.lang.String xpath,
javax.xml.namespace.QName returnType)
object - - The starting context.xpath - - The XPath expression.returnType - - The desired return type.
public javax.xml.bind.Marshaller getMarshaller()
throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException - if a JAXB exception occurs
public void debugJaxbObject(java.lang.String notice,
java.lang.Object jaxbObject,
org.apache.log4j.Logger aLog)
notice - a string to prefix the output XML withjaxbObject - the JAXB object to debugaLog - the Logger to log to
public void debugXml(java.lang.String notice,
javax.xml.transform.Source xml,
org.apache.log4j.Logger aLog)
Note the XML will only be serialized if the log
has DEBUG level enabled.
notice - a string to prefix the output XML withxml - the XML Source to debugaLog - the Logger to log to
public void transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result)
This method can be used to serialize DOM or JAXB sources to an XML String.
source - the XML sourceresult - the XML result
public void transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result,
java.util.Map<java.lang.String,?> xsltParameters)
This method can be used to serialize DOM or JAXB sources to an XML String.
source - the XML sourceresult - the XML resultxsltParameters - optional XSLT parameters
public void transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result,
javax.xml.transform.Templates xslt)
source - the XML sourceresult - the XML resultxslt - the XSLT to transform with
public void transformXml(javax.xml.transform.Source source,
javax.xml.transform.Result result,
javax.xml.transform.Templates xslt,
java.util.Map<java.lang.String,?> xsltParameters)
source - the XML sourceresult - the XML resultxslt - the XSLT to transform withxsltParameters - optional XSLT parameters to setpublic org.w3c.dom.Document getNewDocument()
public org.w3c.dom.Document getDocument(java.io.InputStream xmlInput)
xmlInput - the XML data stream
public org.w3c.dom.Document getDocument(org.xml.sax.InputSource xmlSource)
xmlSource - the XML data
public org.w3c.dom.Document getDocument(java.lang.String xml)
xml - the XML string
public java.lang.String getXmlString(java.io.InputStream xmlInput)
This method exists to validate the input XML is valid.
xmlInput - the XML data stream
public void validateXml(javax.xml.transform.Source xml,
org.springframework.core.io.Resource schemaResource)
throws org.xml.sax.SAXException
xml - the XML to validateschemaResource - the schema to validate against
org.xml.sax.SAXException - if an XML validation error occurs
public javax.xml.validation.Schema getSchemaFromResource(org.springframework.core.io.Resource schemaResource)
throws java.io.IOException
schemaResource - the resource to get the Schema object ffrom
java.io.IOException - if an IO error occurspublic javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
public void setDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)
documentBuilderFactory - the documentBuilderFactory to setpublic javax.xml.bind.JAXBContext getJaxbContext()
public void setJaxbContext(javax.xml.bind.JAXBContext jaxbContext)
jaxbContext - the jaxbContext to setpublic java.util.Map<java.lang.String,java.lang.String> getMarshallerProperties()
public void setMarshallerProperties(java.util.Map<java.lang.String,java.lang.String> marshallerProperties)
marshallerProperties - the marshallerProperties to setpublic ObjectFactory getObjectFactory()
public void setObjectFactory(ObjectFactory objectFactory)
objectFactory - the objectFactory to setpublic javax.xml.transform.TransformerFactory getTransformerFactory()
public void setTransformerFactory(javax.xml.transform.TransformerFactory transformerFactory)
transformerFactory - the transformerFactory to setpublic javax.xml.xpath.XPathFactory getXpathFactory()
public void setXpathFactory(javax.xml.xpath.XPathFactory xpathFactory)
xpathFactory - the xpathFactory to setpublic javax.xml.namespace.NamespaceContext getXpathNamespaceContext()
public void setXpathNamespaceContext(javax.xml.namespace.NamespaceContext xpathNamespaceContext)
xpathNamespaceContext - the xpathNamespaceContext to setpublic net.sf.ehcache.Ehcache getSchemaCache()
public void setSchemaCache(net.sf.ehcache.Ehcache schemaCache)
schemaCache - the schemaCache to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||