public class StaxUnmarshallerContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.util.Deque<java.lang.String> |
stack
The deque stack.
|
Constructor and Description |
---|
StaxUnmarshallerContext(org.xmlpull.v1.XmlPullParser xpp)
Constructs a new unmarshaller context using the specified source of XML
events.
|
StaxUnmarshallerContext(org.xmlpull.v1.XmlPullParser xpp,
java.util.Map<java.lang.String,java.lang.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.
|
java.lang.String |
getHeader(java.lang.String header)
Returns the value of the header with the specified name from the
response, or null if not present.
|
java.util.Map<java.lang.String,java.lang.String> |
getMetadata()
Returns any metadata collected through metadata expressions while this
context was reading the XML events from the XML document.
|
boolean |
isStartOfDocument()
Returns true if this unmarshaller context is at the very beginning of a
source document (i.e.
|
int |
nextEvent()
Returns the next XML event for the document being parsed.
|
java.lang.String |
readText()
Returns the text contents of the current element being parsed.
|
void |
registerMetadataExpression(java.lang.String expression,
int targetDepth,
java.lang.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.
|
boolean |
testExpression(java.lang.String expression)
Tests the specified expression against the current position in the XML
document being parsed.
|
boolean |
testExpression(java.lang.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(org.xmlpull.v1.XmlPullParser xpp)
xpp
- The source of XML events for this unmarshalling context.public StaxUnmarshallerContext(org.xmlpull.v1.XmlPullParser xpp, java.util.Map<java.lang.String,java.lang.String> headers)
xpp
- The source of XML events for this unmarshalling context.headers
- The set of response headers associated with this
unmarshaller context.public java.lang.String getHeader(java.lang.String header)
header
- The name of the header to lookup.public java.lang.String readText() throws org.xmlpull.v1.XmlPullParserException, java.io.IOException
java.io.IOException
org.xmlpull.v1.XmlPullParserException
public int getCurrentDepth()
public boolean testExpression(java.lang.String expression)
expression
- The psuedo-xpath expression to test.public boolean testExpression(java.lang.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()
public int nextEvent() throws org.xmlpull.v1.XmlPullParserException, java.io.IOException
java.io.IOException
org.xmlpull.v1.XmlPullParserException
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
public void registerMetadataExpression(java.lang.String expression, int targetDepth, java.lang.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.