public class StaxUnmarshallerContext extends Object
Constructor and Description |
---|
StaxUnmarshallerContext(XMLEventReader eventReader)
Constructs a new unmarshaller context using the specified source of XML events.
|
StaxUnmarshallerContext(XMLEventReader eventReader,
Map<String,String> headers)
Constructs a new unmarshaller context using the specified source of XML
events, and a set of response headers.
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentDepth()
Returns the element depth of the parser's current position in the XML
document being parsed.
|
String |
getHeader(String header)
Returns the value of the header with the specified name from the
response, or null if not present.
|
Map<String,String> |
getMetadata()
Returns any metadata collected through metadata expressions while this
context was reading the XML events from the XML document.
|
boolean |
isInsideResponseHeader() |
boolean |
isStartOfDocument()
Returns true if this unmarshaller context is at the very beginning of a
source document (i.e.
|
XMLEvent |
nextEvent()
Returns the next XML event for the document being parsed.
|
String |
readText()
Returns the text contents of the current element being parsed.
|
void |
registerMetadataExpression(String expression,
int targetDepth,
String storageKey)
Registers an expression, which if matched, will cause the data for the
matching element to be stored in the metadata map under the specified
key.
|
void |
setCurrentHeader(String currentHeader) |
boolean |
testExpression(String expression)
Tests the specified expression against the current position in the XML
document being parsed.
|
boolean |
testExpression(String expression,
int startingStackDepth)
Tests the specified expression against the current position in the XML
document being parsed, and restricts the expression to matching at the
specified stack depth.
|
public StaxUnmarshallerContext(XMLEventReader eventReader)
eventReader
- The source of XML events for this unmarshalling context.public StaxUnmarshallerContext(XMLEventReader eventReader, Map<String,String> headers)
eventReader
- The source of XML events for this unmarshalling context.headers
- The set of response headers associated with this unmarshaller
context.public void setCurrentHeader(String currentHeader)
public boolean isInsideResponseHeader()
public String getHeader(String header)
header
- The name of the header to lookup.public String readText() throws XMLStreamException
XMLStreamException
public int getCurrentDepth()
public boolean testExpression(String expression)
expression
- The psuedo-xpath expression to test.public boolean testExpression(String expression, int startingStackDepth)
expression
- The psuedo-xpath expression to test.startingStackDepth
- The depth in the stack representing where the expression must
start matching in order for this method to return true.public boolean isStartOfDocument() throws XMLStreamException
XMLStreamException
public XMLEvent nextEvent() throws XMLStreamException
XMLStreamException
public Map<String,String> getMetadata()
public void registerMetadataExpression(String expression, int targetDepth, String storageKey)
expression
- The expression an element must match in order for it's data to
be pulled out and stored in the metadata map.targetDepth
- The depth in the XML document where the expression match must
start.storageKey
- The key under which to store the matching element's data.Copyright © 2019. All rights reserved.