|
NetKernel APIs |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ten60.netkernel.xml.xda.DOMXDA
Implementation of IXDA, IXDAIterator, IXDAReadOnly and IXDAReadOnlyIterator using DOM
Field Summary | |
static String |
XMLNS_DECLARATION_URI
|
Constructor Summary | |
DOMXDA(Document aDocument)
Creates a new instance of DOMXDA |
|
DOMXDA(Document aDocument,
boolean clone)
|
|
DOMXDA(DOMXDA aOther)
|
|
DOMXDA(Node aRoot,
DOMXDA aParentXDA)
|
|
DOMXDA(Node aRoot,
DOMXDA aParentXDA,
boolean clone)
|
Method Summary | |
void |
append(IXDAReadOnly aSource,
String aSourceXPath,
String aTargetXPath)
Append fragment of source to this at a specified location or locations |
void |
appendPath(String aTargetXPath,
String aNewRelativeXPath,
String aOptionalValue)
Builds and appends a chain of elements to a location or locations within this |
void |
applyNS(String aTargetXPath,
String prefix,
String uri)
Apply namespace to target location or locations |
void |
declareNS(String aTargetXPath,
String prefix,
String uri)
|
void |
delete(String aTargetXPath)
Delete elements at target location or locations |
IXPathResult |
eval(String aTargetXPath)
Evaluate the xpath against the document returning an IXPathResult |
String |
getCurrentXPath()
return an xpath representation of the current context node |
Document |
getDocument()
|
Document |
getFragment(Node node)
Returns the document fragment located by a Node |
Document |
getFragment(String aXPath)
Returns the document fragment located by an unambiguous XPath |
Map |
getMap(String aTargetXPath,
boolean aTrim)
Returns |
NodeList |
getNodeList(String aXPath)
Evaluates the given XPath expression on the current document and returns a NodeList. |
List |
getNodesFor(String aXPath)
|
String |
getPrefix(String aNamespace)
|
Node |
getRoot()
|
Node |
getSingleNode(NodeList aNodeList)
Returns a the one and only node from a NodeList. |
Node |
getSingleNode(String aXpath)
Returns the one and only node from an Xpath query. |
String |
getText(String aTargetXPath,
boolean aTrim)
Return the text that is contained at the element located using an XPath |
boolean |
hasNext()
return true if there are more context nodes to move to |
void |
insertAfter(IXDAReadOnly aSource,
String aSourceXPath,
String aTargetXPath)
Insert fragment of source to this after specified location or locations |
void |
insertBefore(IXDAReadOnly aSource,
String aSourceXPath,
String aTargetXPath)
Insert fragment of source to this before specified location or locations |
boolean |
isTrue(String aTargetXPath)
Evaluate and xpath against the document returning a boolean result |
IXDAIterator |
iterator(String aTargetXPath)
Return an iterator over all elements match the xpath in this |
void |
move(String aSourceXPath,
String aTargetXPath)
Moves a fragment from one location in this to another |
boolean |
next()
move to next context node, returns true if successful, false if there are no more nodes |
IXDAReadOnlyIterator |
readOnlyIterator(String aTargetXPath)
Return an iterator over all elements that match the an XPath |
void |
removeNS(String aTargetXPath,
String prefix)
Remove namespace from target location or locations |
void |
rename(String aTargetXPath,
String name)
Rename elements at target location or locations |
void |
replace(IXDAReadOnly aSource,
String aSourceXPath,
String aTargetXPath)
Replace fragments of this with fragments from source at specified location or locations |
void |
replaceByText(String aTargetXPath,
String aText)
Replace fragments of this with given text at specified location or locations |
static Node |
safeDeepClone(Node aNode)
|
void |
serialize(Writer aWriter,
boolean indent)
Serialize the whole document |
void |
serialize(Writer aWriter,
String aTargetXPath,
boolean indent)
Serialize part of the document |
void |
setDirty()
|
void |
setDirtyNS()
|
void |
setText(String aTargetXPath,
String aText)
Sets the text of the element or elements at the target location of this |
Document |
toDOM()
|
Document |
toDOMQuick()
|
String |
toString()
|
String |
toString(boolean aIndent)
Returns a debug representation of the contained document. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String XMLNS_DECLARATION_URI
Constructor Detail |
public DOMXDA(Document aDocument, boolean clone)
public DOMXDA(Document aDocument)
public DOMXDA(Node aRoot, DOMXDA aParentXDA)
public DOMXDA(Node aRoot, DOMXDA aParentXDA, boolean clone)
public DOMXDA(DOMXDA aOther)
Method Detail |
public Node getRoot()
public Document getDocument()
public void setDirty()
public void setDirtyNS()
public Node getSingleNode(String aXpath) throws XPathLocationException
aXpath
- The Xpath which is expected to have only one node.
NullTargetException
- Thrown if the Xpath has zero nodes.
AmbiguousTargetException
- Thrown if the Xpath has more than one node.
MalformedTargetException
- Thrown if the Xpath is not valid.
AccessViolationException
- Thrown when lock is not held on bean.
XPathLocationException
public Node getSingleNode(NodeList aNodeList) throws XPathLocationException
aNodeList
- The NodeList which is expected to have only one node.
NullTargetException
- Thrown if the NodeList has zero nodes.
AmbiguousTargetException
- Thrown if the node list has more than one node.
XPathLocationException
public NodeList getNodeList(String aXPath) throws XPathLocationException
aXPath
- The XPath to evaluate
MalformedTargetException
- Thrown if the XPath cannot be parsed.
XPathLocationException
public List getNodesFor(String aXPath) throws XPathLocationException
XPathLocationException
public Document getFragment(String aXPath) throws XPathLocationException
XPathLocationException
public Document getFragment(Node node) throws DOMException
DOMException
public static Node safeDeepClone(Node aNode)
public Map getMap(String aTargetXPath, boolean aTrim) throws XPathLocationException
aTrim
- If true the resulting string is trimed at beginning and end for whitespace.
AccessViolationException
- Thrown when lock is not held on bean.
MalformedTargetException
- Thrown if aXPath cannot be parsed.
XPathLocationException
public void append(IXDAReadOnly aSource, String aSourceXPath, String aTargetXPath) throws XPathLocationException, XDOIncompatibilityException
IXDA
append
in interface IXDA
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined element
XDOIncompatibilityException
- throw if the implementation doesn't support this operationpublic void appendPath(String aTargetXPath, String aNewRelativeXPath, String aOptionalValue) throws XPathLocationException
IXDA
appendPath
in interface IXDA
aNewRelativeXPath
- a simple xpath of form a/b/c
to name a chain of elements
to append.aOptionalValue
- a text value to assign to the leaf node, may be null
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void applyNS(String aTargetXPath, String prefix, String uri) throws XPathLocationException
IXDA
applyNS
in interface IXDA
prefix
- prefix for the namespaceuri
- uri for the namespace
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void declareNS(String aTargetXPath, String prefix, String uri) throws XPathLocationException
XPathLocationException
public void delete(String aTargetXPath) throws XPathLocationException
IXDA
delete
in interface IXDA
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic IXPathResult eval(String aTargetXPath) throws XPathLocationException
IXDAReadOnly
eval
in interface IXDAReadOnly
XPathLocationException
- throw if the xpath is malformedpublic String getText(String aTargetXPath, boolean aTrim) throws XPathLocationException
IXDAReadOnly
getText
in interface IXDAReadOnly
aTargetXPath
- the xpathaTrim
- if true trim whitespace from the String
XPathLocationException
- throw if the xpath is malformed or
doesn't point to a single unique elementpublic boolean hasNext()
IXDAIterator
hasNext
in interface IXDAIterator
public void insertAfter(IXDAReadOnly aSource, String aSourceXPath, String aTargetXPath) throws XPathLocationException, XDOIncompatibilityException
IXDA
insertAfter
in interface IXDA
XDOIncompatibilityException
- throw if the implementation doesn't support this operation
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void insertBefore(IXDAReadOnly aSource, String aSourceXPath, String aTargetXPath) throws XPathLocationException, XDOIncompatibilityException
IXDA
insertBefore
in interface IXDA
XDOIncompatibilityException
- throw if the implementation doesn't support this operation
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic boolean isTrue(String aTargetXPath) throws XPathLocationException
IXDAReadOnly
isTrue
in interface IXDAReadOnly
XPathLocationException
- throw if the xpath is malformedpublic IXDAIterator iterator(String aTargetXPath) throws XPathLocationException
IXDA
iterator
in interface IXDA
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic IXDAReadOnlyIterator readOnlyIterator(String aTargetXPath) throws XPathLocationException
IXDAReadOnly
readOnlyIterator
in interface IXDAReadOnly
aTargetXPath
- the xpath
XPathLocationException
- throw if the xpath is malformedpublic void move(String aSourceXPath, String aTargetXPath) throws XPathLocationException
IXDA
move
in interface IXDA
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic boolean next()
IXDAIterator
next
in interface IXDAIterator
public void removeNS(String aTargetXPath, String prefix) throws XPathLocationException
IXDA
removeNS
in interface IXDA
prefix
- prefix for the namespace
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void rename(String aTargetXPath, String name) throws XPathLocationException
IXDA
rename
in interface IXDA
name
- the new element name
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void replace(IXDAReadOnly aSource, String aSourceXPath, String aTargetXPath) throws XPathLocationException, XDOIncompatibilityException
IXDA
replace
in interface IXDA
XDOIncompatibilityException
- throw if the implementation doesn't support this operation
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void replaceByText(String aTargetXPath, String aText) throws XPathLocationException
IXDA
replaceByText
in interface IXDA
aText
- the text to place at locations
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void setText(String aTargetXPath, String aText) throws XPathLocationException
IXDA
setText
in interface IXDA
XPathLocationException
- throw if the xpath is malformed, xpaths don't result in well defined elementpublic void serialize(Writer aWriter, String aTargetXPath, boolean indent) throws XPathLocationException, IOException
IXDAReadOnly
serialize
in interface IXDAReadOnly
aWriter
- the writer to write the serialized document toaTargetXPath
- the xpathindent
- true if the document should be re-indented
XPathLocationException
- throw if the xpath is malformed or
doesn't point to a single unique element
IOException
- throw if the writer cannot be written topublic void serialize(Writer aWriter, boolean indent) throws IOException
IXDAReadOnly
serialize
in interface IXDAReadOnly
aWriter
- the writer to write the serialized document toindent
- true if the document should be re-indented
IOException
- throw if the writer cannot be written topublic String toString(boolean aIndent)
aIndent
- Set to true to cause tidy (human-readable) output of the document.
AccessViolationException
- Thrown when the client thread doesn't have a lock.public String toString()
public Document toDOMQuick()
public Document toDOM()
public String getCurrentXPath()
IXDAIterator
getCurrentXPath
in interface IXDAIterator
public String getPrefix(String aNamespace)
|
NetKernel APIs |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |