|
Xindice API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xindice.xml.dom.NodeImpl
NodeImpl implements the foundation of the Xindice compressed DOM.
Field Summary | |
static org.w3c.dom.DOMException |
EX_DOMSTRING_SIZE
|
static org.w3c.dom.DOMException |
EX_HIERARCHY_REQUEST
|
static org.w3c.dom.DOMException |
EX_INDEX_SIZE
|
static org.w3c.dom.DOMException |
EX_INUSE_ATTRIBUTE
|
static org.w3c.dom.DOMException |
EX_INVALID_STATE
|
static org.w3c.dom.DOMException |
EX_NO_DATA_ALLOWED
|
static org.w3c.dom.DOMException |
EX_NO_MODIFICATION_ALLOWED
|
static org.w3c.dom.DOMException |
EX_NOT_FOUND
|
static org.w3c.dom.DOMException |
EX_WRONG_DOCUMENT
|
static java.lang.String |
OBJECT_HREF
|
static java.lang.String |
OBJECT_NS
|
static java.lang.String |
OBJECT_TYPE
|
static java.lang.String |
TYPE_APPEND
|
static java.lang.String |
TYPE_CONTENT
|
static java.lang.String |
TYPE_INSERT
|
static java.lang.String |
TYPE_REPLACE
|
static java.lang.String |
XMLNS_PREFIX
|
Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
Constructor Summary | |
NodeImpl()
|
|
NodeImpl(byte[] data,
int pos,
int len)
|
|
NodeImpl(NodeImpl parentNode,
boolean dirty)
|
|
NodeImpl(NodeImpl parentNode,
byte[] data,
int pos,
int len)
|
Method Summary | |
org.w3c.dom.Node |
appendChild(org.w3c.dom.Node newChild)
Adds the node newChild to the end of the list of children of
this node. |
void |
checkReadOnly()
|
org.w3c.dom.Node |
cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. |
void |
expandSource()
expandSource expands the source into the Node as a namespace and a set of attributes. |
org.w3c.dom.NamedNodeMap |
getAttributes()
A NamedNodeMap containing the attributes of this node (if it
is an Element ) or null otherwise. |
org.w3c.dom.NodeList |
getChildNodes()
A NodeList that contains all children of this node. |
byte[] |
getDataBytes()
getDataBytes returns the byte array that defines this Node. |
int |
getDataLen()
getDataLen returns the length of the Node's definition in the byte array. |
int |
getDataPos()
getDataPos returns the offset into the Node definition's byte array that the Node starts at. |
org.w3c.dom.Node |
getFirstChild()
The first child of this node. |
java.lang.Object |
getKey()
This attribute returns a unique key identifying this node.What type should this really be?In what space is this key unique (Document, DOMImplementation)?What is the lifetime of the uniqueness of this key (Node, Document, ...)? |
org.w3c.dom.Node |
getLastChild()
The last child of this node. |
java.lang.String |
getLocalName()
Returns the local part of the qualified name of this node. |
java.lang.String |
getNamespaceURI()
The namespace URI of this node, or null if it is
unspecified. |
org.w3c.dom.Node |
getNextSibling()
The node immediately following this node. |
java.lang.String |
getNodeName()
The name of this node, depending on its type; see the table above. |
abstract short |
getNodeType()
A code representing the type of the underlying object, as defined above. |
java.lang.String |
getNodeValue()
The value of this node, depending on its type; see the table above. |
org.w3c.dom.Document |
getOwnerDocument()
The Document object associated with this node. |
org.w3c.dom.Node |
getParentNode()
The parent of this node. |
java.lang.String |
getPrefix()
The namespace prefix of this node, or null if it is
unspecified. |
org.w3c.dom.Node |
getPreviousSibling()
The node immediately preceding this node. |
NodeSource |
getSource()
getSource returns a source for this Node. |
short |
getSymbolID()
getSymbolID returns the Symbol ID for the current node. |
java.lang.Object |
getUserData(java.lang.String key)
This method allows to retreive a user object previously attached to a Node with setUserData . |
boolean |
hasAttributes()
|
boolean |
hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children. |
org.w3c.dom.Node |
insertBefore(org.w3c.dom.Node newChild,
org.w3c.dom.Node refChild)
Inserts the node newChild before the existing child node
refChild . |
boolean |
isDefined()
|
boolean |
isDirty()
isDirty returns whether or not the current Node (or any of its children) have been modified since being loaded. |
boolean |
isLoaded()
isLoaded returns whether or not the Node's definition has been loaded. |
boolean |
isSameNode(org.w3c.dom.Node other)
Returns whether this node is the same node as the given one. |
boolean |
isSupported(java.lang.String feature,
java.lang.String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node. |
void |
load()
load forces the Node to be graphed for this level. |
java.lang.String |
lookupDefaultNamespaceURI()
getDefaultNamespaceURI returns the default Namespace URI in this scope. |
java.lang.String |
lookupNamespacePrefix(java.lang.String namespaceURI)
Look up the prefix associated to the given namespace URI, starting from this node. |
java.lang.String |
lookupNamespaceURI(java.lang.String prefix)
Look up the namespace URI associated to the given prefix, starting from this node.Name? May need to change depending on ending of the relative namespace URI reference nightmare. |
void |
normalize()
Puts all Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes. |
void |
normalizeNS()
This method walks down the tree, starting from this node, and adds namespace declarations where needed so that every namespace being used is properly declared. |
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node oldChild)
Removes the child node indicated by oldChild from the list
of children, and returns it. |
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node newChild,
org.w3c.dom.Node oldChild)
Replaces the child node oldChild with newChild
in the list of children, and returns the oldChild node. |
void |
setDataBytes(byte[] data)
setDataBytes sets the byte array that defines this Node. |
void |
setDataBytes(byte[] data,
int pos,
int len)
setDataBytes sets the definition and positional information for the Node. |
void |
setDataLen(int len)
setDataLen sets the length of the Node's definition in the byte array. |
void |
setDataPos(int pos)
setDataPos sets the offset into the Node definition's byte array that the Node starts at. |
void |
setDirty()
|
void |
setNodeName(java.lang.String nodeName)
|
void |
setNodeValue(java.lang.String nodeValue)
The value of this node, depending on its type; see the table above. |
void |
setParentNode(NodeImpl parentNode)
|
void |
setPrefix(java.lang.String prefix)
The namespace prefix of this node, or null if it is
unspecified. |
void |
setSource(NodeSource source)
setSource sets a source for this Node. |
java.lang.Object |
setUserData(java.lang.Object data,
java.lang.String key)
This method allows to attach a user object to a Node. |
void |
unload()
unload forces the Node to be unloaded for this level. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String XMLNS_PREFIX
public static final java.lang.String OBJECT_NS
public static final java.lang.String OBJECT_HREF
public static final java.lang.String OBJECT_TYPE
public static final java.lang.String TYPE_CONTENT
public static final java.lang.String TYPE_REPLACE
public static final java.lang.String TYPE_INSERT
public static final java.lang.String TYPE_APPEND
public static final org.w3c.dom.DOMException EX_NO_MODIFICATION_ALLOWED
public static final org.w3c.dom.DOMException EX_INUSE_ATTRIBUTE
public static final org.w3c.dom.DOMException EX_WRONG_DOCUMENT
public static final org.w3c.dom.DOMException EX_NOT_FOUND
public static final org.w3c.dom.DOMException EX_HIERARCHY_REQUEST
public static final org.w3c.dom.DOMException EX_NO_DATA_ALLOWED
public static final org.w3c.dom.DOMException EX_INVALID_STATE
public static final org.w3c.dom.DOMException EX_DOMSTRING_SIZE
public static final org.w3c.dom.DOMException EX_INDEX_SIZE
Constructor Detail |
public NodeImpl()
public NodeImpl(byte[] data, int pos, int len)
public NodeImpl(NodeImpl parentNode, byte[] data, int pos, int len)
public NodeImpl(NodeImpl parentNode, boolean dirty)
Method Detail |
public final boolean isLoaded()
CompressedNode
isLoaded
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
public void load()
CompressedNode
load
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
org.w3c.dom.DOMException
- if an exception occurspublic void unload()
CompressedNode
unload
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
org.w3c.dom.DOMException
- if an exception occurspublic short getSymbolID()
CompressedNode
getSymbolID
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
public final void checkReadOnly() throws org.w3c.dom.DOMException
public final boolean isDefined()
public final boolean isDirty()
CompressedNode
isDirty
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
public final void setDirty()
public byte[] getDataBytes()
CompressedNode
getDataBytes
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
public void setDataBytes(byte[] data, int pos, int len)
CompressedNode
setDataBytes
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
data
- The Node definition's byte arraypos
- The Node's positionlen
- The Node's lengthpublic void setDataBytes(byte[] data)
CompressedNode
setDataBytes
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
data
- The Node definition's byte arraypublic int getDataPos()
CompressedNode
getDataPos
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
public void setDataPos(int pos)
CompressedNode
setDataPos
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
pos
- The Node's positionpublic int getDataLen()
CompressedNode
getDataLen
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
public void setDataLen(int len)
CompressedNode
setDataLen
in interface CompressedNode
org.apache.xindice.xml.dom.CompressedNode
len
- The Node's lengthpublic final void setNodeName(java.lang.String nodeName)
public final void setParentNode(NodeImpl parentNode)
public final void setSource(NodeSource source)
DBNode
setSource
in interface DBNode
org.apache.xindice.xml.dom.DBNode
source
- The Document sourceorg.w3c.dom.DOMException
- if an exception occurspublic final NodeSource getSource()
DBNode
getSource
in interface DBNode
org.apache.xindice.xml.dom.DBNode
public void expandSource()
DBNode
expandSource
in interface DBNode
public abstract short getNodeType()
getNodeType
in interface org.w3c.dom.Node
public org.w3c.dom.Node getLastChild()
null
.getLastChild
in interface org.w3c.dom.Node
public final org.w3c.dom.Node getPreviousSibling()
null
.getPreviousSibling
in interface org.w3c.dom.Node
public final org.w3c.dom.Node getNextSibling()
null
.getNextSibling
in interface org.w3c.dom.Node
public org.w3c.dom.NamedNodeMap getAttributes()
NamedNodeMap
containing the attributes of this node (if it
is an Element
) or null
otherwise.getAttributes
in interface org.w3c.dom.Node
public boolean hasAttributes()
hasAttributes
in interface org.w3c.dom.Node
public final org.w3c.dom.Document getOwnerDocument()
Document
object associated with this node. This is also
the Document
object used to create new nodes. When this
node is a Document
this is null
.getOwnerDocument
in interface org.w3c.dom.Node
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException
newChild
before the existing child node
refChild
. If refChild
is null
,
insert newChild
at the end of the list of children.
newChild
is a DocumentFragment
object,
all of its children are inserted, in the same order, before
refChild
. If the newChild
is already in the
tree, it is first removed.insertBefore
in interface org.w3c.dom.Node
newChild
- The node to insert.refChild
- The reference node, i.e., the node before which the new
node must be inserted.org.w3c.dom.DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
allow children of the type of the newChild
node, or if
the node to insert is one of this node's ancestors.
newChild
was created
from a different document than the one that created this node.
refChild
is not a child of
this node.public org.w3c.dom.NodeList getChildNodes()
NodeList
that contains all children of this node. If there
are no children, this is a NodeList
containing no nodes.
The content of the returned NodeList
is "live" in the sense
that, for instance, changes to the children of the node object that
it was created from are immediately reflected in the nodes returned by
the NodeList
accessors; it is not a static snapshot of the
content of the node. This is true for every NodeList
,
including the ones returned by the getElementsByTagName
method.getChildNodes
in interface org.w3c.dom.Node
public void setNodeValue(java.lang.String nodeValue) throws org.w3c.dom.DOMException
null
, setting it has no effect.setNodeValue
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.org.w3c.dom.DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters
than fit in a DOMString
variable on the implementation
platform.public final org.w3c.dom.Node getParentNode()
Document
,
DocumentFragment
, and Attr
may have a parent.
However, if a node has just been created and not yet added to the tree,
or if it has been removed from the tree, this is null
.getParentNode
in interface org.w3c.dom.Node
public org.w3c.dom.Node getFirstChild()
null
.getFirstChild
in interface org.w3c.dom.Node
public java.lang.String getNodeName()
getNodeName
in interface org.w3c.dom.Node
public java.lang.String getNodeValue() throws org.w3c.dom.DOMException
getNodeValue
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.org.w3c.dom.DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters than
fit in a DOMString
variable on the implementation
platform.public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
oldChild
with newChild
in the list of children, and returns the oldChild
node. If
the newChild
is already in the tree, it is first removed.replaceChild
in interface org.w3c.dom.Node
newChild
- The new node to put in the child list.oldChild
- The node being replaced in the list.org.w3c.dom.DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
allow children of the type of the newChild
node, or it
the node to put in is one of this node's ancestors.
newChild
was created
from a different document than the one that created this node.
oldChild
is not a child of
this node.public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
oldChild
from the list
of children, and returns it.removeChild
in interface org.w3c.dom.Node
oldChild
- The node being removed.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
oldChild
is not a child of
this node.public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws org.w3c.dom.DOMException
newChild
to the end of the list of children of
this node. If the newChild
is already in the tree, it is
first removed.appendChild
in interface org.w3c.dom.Node
newChild
- The node to add.If it is a DocumentFragment
object, the entire contents of the document fragment are moved into
the child list of this nodeorg.w3c.dom.DOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
allow children of the type of the newChild
node, or if
the node to append is one of this node's ancestors.
newChild
was created
from a different document than the one that created this node.
public boolean hasChildNodes()
hasChildNodes
in interface org.w3c.dom.Node
true
if the node has any children,
false
if the node has no children.public final org.w3c.dom.Node cloneNode(boolean deep)
parentNode
returns null
.).
Element
copies all attributes and their
values, including those generated by the XML processor to represent
defaulted attributes, but this method does not copy any text it contains
unless it is a deep clone, since the text is contained in a child
Text
node. Cloning any other type of node simply returns a
copy of this node.cloneNode
in interface org.w3c.dom.Node
deep
- If true
, recursively clone the subtree under the
specified node; if false
, clone only the node itself (and
its attributes, if it is an Element
).public void normalize()
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text
nodes, i.e., there are neither adjacent
Text
nodes nor empty Text
nodes. This can be
used to ensure that the DOM view of a document is the same as if it
were saved and re-loaded, and is useful when operations (such as
XPointer lookups) that depend on a particular document tree structure
are to be used. In cases where the document contains
CDATASections
, the normalize operation alone may not be
sufficient, since XPointers do not differentiate between
Text
nodes and CDATASection
nodes.normalize
in interface org.w3c.dom.Node
public final boolean isSupported(java.lang.String feature, java.lang.String version)
isSupported
in interface org.w3c.dom.Node
feature
- The name of the feature to test. This is the same name
which can be passed to the method hasFeature
on
DOMImplementation
.version
- This is the version number of the feature to test. In
Level 2, version 1, this is the string "2.0". If the version is not
specified, supporting any version of the feature will cause the
method to return true
.true
if the specified feature is supported
on this node, false
otherwise.public final java.lang.String getNamespaceURI()
null
if it is
unspecified.
ELEMENT_NODE
and
ATTRIBUTE_NODE
and nodes created with a DOM Level 1
method, such as createElement
from the
Document
interface, this is always null
.
Per the Namespaces in XML Specification an attribute does not
inherit its namespace from the element it is attached to. If an
attribute is not explicitly given a namespace, it simply has no
namespace.getNamespaceURI
in interface org.w3c.dom.Node
public final java.lang.String getPrefix()
null
if it is
unspecified.
nodeName
attribute, which holds the qualified name , as
well as the tagName
and name
attributes of
the Element
and Attr
interfaces, when
applicable.
namespaceURI
and localName
do not change.getPrefix
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
illegal character.
prefix
is
malformed, if the namespaceURI
of this node is
null
, if the specified prefix is "xml" and the
namespaceURI
of this node is different from
"http://www.w3.org/XML/1998/namespace", if this node is an attribute
and the specified prefix is "xmlns" and the namespaceURI
of this node is different from "http://www.w3.org/2000/xmlns/", or
if this node is an attribute and the qualifiedName
of
this node is "xmlns" .public final void setPrefix(java.lang.String prefix)
null
if it is
unspecified.
nodeName
attribute, which holds the qualified name , as
well as the tagName
and name
attributes of
the Element
and Attr
interfaces, when
applicable.
namespaceURI
and localName
do not change.setPrefix
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
illegal character.
prefix
is
malformed, if the namespaceURI
of this node is
null
, if the specified prefix is "xml" and the
namespaceURI
of this node is different from
"http://www.w3.org/XML/1998/namespace", if this node is an attribute
and the specified prefix is "xmlns" and the namespaceURI
of this node is different from "http://www.w3.org/2000/xmlns/", or
if this node is an attribute and the qualifiedName
of
this node is "xmlns" .public final java.lang.String getLocalName()
createElement
from the Document
interface,
it is null
.getLocalName
in interface org.w3c.dom.Node
public final java.lang.String lookupDefaultNamespaceURI()
public final boolean isSameNode(org.w3c.dom.Node other)
otherThe
- node to test against.true
if the nodes are the same,
false
otherwise.public final java.lang.String lookupNamespacePrefix(java.lang.String namespaceURI)
namespaceURIThe
- namespace URI to look for.null
if none is found.public final java.lang.String lookupNamespaceURI(java.lang.String prefix)
prefixThe
- prefix to look for.null
if
none is found.public void normalizeNS() throws org.w3c.dom.DOMException
public final java.lang.Object setUserData(java.lang.Object data, java.lang.String key)
getUserData
.Is this really worth
it?Could we live without a key?What happens if the node is cloned,
imported, adopted? Should some event mechanism be specified to notify
the application?What happens if the node is cloned?What should Object
be mapped to in ECMAScript? For IDL we need to define this type
somehow.dataThe
- piece of data to attach to this node.keyThe
- key to associate this data to.null
.public final java.lang.Object getUserData(java.lang.String key)
setUserData
.keyThe
- key to look for.null
.public final java.lang.Object getKey()
|
Xindice API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |