|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.hp.hpl.thermopylae.NodeImpl | +--com.hp.hpl.thermopylae.TextImpl
Standard wrapper around spartan Text node.
Copyright (C) 2002 Hewlett-Packard Company. This file is part of Sparta, an XML Parser, DOM, and XPath library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
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, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE |
Method Summary | |
org.w3c.dom.Node |
appendChild(org.w3c.dom.Node parm1)
Adds the node newChild to the end of the list of children
of this node. |
void |
appendData(java.lang.String parm1)
Append the string to the end of the character data of the node. |
org.w3c.dom.Node |
cloneNode(boolean parm1)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. |
void |
deleteData(int parm1,
int parm2)
Remove a range of 16-bit units from the node. |
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. |
java.lang.String |
getData()
The character data of the node that implements this interface. |
org.w3c.dom.Node |
getFirstChild()
The first child of this node. |
boolean |
getIsWhitespaceInElementContent()
Returns whether this text node contains whitespace in element content, often abusively called "ignorable whitespace".An implementation can only return true if, one way or another, it has access
to the relevant information (e.g., the DTD or schema). |
org.w3c.dom.Node |
getLastChild()
The last child of this node. |
int |
getLength()
The number of 16-bit units that are available through data
and the substringData method below. |
java.lang.String |
getLocalName()
Always return null |
java.lang.String |
getNamespaceURI()
Always return null |
java.lang.String |
getNodeName()
The name of this node, depending on its type; see the table above. |
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.Node |
getParentNode()
The parent of this node. |
java.lang.String |
getPrefix()
The namespace prefix of this node, or null if it is
unspecified. |
java.lang.String |
getWholeText()
Returns all text of Text nodes logically-adjacent text
nodes to this node, concatenated in document order. |
boolean |
hasAttributes()
Returns whether this node (if it is an element) has any attributes. |
boolean |
hasChildNodes()
ALways returns false. |
org.w3c.dom.Node |
insertBefore(org.w3c.dom.Node parm1,
org.w3c.dom.Node parm2)
Inserts the node newChild before the existing child node
refChild . |
void |
insertData(int parm1,
java.lang.String parm2)
Insert a string at the specified 16-bit unit offset. |
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 |
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 structure (e.g., elements, comments,
processing instructions, CDATA sections, and entity references)
separates Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes. |
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node parm1)
Removes the child node indicated by oldChild from the list
of children, and returns it. |
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node parm1,
org.w3c.dom.Node parm2)
Replaces the child node oldChild with newChild
in the list of children, and returns the oldChild node. |
void |
replaceData(int parm1,
int parm2,
java.lang.String parm3)
Replace the characters starting at the specified 16-bit unit offset with the specified string. |
org.w3c.dom.Text |
replaceWholeText(java.lang.String content)
Substitutes the a specified text for the text of the current node and all logically-adjacent text nodes. |
void |
setData(java.lang.String parm1)
The character data of the node that implements this interface. |
void |
setNodeValue(java.lang.String data)
The value of this node, depending on its type; see the table above. |
void |
setPrefix(java.lang.String parm1)
The namespace prefix of this node, or null if it is
unspecified. |
org.w3c.dom.Text |
splitText(int parm1)
Breaks this node into two nodes at the specified offset ,
keeping both in the tree as siblings. |
java.lang.String |
substringData(int parm1,
int parm2)
Extracts a range of data from the node. |
Methods inherited from class com.hp.hpl.thermopylae.NodeImpl |
compareTreePosition, equals, getBaseURI, getInterface, getNextSibling, getOwnerDocument, getPreviousSibling, getTextContent, getUserData, isEqualNode, isSameNode, lookupNamespacePrefix, lookupNamespaceURI, setTextContent, setUserData |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Node |
compareTreePosition, getBaseURI, getInterface, getNextSibling, getOwnerDocument, getPreviousSibling, getTextContent, getUserData, isEqualNode, isSameNode, lookupNamespacePrefix, lookupNamespaceURI, setTextContent, setUserData |
Method Detail |
public org.w3c.dom.Text splitText(int parm1) throws org.w3c.dom.DOMException
org.w3c.dom.Text
offset
,
keeping both in the tree as siblings. After being split, this node
will contain all the content up to the offset
point. A
new node of the same type, which contains all the content at and
after the offset
point, is returned. If the original
node had a parent node, the new node is inserted as the next sibling
of the original node. When the offset
is equal to the
length of this node, the new node has no data.splitText
in interface org.w3c.dom.Text
org.w3c.dom.Text
offset
- The 16-bit unit offset at which to split, starting from
0
.org.w3c.dom.DOMException
- INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
than the number of 16-bit units in data
.
public void appendData(java.lang.String parm1) throws org.w3c.dom.DOMException
org.w3c.dom.CharacterData
data
provides access to the concatenation of
data
and the DOMString
specified.appendData
in interface org.w3c.dom.CharacterData
org.w3c.dom.CharacterData
arg
- The DOMString
to append.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public void deleteData(int parm1, int parm2) throws org.w3c.dom.DOMException
org.w3c.dom.CharacterData
data
and length
reflect the change.deleteData
in interface org.w3c.dom.CharacterData
org.w3c.dom.CharacterData
offset
- The offset from which to start removing.count
- The number of 16-bit units to delete. If the sum of
offset
and count
exceeds
length
then all 16-bit units from offset
to the end of the data are deleted.org.w3c.dom.DOMException
- INDEX_SIZE_ERR: Raised if the specified offset
is
negative or greater than the number of 16-bit units in
data
, or if the specified count
is
negative.
public java.lang.String getData() throws org.w3c.dom.DOMException
org.w3c.dom.CharacterData
CharacterData
node. However,
implementation limits may mean that the entirety of a node's data may
not fit into a single DOMString
. In such cases, the user
may call substringData
to retrieve the data in
appropriately sized pieces.
CharacterData
is a Text
, or a
CDATASection
, this attribute contains the property
[character code] defined in . When the CharacterData
is
a Comment
, this attribute contains the property
[content] defined by the Comment Information Item in .getData
in interface org.w3c.dom.CharacterData
org.w3c.dom.CharacterData
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 int getLength()
org.w3c.dom.CharacterData
data
and the substringData
method below. This may have the
value zero, i.e., CharacterData
nodes may be empty.getLength
in interface org.w3c.dom.CharacterData
public void insertData(int parm1, java.lang.String parm2) throws org.w3c.dom.DOMException
org.w3c.dom.CharacterData
insertData
in interface org.w3c.dom.CharacterData
org.w3c.dom.CharacterData
offset
- The character offset at which to insert.arg
- The DOMString
to insert.org.w3c.dom.DOMException
- INDEX_SIZE_ERR: Raised if the specified offset
is
negative or greater than the number of 16-bit units in
data
.
public void replaceData(int parm1, int parm2, java.lang.String parm3) throws org.w3c.dom.DOMException
org.w3c.dom.CharacterData
replaceData
in interface org.w3c.dom.CharacterData
org.w3c.dom.CharacterData
offset
- The offset from which to start replacing.count
- The number of 16-bit units to replace. If the sum of
offset
and count
exceeds
length
, then all 16-bit units to the end of the data
are replaced; (i.e., the effect is the same as a remove
method call with the same range, followed by an append
method invocation).arg
- The DOMString
with which the range must be
replaced.org.w3c.dom.DOMException
- INDEX_SIZE_ERR: Raised if the specified offset
is
negative or greater than the number of 16-bit units in
data
, or if the specified count
is
negative.
public void setData(java.lang.String parm1) throws org.w3c.dom.DOMException
org.w3c.dom.CharacterData
CharacterData
node. However,
implementation limits may mean that the entirety of a node's data may
not fit into a single DOMString
. In such cases, the user
may call substringData
to retrieve the data in
appropriately sized pieces.
CharacterData
is a Text
, or a
CDATASection
, this attribute contains the property
[character code] defined in . When the CharacterData
is
a Comment
, this attribute contains the property
[content] defined by the Comment Information Item in .setData
in interface org.w3c.dom.CharacterData
org.w3c.dom.CharacterData
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 java.lang.String substringData(int parm1, int parm2) throws org.w3c.dom.DOMException
org.w3c.dom.CharacterData
substringData
in interface org.w3c.dom.CharacterData
org.w3c.dom.CharacterData
offset
- Start offset of substring to extract.count
- The number of 16-bit units to extract.offset
and
count
exceeds the length
, then all 16-bit
units to the end of the data are returned.org.w3c.dom.DOMException
- INDEX_SIZE_ERR: Raised if the specified offset
is
negative or greater than the number of 16-bit units in
data
, or if the specified count
is
negative.
DOMString
.public org.w3c.dom.Node appendChild(org.w3c.dom.Node parm1) throws org.w3c.dom.DOMException
org.w3c.dom.Node
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
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 or this node
itself.
newChild
was created
from a different document than the one that created this node.
public org.w3c.dom.Node cloneNode(boolean parm1)
org.w3c.dom.Node
parentNode
is null
.) and no user data. User
data associated to the imported node is not carried over. However, if
any UserDataHandlers
has been specified along with the
associated data these handlers will be called with the appropriate
parameters before this method returns.
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 children it
contains unless it is a deep clone. This includes text contained in
an the Element
since the text is contained in a child
Text
node. Cloning an Attribute
directly,
as opposed to be cloned as part of an Element
cloning
operation, returns a specified attribute (specified
is
true
). Cloning an Attribute
always clones
its children, since they represent its value, no matter whether this
is a deep clone or not. Cloning an EntityReference
automatically constructs its subtree if a corresponding
Entity
is available, no matter whether this is a deep
clone or not. Cloning any other type of node simply returns a copy of
this node.
EntityReference
clone are readonly
. In addition, clones of unspecified Attr
nodes are
specified. And, cloning Document
,
DocumentType
, Entity
, and
Notation
nodes is implementation dependent.cloneNode
in interface org.w3c.dom.Node
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 org.w3c.dom.NamedNodeMap getAttributes()
org.w3c.dom.Node
NamedNodeMap
containing the attributes of this node (if
it is an Element
) or null
otherwise.
getAttributes
in interface org.w3c.dom.Node
public org.w3c.dom.NodeList getChildNodes()
org.w3c.dom.Node
NodeList
that contains all children of this node. If
there are no children, this is a NodeList
containing no
nodes.
Document
, or an
Element
, and if the NodeList
does not
contain EntityReference
or CDATASection
nodes, this attribute represents the properties [children] defined in
.getChildNodes
in interface org.w3c.dom.Node
public org.w3c.dom.Node getFirstChild()
org.w3c.dom.Node
null
.getFirstChild
in interface org.w3c.dom.Node
public org.w3c.dom.Node getLastChild()
org.w3c.dom.Node
null
.getLastChild
in interface org.w3c.dom.Node
public java.lang.String getLocalName()
getLocalName
in interface org.w3c.dom.Node
public java.lang.String getNamespaceURI()
getNamespaceURI
in interface org.w3c.dom.Node
public java.lang.String getNodeName()
org.w3c.dom.Node
getNodeName
in interface org.w3c.dom.Node
public short getNodeType()
org.w3c.dom.Node
getNodeType
in interface org.w3c.dom.Node
public java.lang.String getNodeValue() throws org.w3c.dom.DOMException
org.w3c.dom.Node
null
, setting it has no effect.getNodeValue
in interface org.w3c.dom.Node
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 getParentNode()
org.w3c.dom.Node
Attr
,
Document
, DocumentFragment
,
Entity
, and Notation
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
.
Element
, a
ProcessingInstruction
, an EntityReference
,
a CharacterData
, a Comment
, or a
DocumentType
, this attribute represents the properties
[parent] defined in .getParentNode
in interface org.w3c.dom.Node
public java.lang.String getPrefix()
org.w3c.dom.Node
null
if it is
unspecified.
Element
, or Attr
, this
attribute represents the properties [prefix] defined in .
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.
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
.getPrefix
in interface org.w3c.dom.Node
org.w3c.dom.Node
org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
illegal character, per the XML 1.0 specification .
prefix
is
malformed per the Namespaces in XML specification, 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 boolean hasAttributes()
org.w3c.dom.Node
hasAttributes
in interface org.w3c.dom.Node
org.w3c.dom.Node
true
if this node has any attributes,
false
otherwise.public boolean hasChildNodes()
hasChildNodes
in interface org.w3c.dom.Node
org.w3c.dom.Node
true
if this node has any children,
false
otherwise.public org.w3c.dom.Node insertBefore(org.w3c.dom.Node parm1, org.w3c.dom.Node parm2) throws org.w3c.dom.DOMException
org.w3c.dom.Node
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
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 or this node
itself, or if this node if of type Document
and the
DOM application attempts to insert a second
DocumentType
or Element
node.
newChild
was created
from a different document than the one that created this node.
refChild
is not a child of
this node.
Document
,
this exception might be raised if the DOM implementation doesn't
support the insertion of a DocumentType
or
Element
node.public boolean isSupported(java.lang.String feature, java.lang.String version)
org.w3c.dom.Node
isSupported
in interface org.w3c.dom.Node
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 void normalize()
org.w3c.dom.Node
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only structure (e.g., elements, 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 org.w3c.dom.Node removeChild(org.w3c.dom.Node parm1) throws org.w3c.dom.DOMException
org.w3c.dom.Node
oldChild
from the list
of children, and returns it.removeChild
in interface org.w3c.dom.Node
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.
Document
,
this exception might be raised if the DOM implementation doesn't
support the removal of the DocumentType
child or the
Element
child.public org.w3c.dom.Node replaceChild(org.w3c.dom.Node parm1, org.w3c.dom.Node parm2) throws org.w3c.dom.DOMException
org.w3c.dom.Node
oldChild
with newChild
in the list of children, and returns the oldChild
node.
newChild
is a DocumentFragment
object,
oldChild
is replaced by all of the
DocumentFragment
children, which are inserted in the
same order. If the newChild
is already in the tree, it
is first removed.replaceChild
in interface org.w3c.dom.Node
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 if
the node to put in is one of this node's ancestors or this node
itself.
newChild
was created
from a different document than the one that created this node.
oldChild
is not a child of
this node.
Document
,
this exception might be raised if the DOM implementation doesn't
support the replacement of the DocumentType
child or
Element
child.public void setNodeValue(java.lang.String data) throws org.w3c.dom.DOMException
org.w3c.dom.Node
null
, setting it has no effect.setNodeValue
in interface org.w3c.dom.Node
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 void setPrefix(java.lang.String parm1) throws org.w3c.dom.DOMException
org.w3c.dom.Node
null
if it is
unspecified.
Element
, or Attr
, this
attribute represents the properties [prefix] defined in .
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.
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
.setPrefix
in interface org.w3c.dom.Node
org.w3c.dom.Node
org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
illegal character, per the XML 1.0 specification .
prefix
is
malformed per the Namespaces in XML specification, 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 boolean getIsWhitespaceInElementContent()
org.w3c.dom.Text
true
if, one way or another, it has access
to the relevant information (e.g., the DTD or schema).
getIsWhitespaceInElementContent
in interface org.w3c.dom.Text
public java.lang.String getWholeText()
org.w3c.dom.Text
Text
nodes logically-adjacent text
nodes to this node, concatenated in document order.getWholeText
in interface org.w3c.dom.Text
public org.w3c.dom.Text replaceWholeText(java.lang.String content) throws org.w3c.dom.DOMException
org.w3c.dom.Text
EntityReference
, the EntityReference
must
be removed instead of the read-only nodes. If any
EntityReference
to be removed has descendants that are
not EntityReference
, Text
, or
CDATASection
nodes, the replaceWholeText
method must fail before performing any modification of the document,
raising a DOMException
with the code
NO_MODIFICATION_ALLOWED_ERR
.replaceWholeText
in interface org.w3c.dom.Text
org.w3c.dom.Text
content
- The content of the replacing Text
node.Text
node created with the specified content.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if one of the Text
nodes being replaced is readonly.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |