Package org.jesterj.ingest.processors
Class StaxExtractingProcessor.ElementSpec
- java.lang.Object
-
- org.jesterj.ingest.processors.StaxExtractingProcessor.ElementSpec
-
- Enclosing class:
- StaxExtractingProcessor
public static class StaxExtractingProcessor.ElementSpec extends java.lang.ObjectAn class to describe an element and what to do with it when it's encountered.
-
-
Constructor Summary
Constructors Constructor Description ElementSpec(java.lang.String destField)ElementSpec(java.lang.String destField, StaxExtractingProcessor.LimitedStaxHandlerFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDestField()StaxExtractingProcessor.LimitedStaxHandlerhandleIfMatches(org.codehaus.stax2.XMLStreamReader2 reader, StaxExtractingProcessor.ElementSpec spec)Attempt to match the current element and return a handler if successful.StaxExtractingProcessor.ElementSpecinclAttributeText(java.lang.String namespaceUri, java.lang.String attrName)Causes the value of the supplied attributes to be prepended to any characters from the element.protected booleanmatches(org.codehaus.stax2.XMLStreamReader2 reader)StaxExtractingProcessor.ElementSpecmatchOnAttrValue(java.lang.String namespaceUri, java.lang.String attrName, java.util.regex.Pattern pattern)Causes the element to only match if the value of ALL specified attributes matches the supplied regex.
-
-
-
Constructor Detail
-
ElementSpec
public ElementSpec(java.lang.String destField, StaxExtractingProcessor.LimitedStaxHandlerFactory factory)
-
ElementSpec
public ElementSpec(java.lang.String destField)
-
-
Method Detail
-
inclAttributeText
public StaxExtractingProcessor.ElementSpec inclAttributeText(java.lang.String namespaceUri, java.lang.String attrName)
Causes the value of the supplied attributes to be prepended to any characters from the element. Attributes will be prepended in the order they are supplied to this method and separated by a single space, but only once per attribute. This method should NEVER be called during document processing only during configuration.- Parameters:
attrName- the attribute to appendnamespaceUri- the namespace for the attribute (or null for default)- Returns:
- this object for further configuration.
-
matchOnAttrValue
public StaxExtractingProcessor.ElementSpec matchOnAttrValue(java.lang.String namespaceUri, java.lang.String attrName, java.util.regex.Pattern pattern)
Causes the element to only match if the value of ALL specified attributes matches the supplied regex.- Parameters:
namespaceUri- The name space for the attribute (may be null for default ns)attrName- The qname for the attributepattern- The compiled regex pattern to use for matching.- Returns:
- this object for further configuration.
-
handleIfMatches
public StaxExtractingProcessor.LimitedStaxHandler handleIfMatches(org.codehaus.stax2.XMLStreamReader2 reader, StaxExtractingProcessor.ElementSpec spec)
Attempt to match the current element and return a handler if successful. Note that the question of whether or not the path to this element matches is already determined by this point and only the attribute matching needs to be determined.- Parameters:
reader- The reader, typically duringXMLStreamConstants.START_ELEMENTspec- The specification of how to handle the element- Returns:
- A handler if we match null otherwise.
-
matches
protected boolean matches(org.codehaus.stax2.XMLStreamReader2 reader)
-
getDestField
public java.lang.String getDestField()
-
-