public interface XMLFeature
Modifier and Type | Method and Description |
---|---|
void |
addAttributeToElements(org.adroitlogic.x.api.XMessage msg,
String expression,
String qName,
String nsUri,
String value,
Map<String,String> ns)
Add an attribute to one or more elements selected by an XPath expression
e.g.
|
void |
addElementsAsChild(org.adroitlogic.x.api.XMessage msg,
String expression,
String qualifiedTagName,
String namespace,
Map<String,String> ns)
Inserts Element as a child to the specified elements pointed by an xpath expression
|
void |
addTextElementsAsChild(org.adroitlogic.x.api.XMessage msg,
String expression,
String qualifiedTagName,
String namespace,
String elementContent,
Map<String,String> ns)
Inserts Text Element as a child to the specified elements pointed by an xpath expression
|
void |
convertToDOM(org.adroitlogic.x.api.XMessage m)
Convert the current message into a DOMMessage
|
void |
createAndCacheTransformers(URI xsltFileURI)
Creates and caches a "minTransformerCount" number of XSLT transformers for the given XSLT file URI
|
Document |
createDOMDocument()
Create a new DOM Document object and return
|
void |
deleteAttributes(org.adroitlogic.x.api.XMessage msg,
String expression,
Map<String,String> ns)
Deletes the specified attribute/s
e.g.
|
void |
deleteElements(org.adroitlogic.x.api.XMessage msg,
String expression,
Map<String,String> ns)
Delete Elements pointed by an xpath expression
|
NodeList |
extractAsNodeListUsingXPath(Node n,
String expression,
Map<String,String> ns)
Evaluate the given XPath expression against the DOM node, and return result as a NodeList
|
NodeList |
extractAsNodeListUsingXPath(org.adroitlogic.x.api.XMessage m,
String expression,
Map<String,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
|
String |
extractAsStringUsingXPath(Node n,
String expression,
Map<String,String> ns)
Evaluate the given XPath expression against the DOM node, and return result as a String
|
String |
extractAsStringUsingXPath(String s,
String expression,
Map<String,String> ns)
Evaluate the given XPath expression against the XML payload contained in a String, and return result as a String.
|
String |
extractAsStringUsingXPath(org.adroitlogic.x.api.XMessage m,
String expression,
Map<String,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
|
boolean |
filter(org.adroitlogic.x.api.XMessage m,
String expression,
Map<String,String> ns)
Evaluate the given boolean XPath expression over the XML payload
|
boolean |
filter(org.adroitlogic.x.api.XMessage m,
String expression,
String regex,
Map<String,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(org.adroitlogic.x.api.XMessage msg,
String expression,
Map<String,String> ns)
Get attribute value
e.g.
|
Document |
getPayloadAsDOM(org.adroitlogic.x.api.XMessage m)
Returns payload of the message as a DOM Document
|
String |
getTextElement(org.adroitlogic.x.api.XMessage msg,
String expression,
Map<String,String> ns)
Get text element value for given XPath
|
void |
insertTextElementsAfter(org.adroitlogic.x.api.XMessage msg,
String expression,
String qualifiedTagName,
String namespace,
String elementContent,
Map<String,String> ns)
Inserts an element/elements after the specified element pointed by the XPATH, to the current message.
|
void |
insertTextElementsBefore(org.adroitlogic.x.api.XMessage msg,
String expression,
String qualifiedTagName,
String namespace,
String elementContent,
Map<String,String> ns)
Inserts an element/elements before the specified element pointed by the XPATH, to the current message.
|
void |
mergeXMLAttachmentsUnderElement(org.adroitlogic.x.api.XMessage msg,
String rootElemName)
Replace the current XML payload with a top level element as specified, and merge the attachments of the message
underneath that
|
void |
mergeXMLAttachmentsUnderElement(org.adroitlogic.x.api.XMessage msg,
String rootElemName,
String rootNS)
Replace the current XML payload with a top level element as specified, and merge the attachments of the message
underneath that
|
boolean |
remove(org.adroitlogic.x.api.XMessage m,
String expression,
Map<String,String> ns)
Remove the XPath expression specified node from the XML payload.
|
void |
replaceAttributes(org.adroitlogic.x.api.XMessage msg,
String expression,
String value,
Map<String,String> ns)
Replaces the specified attribute/s value
|
void |
replaceTextElements(org.adroitlogic.x.api.XMessage msg,
String expression,
String elementContent,
Map<String,String> ns)
Replace Text Elements pointed by an xpath expression
|
void |
retainElementAsPayload(org.adroitlogic.x.api.XMessage m,
String expression,
Map<String,String> ns)
Replace the current XML payload with the resulting element from the XPath expression result
|
void |
serialize(Document document,
OutputStream os)
Serialize the DOM Document into the given OutputStream
|
void |
setPayloadFromDOM(org.adroitlogic.x.api.XMessage m,
Document doc)
Set the payload of the message with the DOM Document
|
void |
transform(org.adroitlogic.x.api.XMessage msg,
URI xsltFileURI)
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(org.adroitlogic.x.api.XMessage msg,
URI xsltFileURI,
String expression,
boolean domResult,
Map<String,Object> parameters,
Map<String,String> ns)
Transform the message payload by XSLT
|
void |
transform(org.adroitlogic.x.api.XMessage msg,
URI xsltFileURI,
String expression,
Map<String,String> ns)
Transform the message payload by XSLT (without any parameters), assuming a non DOM result
|
void |
validate(Node n,
URI... schemaFileURIs)
Validates the given DOM Node against one or more schemas.
|
void |
validate(String s,
URI... schemaFileURIs)
Validates the given String against one or more schemas.
|
void |
validate(org.adroitlogic.x.api.XMessage m,
URI... schemaFileURIs)
Validates the given message against one or more schemas.
|
void |
validate(org.adroitlogic.x.api.XMessage m,
URI[] schemaFileURIs,
String expression,
Map<String,String> ns)
Validates the current message - or an element of it selected via the provided XPath expression - against one or
more schemas.
|
void |
validateAll(org.adroitlogic.x.api.XMessage m,
URI[] schemaFileURIs,
String expression,
Map<String,String> ns)
Validate the current message - or all elements of it selected via the provided XPath expression - against one or
more schemas.
|
void |
wrapPayload(org.adroitlogic.x.api.XMessage msg,
String elementName,
String namespace)
Wrap the XML payload with an outer element
|
Document createDOMDocument()
void serialize(Document document, OutputStream os)
document
- the Document to serializeos
- the target OutputStreamvoid setPayloadFromDOM(org.adroitlogic.x.api.XMessage 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(org.adroitlogic.x.api.XMessage m)
m
- the current message to be passedvoid convertToDOM(org.adroitlogic.x.api.XMessage m)
m
- the current message to be transformedvoid retainElementAsPayload(org.adroitlogic.x.api.XMessage m, String expression, Map<String,String> ns)
m
- the current messageexpression
- XPath expression selecting the node to retainns
- an optional map with namespace prefixes (as keys) and namespaces (as values) used within the
XPath expressionvoid mergeXMLAttachmentsUnderElement(org.adroitlogic.x.api.XMessage msg, String rootElemName)
msg
- the message to transformrootElemName
- the new root element createdvoid mergeXMLAttachmentsUnderElement(org.adroitlogic.x.api.XMessage msg, String rootElemName, String rootNS)
msg
- the message to transformrootElemName
- the new root element createdrootNS
- optional namespace for the root element, or nullvoid validate(org.adroitlogic.x.api.XMessage m, URI... schemaFileURIs)
IntegrationRuntimeException
with details of the XSD validation failuresm
- the message holding the payload for validationschemaFileURIs
- an array of XSD file URIs to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise it
may result in an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration
of element.
It is advised to use the AbstractProcessingElement.getResource(String filePath)
method to get the URI from a file path
void validate(String s, URI... schemaFileURIs)
IntegrationRuntimeException
with details of the XSD validation failuress
- the XML stringschemaFileURIs
- an array of XSD file URIs to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise it
may result in an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration
of element"
It is advised to use the AbstractProcessingElement.getResource(String filePath)
method to get the URI from a file path
void validate(Node n, URI... schemaFileURIs)
IntegrationRuntimeException
with details of the XSD validation failuresn
- the DOM Node containing the XML to be validatedschemaFileURIs
- an array of XSD file URIs to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise it
may result in an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration
of element"
It is advised to use the AbstractProcessingElement.getResource(String filePath)
method to get the URI from a file path
void validate(org.adroitlogic.x.api.XMessage m, URI[] schemaFileURIs, String expression, Map<String,String> ns)
IntegrationRuntimeException
with details of the
XSD validation failuresm
- the message holding the payload for validationschemaFileURIs
- an array of XSD file URIs to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise it
may result in an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration
of element"
It is advised to use the AbstractProcessingElement.getResource(String filePath)
method to get the URI from a file path
expression
- an optional XPath expression selecting the node for validationns
- an optional map with namespace prefixes (as keys) and namespaces (as values) used within
the XPath expressionvoid validateAll(org.adroitlogic.x.api.XMessage m, URI[] schemaFileURIs, String expression, Map<String,String> ns)
IntegrationRuntimeException
with details of the XSD
validation failuresm
- the message holding the payload for validationschemaFileURIs
- an array of XSD file URIs to validate against
Note: the validator is sensitive to the order in which the Schemas are given. Otherwise it
may result in an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration
of element"
It is advised to use the AbstractProcessingElement.getResource(String filePath)
method to get the URI from a file path
expression
- an optional XPath expression selecting the nodes for validationns
- an optional map with namespace prefixes (as keys) and namespaces (as values) used within
the XPath expressionvoid createAndCacheTransformers(URI xsltFileURI)
xsltFileURI
- URI of the XSLT file to be used for the transformationvoid transform(org.adroitlogic.x.api.XMessage msg, URI xsltFileURI, String expression, boolean domResult, Map<String,Object> parameters, Map<String,String> ns)
msg
- current messagexsltFileURI
- the XSLT file URIexpression
- 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 map with namespace prefixes (as keys) and namespaces (as values) used within
the XPath expressionvoid transform(org.adroitlogic.x.api.XMessage msg, URI xsltFileURI, String expression, Map<String,String> ns)
msg
- current messagexsltFileURI
- the XSLT filenameexpression
- an optional XPath expression to select the source node for XSLT, and node to replace with the
resultns
- an optional map with namespace prefixes (as keys) and namespaces (as values) used within
the XPath expressionvoid transform(org.adroitlogic.x.api.XMessage msg, URI xsltFileURI)
msg
- current messagexsltFileURI
- the XSLT filenameboolean filter(org.adroitlogic.x.api.XMessage m, String expression, String regex, Map<String,String> ns)
m
- the current messageexpression
- the XPath expression to evaluate against the message payloadregex
- an optional regular expression to evaluate the XPath results' String value againstns
- an optional map with namespace prefixes (as keys) and namespaces (as values) used within
the XPath expressionboolean filter(org.adroitlogic.x.api.XMessage m, String expression, Map<String,String> ns)
m
- the current messageexpression
- the XPath expression to evaluate against the message payloadns
- an optional map with namespace prefixes (as keys) and namespaces (as values) used within
the XPath expressionvoid addAttributeToElements(org.adroitlogic.x.api.XMessage msg, String expression, String qName, String nsUri, String value, Map<String,String> ns)
msg
- the message where the transformation is performedexpression
- 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
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionString getAttribute(org.adroitlogic.x.api.XMessage msg, String expression, Map<String,String> ns)
msg
- the message to read the attribute fromexpression
- the xpath expression to the element from where the attribute should be retrievedns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionvoid deleteAttributes(org.adroitlogic.x.api.XMessage msg, String expression, Map<String,String> ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the attributes, which are to be deletedns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionvoid replaceAttributes(org.adroitlogic.x.api.XMessage msg, String expression, String value, Map<String,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
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionvoid addTextElementsAsChild(org.adroitlogic.x.api.XMessage msg, String expression, String qualifiedTagName, String namespace, String elementContent, Map<String,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
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the
XPath expressionvoid addElementsAsChild(org.adroitlogic.x.api.XMessage msg, String expression, String qualifiedTagName, String namespace, Map<String,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
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the
XPath expressionString getTextElement(org.adroitlogic.x.api.XMessage msg, String expression, Map<String,String> ns)
msg
- the message to read the attribute fromexpression
- the xpath expression to the element where the text content should be readns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionvoid replaceTextElements(org.adroitlogic.x.api.XMessage msg, String expression, String elementContent, Map<String,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
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the
XPath expressionvoid deleteElements(org.adroitlogic.x.api.XMessage msg, String expression, Map<String,String> ns)
msg
- the current message containing the payloadexpression
- the xpath expression to the text elements to be replacedns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the
XPath expressionvoid insertTextElementsBefore(org.adroitlogic.x.api.XMessage msg, String expression, String qualifiedTagName, String namespace, String elementContent, Map<String,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
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the
XPath expressionvoid insertTextElementsAfter(org.adroitlogic.x.api.XMessage msg, String expression, String qualifiedTagName, String namespace, String elementContent, Map<String,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
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the
XPath expressionboolean remove(org.adroitlogic.x.api.XMessage m, String expression, Map<String,String> ns)
m
- the current messageexpression
- the XPath expression to evaluate against the message payloadns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionString extractAsStringUsingXPath(org.adroitlogic.x.api.XMessage m, String expression, Map<String,String> ns)
m
- the current messageexpression
- the XPath expression to evaluate against the message payloadns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionString extractAsStringUsingXPath(String s, String expression, Map<String,String> ns)
extractAsStringUsingXPath(Node, String, Map)
instead of this method as that will be
much more performance friendlys
- a String containing an XML payloadexpression
- the XPath expression to evaluate against the XML payloadns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionString extractAsStringUsingXPath(Node n, String expression, Map<String,String> ns)
n
- DOM node to be subjected to the evaluationexpression
- the XPath expression to evaluate against the DOM nodens
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionNodeList extractAsNodeListUsingXPath(org.adroitlogic.x.api.XMessage m, String expression, Map<String,String> ns)
m
- the current messageexpression
- the XPath expression to evaluate against the message payloadns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionNodeList extractAsNodeListUsingXPath(Node n, String expression, Map<String,String> ns)
n
- DOM node to be subjected to the evaluationexpression
- the XPath expression to evaluate against the message payloadns
- optional map with namespace prefixes (as keys) and namespaces (as values) used within the XPath
expressionCopyright © 2016–2019 AdroitLogic. All rights reserved.