@ComponentProfile(summary="Extract data via XPath and store it as metadata", tag="service,metadata,xml,xpath") public class XpathMetadataService extends MetadataServiceImpl
XpathQuery
as metadata.
If the DocumentBuilderFactoryBuilder
has been explicitly set to be not namespace aware and the document does in fact
contain namespaces, then Saxon can cause merry havoc in the sense that //NonNamespaceXpath
doesn't work if the document
has namespaces in it. We have included a shim so that behaviour can be toggled based on what you have configured.
XPath.newXPathInstance(DocumentBuilderFactoryBuilder, NamespaceContext)
In the adapter configuration file this class is aliased as xpath-metadata-service which is the preferred alternative to the fully qualified classname when building your configuration.
MetadataServiceImpl.LogWrapper
DEBUG, ERROR, INFO, TRACE, WARN
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
XpathMetadataService()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addXpathQuery(XpathQuery query) |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
KeyValuePairSet |
getNamespaceContext() |
DocumentBuilderFactoryBuilder |
getXmlDocumentFactoryConfig() |
java.util.List<XpathQuery> |
getXpathQueries() |
protected void |
initService() |
void |
setNamespaceContext(KeyValuePairSet namespaceContext)
Set the namespace context for resolving namespaces.
|
void |
setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml) |
void |
setXpathQueries(java.util.List<XpathQuery> xql)
Set the list of XpathQuery instances that will be executed.
|
closeService, getMetadataLogger, logMetadata, logMetadata, logMetadata, logMetadata, prepare, setMetadataLogger, withMetadataLogger
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
protected void initService() throws CoreException
initService
in class MetadataServiceImpl
CoreException
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic KeyValuePairSet getNamespaceContext()
public void setNamespaceContext(KeyValuePairSet namespaceContext)
namespaceContext
- public java.util.List<XpathQuery> getXpathQueries()
public void setXpathQueries(java.util.List<XpathQuery> xql)
xql
- public void addXpathQuery(XpathQuery query)
public DocumentBuilderFactoryBuilder getXmlDocumentFactoryConfig()
public void setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml)