public interface XMLSupport
Modifier and Type | Method and Description |
---|---|
void |
addAttributeToElements(Message msg,
String exprn,
String qName,
String nsUri,
String value,
String[]... ns)
Add an attribute to one or more elements selected by an XPath expression
e.g.
|
void |
addElementsAsChild(Message msg,
String expression,
String qualifiedTagName,
String namespace,
String[]... ns)
Inserts Element as a child to the specified elements pointed by an xpath expression
|
void |
addTextElementsAsChild(Message msg,
String expression,
String qualifiedTagName,
String namespace,
String elementContent,
String[]... ns)
Inserts Text Element as a child to the specified elements pointed by an xpath expression
|
void |
aggregateWithBean(String beanName,
Message msg)
Aggregate message using the Split-Aggregation Spring bean configuration
|
void |
convertDOMToSoap11(Message m)
Converts a DOM message to SOAP 1.1 by wrapping the message in a SOAP envelope and body
|
void |
convertDOMToSoap12(Message m)
Converts a DOM message to SOAP 1.2 by wrapping the message in a SOAP envelope and body
|
void |
convertFromFI(Message m)
Convert the payload of the current message from a FastInfoset binary to an XML message
(Note the XML payload is still kept as a RawFileMessage by default and maybe converted into a DOM message if required)
|
void |
convertSoapToDOM(Message m)
Converts a SOAP message to DOM (POX) by stripping out the SOAP Envelope and Body and Header
|
void |
convertToDOM(Message m)
Convert the current message into a DOMMessage
|
void |
convertToFI(Message m)
Convert the XML message into a FastInfoset binary message
|
<T> T |
convertXMLToJAXBObject(Message msg,
Class<? extends T> clazz)
Converts a XML payload into a JAXB Object.
|
<T> T |
convertXMLToJAXBObject(Message msg,
String contextPath,
Class<? extends T> clazz)
Converts a XML payload into a JAXB Object.
|
void |
convertXMLToJSONStream(Message m)
Convert the current XML message payload (which maybe available as any format such as raw file or DOM etc)
into a file based JSON stream
|
void |
convertXMLToJSONStream(Message m,
QName staringElement,
boolean retainNSPrefixes)
Convert the current XML message payload (which maybe available as any format such as raw file or DOM etc)
into a file based JSON stream
|
Document |
createDOMDocument()
Create a new DOM Document object and return
|
void |
deleteAttributes(Message msg,
String exprn,
String[]... ns)
Deletes the specified attribute/s
e.g.
|
void |
deleteElements(Message msg,
String expression,
String[]... ns)
Delete Elements pointed by an xpath expression
|
NodeList |
extractAsNodeListUsingXPath(Message m,
String exprn,
String[]... ns)
Evaluate the given XPath expression against the XML payload, and return result as a NodeList
This method converts the current payload into a DOMMessage
|
NodeList |
extractAsNodeListUsingXPath(Node n,
String exprn,
String[]... ns) |
String |
extractAsStringUsingXPath(Message m,
String exprn,
String[]... ns)
Evaluate the given XPath expression against the XML payload, and return result as a String
This method converts the current payload into a DOMMessage
|
String |
extractAsStringUsingXPath(Node n,
String exprn,
String[]... ns)
Evaluate the given XPath expression against the DOM node, and return result as a String
|
String |
extractAsStringUsingXPath(String s,
String exprn,
String[]... ns)
Evaluate the given XPath expression against the XML payload contained in a String, and return result as a String.
|
boolean |
filter(Message m,
String exprn,
String[]... ns)
Evaluate the given boolean XPath expression over the XML payload
|
boolean |
filter(Message m,
String exprn,
String regex,
String[]... ns)
Evaluate the given XPath expression over the XML payload and compare the resulting String value with the
regular expression for a match.
|
String |
getAttribute(Message msg,
String exprn,
String[]... ns)
Get attribute value e.g.
|
Document |
getPayloadAsDOM(Message m)
Returns payload of the message as a DOM Document
|
String |
getTextElement(Message msg,
String exprn,
String[]... ns)
Get text element value for given XPath
|
void |
insertTextElementsAfter(Message msg,
String expression,
String qualifiedTagName,
String namespace,
String elementContent,
String[]... ns)
Inserts an element/elements after the specified element pointed by the XPATH, to the current message.
|
void |
insertTextElementsBefore(Message msg,
String expression,
String qualifiedTagName,
String namespace,
String elementContent,
String[]... ns)
Inserts an element/elements before the specified element pointed by the XPATH, to the current message.
|
void |
mergeXMLAttachmentsUnderElement(Message msg,
String rootElemName)
Replace the current XML payload with a top level element as specified, and merge the payloads
from the current body, and attachments underneath that
|
void |
mergeXMLAttachmentsUnderElement(Message msg,
String rootElemName,
String rootNS)
Replace the current XML payload with a top level element as specified, and merge the payloads
from the current body, and attachments underneath that
|
boolean |
remove(Message m,
String exprn,
String[]... ns)
Remove the XPath expression specified node from the XML payload.
|
void |
replaceAttributes(Message msg,
String expression,
String value,
String[]... ns)
Replaces the specified attribute/s value
|
void |
replaceTextElements(Message msg,
String expression,
String elementContent,
String[]... ns)
Replace Text Elements pointed by an xpath expression
|
void |
retainElementAsPayload(Message m,
String exprn,
String[]... ns)
Replace the current XML payload with the resulting element from the XPath expression result
|
void |
serializeJAXBObjectAsXMLStream(Message msg,
Object jaxb)
Serialize a JAXB Object as a XML Stream message
|
void |
serializeJAXBObjectAsXMLStream(Message msg,
Object jaxb,
String rootElement,
String uri)
Serialize a JAXB Object as a XML Stream message
|
void |
serializeJAXBObjectAsXMLStream(Message msg,
String contextPath,
Object jaxb)
Serialize a JAXB Object as a XML Stream message
|
void |
serializeJAXBObjectAsXMLStream(Message msg,
String contextPath,
Object jaxb,
String rootElement,
String uri)
Serialize a JAXB Object as a XML Stream message
|
void |
setPayloadFromDOM(Message m,
Document doc)
Set the payload of the message with the DOM Document
|
void |
splitAndProcess(Message msg,
String exprn,
String sequenceName,
boolean ignoreErrors,
String[]... ns)
Split current message into multiple messages using the given XPath expression, and hand over each such
message to the given sequence
|
void |
splitWithBean(String beanName,
Message msg)
Split message using the Split-Aggregation Spring bean configuration
|
void |
transform(Message msg,
String xsltFilename)
Transform the message payload by XSLT (without any parameters), assuming a non DOM result and assuming that the
complete message payload will be used as the source of the transformation, and the result will replace the
complete message payload
|
void |
transform(Message msg,
String xsltFilename,
String exprn,
boolean domResult,
Map<String,Object> parameters,
String[]... ns)
Transform the message payload by XSLT
|
void |
transform(Message msg,
String xsltFilename,
String exprn,
String[]... ns)
Transform the message payload by XSLT (without any parameters), assuming a non DOM result
|
void |
validate(Message m,
String... schemas)
Validate the current message against one or more schemas
If validation failed, this will throw a
BusRuntimeException with details of the XSD validation failures |
void |
validate(Message m,
String[] schemas,
String exprn,
String[]... ns)
Validate the current message - or an element of it selected via an XPath expression - against one or more schemas
If validation failed, this will throw a
BusRuntimeException with details of the XSD validation failures |
void |
validate(Node n,
String... schemas)
Validate the given String against one or more schemas
If validation failed, this will throw a
BusRuntimeException with details of the XSD validation failures |
void |
validate(String s,
String... schemas)
Validate the given String against one or more schemas
If validation failed, this will throw a
BusRuntimeException with details of the XSD validation failures |
void |
validateAll(Message m,
String[] schemas,
String exprn,
String[]... ns)
Validate the current message - or all elements of it selected via an XPath expression - against one or more schemas
If validation failed, this will throw a
BusRuntimeException with details of the XSD validation failures |
void |
wrapPayload(Message msg,
String elementName,
String namespace)
Wrap the XML payload with an outer element
|
Document createDOMDocument()
void setPayloadFromDOM(Message m, Document doc)
m
- the current message whose payload will be set with the DOM messagedoc
- the DOM document to be inserted as the payloadDocument getPayloadAsDOM(Message m)
m
- the current message to be passedvoid convertToDOM(Message m)
m
- the current message to be transformedvoid convertFromFI(Message m)
m
- the current message to be transformedvoid convertToFI(Message m)
m
- the current message to be transformedvoid convertDOMToSoap11(Message m)
m
- the current message to be processedvoid convertDOMToSoap12(Message m)
m
- the current message to be processedvoid convertSoapToDOM(Message m)
m
- the current message containing a SOAP payload to convert to DOM/POXvoid convertXMLToJSONStream(Message m, QName staringElement, boolean retainNSPrefixes)
m
- the message to be convertedstaringElement
- an optional starting element to begin conversion (e.g. first element of the SOAP body)retainNSPrefixes
- retain the namespace prefixes into JSON names for elementsvoid convertXMLToJSONStream(Message m)
m
- the message to be convertedvoid retainElementAsPayload(Message m, String exprn, String[]... ns)
m
- the current messageexprn
- XPath expression selecting the node to retainns
- optional namespaces arrayvoid mergeXMLAttachmentsUnderElement(Message msg, String rootElemName)
msg
- the message to transformrootElemName
- the new root element createdvoid mergeXMLAttachmentsUnderElement(Message msg, String rootElemName, String rootNS)
msg
- the message to transformrootElemName
- the new root element createdrootNS
- optional namespace for the root element, or nullvoid validate(Message m, String[] schemas, String exprn, String[]... ns)
BusRuntimeException
with details of the XSD validation failuresm
- the message holding the payload for validationschemas
- an array of XSD filename to validate against.
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise you may end up with
an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration of element"exprn
- an optional XPath expression selecting the node for validationns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid validate(Message m, String... schemas)
BusRuntimeException
with details of the XSD validation failuresm
- the message holding the payload for validationschemas
- an array of XSD filename to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise you may end up with
an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration of element"void validate(String s, String... schemas)
BusRuntimeException
with details of the XSD validation failuress
- the XML stringschemas
- an array of XSD filename to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise you may end up with
an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration of element"void validate(Node n, String... schemas)
BusRuntimeException
with details of the XSD validation failuresn
- the DOM Node containing the XML to be validatedschemas
- an array of XSD filename to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise you may end up with
an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration of element"void validateAll(Message m, String[] schemas, String exprn, String[]... ns)
BusRuntimeException
with details of the XSD validation failuresm
- the message holding the payload for validationschemas
- an array of XSD filename to validate against.
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise you may end up with
an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration of element"exprn
- an optional XPath expression selecting the nodes for validationns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid transform(Message msg, String xsltFilename, String exprn, boolean domResult, Map<String,Object> parameters, String[]... ns)
msg
- current messagexsltFilename
- the XSLT filenameexprn
- an optional XPath expression to select the source node for XSLT, and node to replace with the resultdomResult
- is the result desired as a DOM payload? (useful for further XML processing)parameters
- any XSLT parameters to be passed to the transformationns
- an optional array of namespace prefixes and namespace urlsvoid transform(Message msg, String xsltFilename, String exprn, String[]... ns)
msg
- current messagexsltFilename
- the XSLT filenameexprn
- an optional XPath expression to select the source node for XSLT, and node to replace with the resultns
- an optional array of namespace prefixes and namespace urlsvoid transform(Message msg, String xsltFilename)
msg
- current messagexsltFilename
- the XSLT filenameboolean filter(Message m, String exprn, String regex, String[]... ns)
m
- the current messageexprn
- the XPath expression to evaluate against the message payloadregex
- an optional regular expression to evaluate the XPath results' String value againstns
- an optional array of namespace prefixes and namespace urlsboolean filter(Message m, String exprn, String[]... ns)
m
- the current messageexprn
- the XPath expression to evaluate against the message payloadns
- an optional array of namespace prefixes and namespace urlsvoid addAttributeToElements(Message msg, String exprn, String qName, String nsUri, String value, String[]... ns)
msg
- the message where the transformation is performedexprn
- the xpath expression to select the elements where the attribute should be addedqName
- the qualified name for the new attribute. To specify a custom prefix use it here (e.g. "myns:myqname")nsUri
- the namespace URI for the new attribute, or null (to specify a custom prefix, see qName above)value
- the new value of the attributens
- an optional array of namespace prefixes and namespaces used within the XPath expressionString getAttribute(Message msg, String exprn, String[]... ns)
msg
- the message to read the attribute fromexprn
- the xpath expression to the element where the attribute should be addedns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid deleteAttributes(Message msg, String exprn, String[]... ns)
msg
- the current message containing the payloadexprn
- the xpath expression to the attributes, which are to be deletedns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid replaceAttributes(Message msg, String expression, String value, String[]... ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the attribute, which is to be replacedvalue
- the new value of the attributens
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid addTextElementsAsChild(Message msg, String expression, String qualifiedTagName, String namespace, String elementContent, String[]... ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the node/s, which will be the parent for the new node/squalifiedTagName
- the qualified name of the new element to be addednamespace
- an optional String specifying the namespace url of the new elementelementContent
- the text content of the new elementns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid addElementsAsChild(Message msg, String expression, String qualifiedTagName, String namespace, String[]... ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the node/s, which will be the parent for the new node/squalifiedTagName
- the qualified name of the new element to be addednamespace
- an optional String specifying the namespace url of the new elementns
- an optional array of namespace prefixes and namespaces used within the XPath expressionString getTextElement(Message msg, String exprn, String[]... ns)
msg
- the message to read the attribute fromexprn
- the xpath expression to the element where the text content should be readns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid replaceTextElements(Message msg, String expression, String elementContent, String[]... ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the text elements to be replacedelementContent
- the text content of the new element/sns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid deleteElements(Message msg, String expression, String[]... ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the text elements to be replacedns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid insertTextElementsBefore(Message msg, String expression, String qualifiedTagName, String namespace, String elementContent, String[]... ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the node, where the new element should be added beforequalifiedTagName
- the qualified tag name of the new element to be addednamespace
- namespace uri for the new tagelementContent
- the content of the new elementns
- an optional array of namespace prefixes and namespaces used within the XPath expressionvoid insertTextElementsAfter(Message msg, String expression, String qualifiedTagName, String namespace, String elementContent, String[]... ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the node, where the new element should be added afterqualifiedTagName
- the qualified tag name of the new element to be addednamespace
- namespace uri for the new tagelementContent
- the content of the new elementns
- an optional array of namespace prefixes and namespaces used within the XPath expressionboolean remove(Message m, String exprn, String[]... ns)
m
- the current messageexprn
- the XPath expression to evaluate against the message payloadns
- an optional array of namespace prefixes and namespace urlsString extractAsStringUsingXPath(Message m, String exprn, String[]... ns)
m
- the current messageexprn
- the XPath expression to evaluate against the message payloadns
- an optional array of namespace prefixes and namespace urlsString extractAsStringUsingXPath(String s, String exprn, String[]... ns)
#extractAsStringUsingXPath(org.w3c.dom.Node, String, String[]...)
instead of this method as that will be
much more performance friendlys
- a String containing an XML payloadexprn
- the XPath expression to evaluate against the XML payloadns
- an optional array of namespace prefixes and namespace urlsString extractAsStringUsingXPath(Node n, String exprn, String[]... ns)
n
- DOM node to be subjected to the evaluationexprn
- the XPath expression to evaluate against the DOM nodens
- an optional array of namespace prefixes and namespace urlsNodeList extractAsNodeListUsingXPath(Message m, String exprn, String[]... ns)
m
- the current messageexprn
- the XPath expression to evaluate against the message payloadns
- an optional array of namespace prefixes and namespace urlsNodeList extractAsNodeListUsingXPath(Node n, String exprn, String[]... ns)
void splitAndProcess(Message msg, String exprn, String sequenceName, boolean ignoreErrors, String[]... ns) throws Exception
msg
- the current message to be split and processedexprn
- the XPath expression to split the message atsequenceName
- the sequence to invoke on each resulting messageignoreErrors
- ignore any errors encountered during sequence executionns
- name spaces usedException
- if the invoked sequence throws an exception<T> T convertXMLToJAXBObject(Message msg, Class<? extends T> clazz)
msg
- the current message to read the payload fromclazz
- the JAXB class to convert the payload intovoid serializeJAXBObjectAsXMLStream(Message msg, Object jaxb, String rootElement, String uri)
msg
- the current message to write the Object into as a XML streamjaxb
- the JAXB Object to serializerootElement
- root element local name for serializationuri
- namespace uri for the root elementvoid serializeJAXBObjectAsXMLStream(Message msg, Object jaxb)
msg
- the current message to write the Object into as a SOAP 1.1 streamjaxb
- the JAXB Object to serialize<T> T convertXMLToJAXBObject(Message msg, String contextPath, Class<? extends T> clazz)
msg
- the current message to read the payload fromcontextPath
- a list of colon separated java package names that contain schema-derived classes
and/or fully qualified JAXB-annotated classesclazz
- the JAXB class to convert the payload intovoid serializeJAXBObjectAsXMLStream(Message msg, String contextPath, Object jaxb)
msg
- the current message to write the Object into as a SOAP 1.1 streamcontextPath
- a list of colon separated java package names that contain schema-derived classes
and/or fully qualified JAXB-annotated classesjaxb
- the JAXB Object to serializevoid serializeJAXBObjectAsXMLStream(Message msg, String contextPath, Object jaxb, String rootElement, String uri)
msg
- the current message to write the Object into as a XML streamcontextPath
- a list of colon separated java package names that contain schema-derived classes
and/or fully qualified JAXB-annotated classesjaxb
- the JAXB Object to serializerootElement
- root element local name for serializationuri
- namespace uri for the root elementvoid splitWithBean(String beanName, Message msg)
beanName
- name of the Spring bean implementing the split-aggregate supportmsg
- the message to be split based on the Split-Aggregation Spring beanvoid aggregateWithBean(String beanName, Message msg)
beanName
- name of the Spring bean implementing the split-aggregate supportmsg
- the message to be aggregated based on the Split-Aggregation Spring beanCopyright © 2010–2016 AdroitLogic. All rights reserved.