|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.staxnav.StaxNavigatorImpl<N>
public class StaxNavigatorImpl<N>
| Constructor Summary | |
|---|---|
StaxNavigatorImpl(Naming<N> naming,
javax.xml.stream.XMLStreamReader stream)
|
|
| Method Summary | ||
|---|---|---|
N |
_child(N name)
|
|
N |
child()
Attempts to navigate to the first child found and return its name. |
|
boolean |
child(N name)
Attempts to navigate to the first child with the specified name. |
|
int |
descendant(N name)
Attempts to navigate to the first descendant with the specified name. |
|
boolean |
find(N name)
Attempts to navigate to an element following the current one when it has the specified name. |
|
StaxNavigator<N> |
fork()
Creates a navigator scoped around the currently navigated element. |
|
java.lang.Iterable<StaxNavigator<N>> |
fork(N name)
Returns an iterable of stax navigator that is built according to the rules: Each element is found by the StaxNavigator.find(Object).
When an element is found, the StaxNavigator.sibling() method is invoked.
|
|
java.lang.String |
getAttribute(javax.xml.namespace.QName name)
Returns an attribute of the current element or null if such attribute does not exist. |
|
java.lang.String |
getAttribute(java.lang.String name)
Returns an attribute of the current element or null if such attribute does not exist. |
|
java.lang.String |
getContent()
Returns the current navigated element textual content. |
|
int |
getDepth()
Returns the current navigated element depth. |
|
java.lang.String |
getLocalName()
Returns the string representation of the local xml element. |
|
javax.xml.stream.Location |
getLocation()
Returns the location of the start tag of the currently navigated element. |
|
N |
getName()
Returns the current navigated element name. |
|
java.lang.String |
getNamespaceByPrefix(java.lang.String prefix)
Returns a namespace URI by its prefix or return null if it is not bound. |
|
Naming<N> |
getNaming()
Returns the naming used for this navigator. |
|
boolean |
getTrimContent()
Returns the trim content configuration. |
|
N |
next()
Navigates to the next element and returns its name or null if the end of the stream is reached. |
|
boolean |
next(N name)
Attempt to navigate to the next element when it has the specified name. |
|
N |
next(java.util.Set<N> names)
Attempts to navigate to the next element when it belongs to the set of specified names. |
|
|
parseContent(ValueType<V> valueType)
Parses the content of the currently navigated element and return the parsed value. |
|
void |
setTrimContent(boolean trimContent)
Configures the content trimming when StaxNavigator.getContent() method is invoked. |
|
N |
sibling()
Attempt to navigate to the next sibling and return its name. |
|
boolean |
sibling(N name)
Attempts to navigate to the next sibling with the specified name. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StaxNavigatorImpl(Naming<N> naming,
javax.xml.stream.XMLStreamReader stream)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException| Method Detail |
|---|
public N getName()
throws StaxNavException
StaxNavigator
getName in interface StaxNavigator<N>StaxNavException - any StaxNavExceptionpublic Naming<N> getNaming()
StaxNavigator
getNaming in interface StaxNavigator<N>
public java.lang.String getLocalName()
throws StaxNavException
StaxNavigator
getLocalName in interface StaxNavigator<N>StaxNavException - any StaxNavException
public javax.xml.stream.Location getLocation()
throws StaxNavException
StaxNavigator
getLocation in interface StaxNavigator<N>StaxNavException - any StaxNavException
public int getDepth()
throws StaxNavException
StaxNavigator
getDepth in interface StaxNavigator<N>StaxNavException - any StaxNavExceptionpublic void setTrimContent(boolean trimContent)
StaxNavigatorStaxNavigator.getContent() method is invoked.
setTrimContent in interface StaxNavigator<N>trimContent - true to trim contentpublic boolean getTrimContent()
StaxNavigator
getTrimContent in interface StaxNavigator<N>
public java.lang.String getContent()
throws StaxNavException
StaxNavigator
getContent in interface StaxNavigator<N>StaxNavException - any StaxNavException
public <V> V parseContent(ValueType<V> valueType)
throws java.lang.IllegalStateException,
java.lang.NullPointerException,
StaxNavException
StaxNavigator
parseContent in interface StaxNavigator<N>V - the generic type of the valuevalueType - the content value type
java.lang.IllegalStateException - if the current element does not point to a content
java.lang.NullPointerException - if the value type argument is null
StaxNavException - any StaxNavException
TypeConversionException - when the a type conversion error occured
public java.lang.String getAttribute(java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalStateException,
StaxNavException
StaxNavigator
getAttribute in interface StaxNavigator<N>name - the attribute name
java.lang.NullPointerException - if the name argument is null
java.lang.IllegalStateException - if no element is currently navigated
StaxNavException - any StaxNavException
public StaxNavigator<N> fork()
throws StaxNavException
StaxNavigator
fork in interface StaxNavigator<N>StaxNavException - any StaxNavExceptionpublic java.lang.Iterable<StaxNavigator<N>> fork(N name)
StaxNavigatorStaxNavigator.find(Object).StaxNavigator.sibling() method is invoked.
fork in interface StaxNavigator<N>name - the name of the root elements of the forked navigator
public java.lang.String getAttribute(javax.xml.namespace.QName name)
throws java.lang.NullPointerException,
java.lang.IllegalStateException,
StaxNavException
StaxNavigator
getAttribute in interface StaxNavigator<N>name - the attribute name
java.lang.NullPointerException - if the name argument is null
java.lang.IllegalStateException - if no element is currently navigated
StaxNavException - any StaxNavException
public java.lang.String getNamespaceByPrefix(java.lang.String prefix)
throws java.lang.NullPointerException,
StaxNavException
StaxNavigator
getNamespaceByPrefix in interface StaxNavigator<N>prefix - the prefix
java.lang.NullPointerException - if the prefix is null
StaxNavException - any StaxNavException
public N next()
throws StaxNavException
StaxNavigator
next in interface StaxNavigator<N>StaxNavException - any StaxNavException
public boolean next(N name)
throws StaxNavException
StaxNavigator
next in interface StaxNavigator<N>name - the desired element name
StaxNavException - any StaxNavException
public N next(java.util.Set<N> names)
throws StaxNavException
StaxNavigator
next in interface StaxNavigator<N>names - the set of desired element names
StaxNavException - any StaxNavException
public boolean find(N name)
throws StaxNavException
StaxNavigator
find in interface StaxNavigator<N>name - the element name to find
StaxNavException - any StaxNavException
public N child()
throws StaxNavException
StaxNavigator
child in interface StaxNavigator<N>StaxNavException - any StaxNavException
public boolean child(N name)
throws java.lang.NullPointerException,
StaxNavException
StaxNavigator
child in interface StaxNavigator<N>name - the child name
java.lang.NullPointerException - if the name argument is null
StaxNavException - any StaxNavException
public N _child(N name)
throws StaxNavException
StaxNavException
public N sibling()
throws StaxNavException
StaxNavigator
sibling in interface StaxNavigator<N>StaxNavException - any StaxNavException
public boolean sibling(N name)
throws java.lang.NullPointerException,
StaxNavException
StaxNavigator
sibling in interface StaxNavigator<N>name - the next sibling name
java.lang.NullPointerException - if the name argument is null
StaxNavException - any StaxNavException
public int descendant(N name)
throws java.lang.NullPointerException,
StaxNavException
StaxNavigator
descendant in interface StaxNavigator<N>name - the descendant name
java.lang.NullPointerException - if the name is null
StaxNavException - any StaxNavException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||