Package com.github.simy4.xpath.navigator
Interface Navigator<N extends Node>
-
- Type Parameters:
N
- XML model nodes type
public interface Navigator<N extends Node>
XML model navigator contract.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Iterable<? extends N>
attributesOf(N parent)
Child attribute nodes of given XML node.N
createAttribute(N parent, javax.xml.namespace.QName attribute)
Creates XML attribute node and appends to given parent.N
createElement(N parent, javax.xml.namespace.QName element)
Creates XML element node and appends to given parent.java.lang.Iterable<? extends N>
elementsOf(N parent)
Child element nodes of given XML node.N
parentOf(N node)
Wrapped parent of given XML node.void
prependCopy(N node)
Prepends a copy of given node to this node.void
remove(N node)
Removes/detaches given node from XML model.N
root()
Wrapped XML root.void
setText(N node, java.lang.String text)
Sets the given text content to a given node.
-
-
-
Method Detail
-
root
N root()
Wrapped XML root.- Returns:
- XML root
-
parentOf
N parentOf(N node)
Wrapped parent of given XML node.- Parameters:
node
- XML node to scan- Returns:
- XML node parent
-
elementsOf
java.lang.Iterable<? extends N> elementsOf(N parent)
Child element nodes of given XML node.- Parameters:
parent
- XML node to scan- Returns:
- child element nodes
-
attributesOf
java.lang.Iterable<? extends N> attributesOf(N parent)
Child attribute nodes of given XML node.- Parameters:
parent
- XML node to scan- Returns:
- child attribute nodes
-
createAttribute
N createAttribute(N parent, javax.xml.namespace.QName attribute) throws XmlBuilderException
Creates XML attribute node and appends to given parent.- Parameters:
parent
- parent XML node to modifyattribute
- new XML attribute's name- Returns:
- newly created attribute node
- Throws:
XmlBuilderException
- if failure occur during XML attribute creation
-
createElement
N createElement(N parent, javax.xml.namespace.QName element) throws XmlBuilderException
Creates XML element node and appends to given parent.- Parameters:
parent
- parent XML node to modifyelement
- new XML element's name- Returns:
- newly created element node
- Throws:
XmlBuilderException
- if failure occur during XML element creation
-
setText
void setText(N node, java.lang.String text) throws XmlBuilderException
Sets the given text content to a given node.- Parameters:
node
- XML node to modifytext
- text content to set- Throws:
XmlBuilderException
- if failure occur during setting the text content
-
prependCopy
void prependCopy(N node) throws XmlBuilderException
Prepends a copy of given node to this node.- Parameters:
node
- XML node to copy and prepend- Throws:
XmlBuilderException
- if failure occur during node appending
-
remove
void remove(N node) throws XmlBuilderException
Removes/detaches given node from XML model.- Parameters:
node
- node to remove- Throws:
XmlBuilderException
- if failure occur during node removal
-
-