|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MetadataNode
The MetadataNodes represents a node in an XML-based metadata-document. In contrast to the W3C DOM-API it allows for easy and convenient use by providing easy to use methods for access, navigation, evaluation and conversion.
Method Summary | |
---|---|
MetadataNode |
createNamespaceContext()
Create a facade node which allows a new mapping of namespace prefixes to be used to navigate and query nodes without changing the base document. |
Boolean |
evalToBoolean(String relativeXpath,
Object... arguments)
Evaluate the given XPath expression against the current node and return the result as a Boolean. |
Node |
evalToNode(String relativeXpath,
Object... arguments)
Evaluate the given XPath expression against the current node and return the result as a Node. |
NodeList |
evalToNodeSet(String relativeXpath,
Object... arguments)
Evaluate the given XPath expression against the current node and return the result as a NodeList. |
Number |
evalToNumber(String relativeXpath,
Object... arguments)
Evaluate the given XPath expression against the current node and return the result as a Number. |
String |
evalToString(String relativeXpath,
Object... arguments)
Evaluate the given XPath expression against the current node and return the result as a String. |
String |
findAttribute(String name)
returns the attribute value of the current node or null if the attribute does not exist |
String |
findAttribute(String name,
String relativeXpath,
Object... arguments)
Returns the attribute value of the node pointed by given XPath expression or null if the attribute does not exist |
String |
getAttribute(String name)
returns the attribute value of the current node |
String |
getAttribute(String name,
String relativeXpath,
Object... arguments)
Returns the attribute value of the node pointed by given XPath expression |
String[] |
getAttributeNames()
|
String |
getCDATA()
|
int |
getChildCount()
|
List<? extends MetadataNode> |
getChildren()
Return a list of all child nodes. |
List<? extends MetadataNode> |
getChildren(String relativeXpath,
Object... arguments)
Return a list of all nodes selected by the XPath expression. |
Metadata |
getDocument()
Return the meta-data document to which this node belongs. |
Element |
getElement()
|
String |
getEncoding()
|
MetadataNode |
getInnerDocument()
|
String |
getInnerText()
|
String |
getLocation()
|
String |
getName()
|
String |
getPrefix(String namespaceURI)
Get the prefix of a namespace identified by its URI. |
String[] |
getPrefixes(String namespaceURI)
Get all bound prefixes of a namespace identified by its URI. |
String |
getText()
|
String |
getText(String relativeXpath,
Object... arguments)
Get the text content of the node addressed by the XPath. |
String |
getTextOrCDATA()
|
String |
getTextOrCDATA(String relativeXpath,
Object... arguments)
Get the text content of the node addressed by the XPath. |
MetadataNode |
gotoChild()
Go to the only child element of the current node. |
MetadataNode |
gotoChild(int i)
Go to the Nth child of the curent node. |
MetadataNode |
gotoChild(String nodeName)
Go to the child found with given node name |
MetadataNode |
gotoFirstChild()
Go to the first child element of the current node. |
MetadataNode |
gotoFirstChild(String name)
Go to the first child with the given name |
MetadataNode |
gotoLastChild()
Go to the last child element of the current node. |
MetadataNode |
gotoLastChild(String name)
Go to the last child with the given name |
MetadataNode |
gotoParent()
Go to parent tag. |
MetadataNode |
gotoRoot()
Go to document root tag |
MetadataNode |
gotoTag(String relativeXpath,
Object... arguments)
Go to a specific node |
boolean |
hasAttribute(String name)
Check whether current tag contains the attribute with the given name. |
boolean |
hasAttribute(String name,
String relativeXpath,
Object... arguments)
Check whether the node addressed by the XPath contains the attribute with the given name. |
boolean |
hasNode(String relativeXpath,
Object... arguments)
Check if the node addressed by the XPath exists in the document. |
Method Detail |
---|
String findAttribute(String name)
name
- attribute name
String findAttribute(String name, String relativeXpath, Object... arguments) throws MetadataException
name
- attribute namerelativeXpath
- XPath expressionarguments
- optional XPath expression arguments. Uses String.format() to build XPath
expression.
MetadataException
- targeted node does not exist or XPath expression is invalidString getAttribute(String name) throws MetadataException
name
- attribute name
MetadataException
- If the attribute does not existString getAttribute(String name, String relativeXpath, Object... arguments) throws MetadataException
name
- attribute namerelativeXpath
- XPath expressionarguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
MetadataException
- Attribute does not exist, targetted node or XPath expression is
invalidString[] getAttributeNames()
String getCDATA()
int getChildCount()
List<? extends MetadataNode> getChildren()
List<? extends MetadataNode> getChildren(String relativeXpath, Object... arguments)
relativeXpath
- XPath to select tagsarguments
- XPath arguments
Metadata getDocument()
Element getElement()
String getLocation()
String getName()
MetadataNode getInnerDocument()
String getInnerText()
String getPrefix(String namespaceURI)
namespaceURI
- The URI of the namespace
javadoc
)String[] getPrefixes(String namespaceURI)
namespaceURI
- The URI of the namespace
String getText()
String getText(String relativeXpath, Object... arguments) throws MetadataException
relativeXpath
- XPath expression that select the nodearguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
MetadataException
- If the XPath expression is not valid or if the node does not existString getTextOrCDATA()
String getTextOrCDATA(String relativeXpath, Object... arguments) throws MetadataException
relativeXpath
- XPath expression that select the nodearguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
MetadataException
- If the XPath expression is not valid or if the node does not existboolean hasAttribute(String name)
name
- Attribute name
boolean hasAttribute(String name, String relativeXpath, Object... arguments) throws MetadataException
name
- the name of the attributerelativeXpath
- XPath that target the tagarguments
- optional arguments of xpath expression. Uses String.format() to build XPath
expression.
MetadataException
- If the targetted node does not exist or if xpath expression is not
validboolean hasNode(String relativeXpath, Object... arguments)
relativeXpath
- XPath expression where the tag should be locatedarguments
- XPath arguments. Uses String.format() to build XPath expression.
Boolean evalToBoolean(String relativeXpath, Object... arguments)
relativeXpath
- The XPath expressionarguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
XPathConstants
return typeNode evalToNode(String relativeXpath, Object... arguments)
relativeXpath
- The XPath expressionarguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
XPathConstants
return typeNodeList evalToNodeSet(String relativeXpath, Object... arguments)
relativeXpath
- The XPath expressionarguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
XPathConstants
return typeNumber evalToNumber(String relativeXpath, Object... arguments)
relativeXpath
- The XPath expressionarguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
XPathConstants
return typeString evalToString(String relativeXpath, Object... arguments)
relativeXpath
- The XPath expressionarguments
- facultative Xpath expression arguments. Uses String.format() to build XPath
expression.
XPathConstants
return typeString getEncoding()
MetadataNode gotoChild() throws MetadataException
MetadataException
- If the current node has several childs or no child at allMetadataNode gotoChild(int i) throws MetadataException
i
- index of the child, from 1 to child element number
MetadataException
- If the child node does not existMetadataNode gotoChild(String nodeName) throws MetadataException
nodeName
- name of the child to find.
MetadataException
- If the element with this name has not been found or if there are too
many elementsMetadataNode gotoFirstChild() throws MetadataException
MetadataException
- If the current node has no child at allMetadataNode gotoFirstChild(String name) throws MetadataException
name
- Name of the child to go at
MetadataException
- If the current node has no child at allMetadataNode gotoLastChild() throws MetadataException
MetadataException
- If the current node has no child at allMetadataNode gotoLastChild(String name) throws MetadataException
name
- Name of the child to go at
MetadataException
- If the current node has no child at allMetadataNode gotoParent()
MetadataNode gotoRoot()
MetadataNode gotoTag(String relativeXpath, Object... arguments) throws MetadataException
relativeXpath
- XPath expressionarguments
- to be replaced in XPath expression before compiling. Uses String.format() to
build XPath expression.
MetadataException
- if the node does not exist or if the XPath expression is invalidMetadataNode createNamespaceContext()
MetadataException
- If the namespace handling has been disabled on the Metadata
containing this node.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |