|
Enhydra 3.0.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.xml.xmlc.XMLObjectImpl
Base class for all compiled XML objects.
XMLObject
Fields inherited from interface org.enhydra.xml.xmlc.XMLObject |
XMLC_GENERATED_CLASS_FIELD_NAME,
XMLC_SOURCE_FILE_FIELD_NAME |
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 |
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 | |
protected |
XMLObjectImpl()
Constructor. |
Method Summary | |
Node |
appendChild(Node newChild)
Adds the node newChild to the end of the list of children
of this node. |
protected void |
cloneDeepCheck(boolean deep)
Check that cloneNode on an entire document is done with the deep option. |
abstract Node |
cloneNode(boolean deep)
Clone the entire document. |
Attr |
createAttribute(java.lang.String qualifiedName)
Creates an Attr of the given name. |
Attr |
createAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Creates an attribute of the given qualified name and namespace URI. |
CDATASection |
createCDATASection(java.lang.String data)
Creates a CDATASection node whose value is the specified
string. |
Comment |
createComment(java.lang.String data)
Creates a Comment node given the specified string. |
DocumentFragment |
createDocumentFragment()
Creates an empty DocumentFragment object. |
Element |
createElement(java.lang.String tagName)
Creates an element of the type specified. |
Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Creates an element of the given qualified name and namespace URI. |
EntityReference |
createEntityReference(java.lang.String name)
Creates an EntityReference object. |
ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data)
Creates a ProcessingInstruction node given the specified
name and data strings. |
Text |
createTextNode(java.lang.String data)
Creates a Text node given the specified string. |
NamedNodeMap |
getAttributes()
A NamedNodeMap containing the attributes of this node (if
it is an Element ) or null otherwise. |
NodeList |
getChildNodes()
A NodeList that contains all children of this node. |
XMLObject |
getDelegate()
Get the delegate. |
DocumentType |
getDoctype()
The Document Type Declaration (see DocumentType )
associated with this document. |
Document |
getDocument()
Get the actual document object. |
Element |
getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document. |
Element |
getElementById(java.lang.String elementId)
Returns the Element whose ID is given by
elementId . |
NodeList |
getElementsByTagName(java.lang.String tagname)
Returns a NodeList of all the Elements with a
given tag name in the order in which they would be encountered in a
preorder traversal of the Document tree. |
NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
Returns a NodeList of all the Elements with a
given local name and namespace URI in the order in which they would be
encountered in a preorder traversal of the Document tree. |
java.lang.String |
getEncoding()
Get the encoding specified in the document. |
Node |
getFirstChild()
The first child of this node. |
DOMImplementation |
getImplementation()
The DOMImplementation object that handles this document. |
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. |
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. |
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. |
Document |
getOwnerDocument()
The Document object associated with this node. |
Node |
getParentNode()
The parent of this node. |
java.lang.String |
getPrefix()
The namespace prefix of this node, or null if it is
unspecified. |
Node |
getPreviousSibling()
The node immediately preceding this node. |
boolean |
hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children. |
Node |
importNode(Node importedNode,
boolean deep)
Imports a node from another document to this document. |
void |
initFields()
Deprecated. Use syncAccessMethods() instead. |
Node |
insertBefore(Node newChild,
Node refChild)
Inserts the node newChild before the existing child node
refChild . |
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 no adjacent Text
nodes. |
Node |
removeChild(Node oldChild)
Removes the child node indicated by oldChild from the list
of children, and returns it. |
Node |
replaceChild(Node newChild,
Node oldChild)
Replaces the child node oldChild with newChild
in the list of children, and returns the oldChild node. |
void |
setDelegate(XMLObject delegate)
Set the delegate object. |
protected void |
setDocument(Document doc)
Set the DOM document associated with this object. |
protected void |
setEncoding(java.lang.String enc)
Set the encoding. |
void |
setNodeValue(java.lang.String nodeValue)
|
void |
setPrefix(java.lang.String prefix)
|
boolean |
supports(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 |
syncAccessMethods()
Initialize the fields used by the generated access methods from the current state of the document. |
protected abstract void |
syncWithDocument(Node node)
Generated function to synchronize the fields used by the access methods. |
java.lang.String |
toDocument()
Convert the document to a string representation of the document, that is a string containing XML. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
protected XMLObjectImpl()
Method Detail |
protected void setDocument(Document doc)
protected void setEncoding(java.lang.String enc)
public Document getDocument()
XMLObject.getDocument()
public java.lang.String getEncoding()
XMLObject.getEncoding()
public void setDelegate(XMLObject delegate)
XMLObject.setDelegate(org.enhydra.xml.xmlc.XMLObject)
public XMLObject getDelegate()
XMLObject.getDelegate()
protected void cloneDeepCheck(boolean deep)
public abstract Node cloneNode(boolean deep)
Node.cloneNode(boolean)
public DocumentType getDoctype()
DocumentType
)
associated with this document. For HTML documents as well as XML
documents without a document type declaration this returns
null
. The DOM Level 2 does not support editing the
Document Type Declaration, therefore docType
cannot be
altered in any way, including through the use of methods, such as
insertNode
or removeNode
, inherited from
Node
.Document.getDoctype()
public DOMImplementation getImplementation()
DOMImplementation
object that handles this document. A
DOM application may use objects from multiple implementations.Document.getImplementation()
public Element getDocumentElement()
Document.getDocumentElement()
public Node importNode(Node importedNode, boolean deep) throws DOMException
parentNode
is null
). The
source node is not altered or removed from the original document; this
method creates a new copy of the source node.
nodeName
and nodeType
, plus the
attributes related to namespaces (prefix and namespaces URI). As in the
cloneNode
operation on a Node
, the source
node is not altered.
nodeType
, attempting to mirror the behavior expected if a
fragment of XML or HTML source was copied from one document to another,
recognizing that the two documents may have different DTDs in the XML
case. The following list describes the specifics for every type of
node. ELEMENT_NODESpecified attribute nodes of the source element are
imported, and the generated Attr
nodes are attached to
the generated Element
. Default attributes are not copied,
though if the document being imported into defines default attributes
for this element name, those are assigned. If importNode
deep
parameter was set to true
, the
descendants of the source element will be recursively imported and the
resulting nodes reassembled to form the corresponding subtree.
ATTRIBUTE_NODEThe specified
flag is set to
true
on the generated Attr
. The descendants
of the the source Attr
are recursively imported and the
resulting nodes reassembled to form the corresponding subtree.Note
that the deep
parameter does not apply to
Attr
nodes; they always carry their children with them
when imported.TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODEThese three
types of nodes inheriting from CharacterData
copy their
data
and length
attributes from those of the
source node.ENTITY_REFERENCE_NODEOnly the EntityReference
itself is copied, even if a deep
import is requested,
since the source and destination documents might have defined the
entity differently. If the document being imported into provides a
definition for this entity name, its value is assigned.ENTITY_NODE
Entity
nodes can be imported, however in the current
release of the DOM the DocumentType
is readonly. Ability
to add these imported nodes to a DocumentType
will be
considered for addition to a future release of the DOM.On import, the
publicId
, systemId
, and
notationName
attributes are copied. If a deep
import is requested, the descendants of the the source
Entity
is recursively imported and the resulting nodes
reassembled to form the corresponding subtree.
PROCESSING_INSTRUCTION_NODEThe imported node copies its
target
and data
values from those of the
source node.DOCUMENT_NODEDocument
nodes cannot be
imported.DOCUMENT_TYPE_NODEDocumentType
nodes cannot be
imported.DOCUMENT_FRAGMENT_NODEIf the deep
option was set
true
, the descendants of the source element will be
recursively imported and the resulting nodes reassembled to form the
corresponding subtree. Otherwise, this simply generates an empty
DocumentFragment
.NOTATION_NODENotation
nodes
can be imported, however in the current release of the DOM the
DocumentType
is readonly. Ability to add these imported
nodes to a DocumentType
will be considered for addition
to a future release of the DOM.On import, the publicId
,
and systemId
attributes are copied.Note that the
deep
parameter does not apply to Notation
nodes since they never have any children.Document.importNode(org.w3c.dom.Node, boolean)
public Element createElement(java.lang.String tagName) throws DOMException
Element
interface, so attributes
can be specified directly on the returned object.
Attr
nodes representing them are automatically created and
attached to the element.
createElementNS
method.Document.createElement(java.lang.String)
public Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws DOMException
namespaceURI
is null
or an empty
string and the qualifiedName
has a prefix that is "xml",
the created element is bound to the predefined namespace
"http://www.w3.org/XML/1998/namespace" .
Document.createElementNS(java.lang.String, java.lang.String)
public DocumentFragment createDocumentFragment()
DocumentFragment
object.Document.createDocumentFragment()
public Text createTextNode(java.lang.String data)
Text
node given the specified string.Document.createTextNode(java.lang.String)
public Comment createComment(java.lang.String data)
Comment
node given the specified string.Document.createComment(java.lang.String)
public CDATASection createCDATASection(java.lang.String data) throws DOMException
CDATASection
node whose value is the specified
string.Document.createCDATASection(java.lang.String)
public ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data) throws DOMException
ProcessingInstruction
node given the specified
name and data strings.Document.createProcessingInstruction(java.lang.String, java.lang.String)
public Attr createAttribute(java.lang.String qualifiedName) throws DOMException
Attr
of the given name. Note that the
Attr
instance can then be set on an Element
using the setAttribute
method.
createAttributeNS
method.Document.createAttribute(java.lang.String)
public Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws DOMException
namespaceURI
is null
or an empty
string and the qualifiedName
has a prefix that is "xml",
the created attribute is bound to the predefined namespace
"http://www.w3.org/XML/1998/namespace" .
Document.createAttributeNS(java.lang.String, java.lang.String)
public EntityReference createEntityReference(java.lang.String name) throws DOMException
EntityReference
object. In addition, if the
referenced entity is known, the child list of the
EntityReference
node is made the same as that of the
corresponding Entity
node.If any descendant of the
Entity
node has an unbound namespace prefix, the
corresponding descendant of the created EntityReference
node is also unbound (its namespaceURI
is
null
). The DOM Level 2 does not support any mechanism to
resolve namespace prefixes.Document.createEntityReference(java.lang.String)
public NodeList getElementsByTagName(java.lang.String tagname)
NodeList
of all the Elements
with a
given tag name in the order in which they would be encountered in a
preorder traversal of the Document
tree.Document.getElementsByTagName(java.lang.String)
public NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
NodeList
of all the Elements
with a
given local name and namespace URI in the order in which they would be
encountered in a preorder traversal of the Document
tree.Document.getElementsByTagNameNS(java.lang.String, java.lang.String)
public Element getElementById(java.lang.String elementId)
Element
whose ID
is given by
elementId
. If no such element exists, returns
null
. Behavior is not defined if more than one element has
this ID
. The DOM implementation must have information
that says which attributes are of type ID. Attributes with the name
"ID" are not of type ID unless so defined. Implementations that do not
know whether attributes are of type ID or not are expected to return
null
.Document.getElementById(java.lang.String)
public java.lang.String getNodeName()
Node.getNodeName()
public java.lang.String getNodeValue() throws DOMException
null
, setting it has no effect.Node.getNodeValue()
public void setNodeValue(java.lang.String nodeValue) throws DOMException
Node.setNodeValue(java.lang.String)
public short getNodeType()
Node.getNodeType()
public Node getParentNode()
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
.Node.getParentNode()
public 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.Node.getChildNodes()
public Node getFirstChild()
null
.Node.getFirstChild()
public Node getLastChild()
null
.Node.getLastChild()
public Node getPreviousSibling()
null
.Node.getPreviousSibling()
public Node getNextSibling()
null
.Node.getNextSibling()
public NamedNodeMap getAttributes()
NamedNodeMap
containing the attributes of this node (if
it is an Element
) or null
otherwise.Node.getAttributes()
public 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
or a DocumentType
which is not used with any Document
yet, this is
null
.Node.getOwnerDocument()
public Node insertBefore(Node newChild, Node refChild) throws 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.Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
oldChild
with newChild
in the list of children, and returns the oldChild
node.
newChild
is a DocumentFragment
object,
refChild
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.Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
public Node removeChild(Node oldChild) throws DOMException
oldChild
from the list
of children, and returns it.Node.removeChild(org.w3c.dom.Node)
public Node appendChild(Node newChild) throws 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.Node.appendChild(org.w3c.dom.Node)
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 no adjacent 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.Node.normalize()
public boolean supports(java.lang.String feature, java.lang.String version)
Node.supports(String, String)
public 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.Node.getNamespaceURI()
public 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.Node.getPrefix()
public void setPrefix(java.lang.String prefix)
Node.setPrefix(java.lang.String)
public java.lang.String getLocalName()
createElement
from the Document
interface,
it is null
.Node.getLocalName()
public boolean hasChildNodes()
Node.hasChildNodes()
public java.lang.String toDocument()
org.enhydra.xml.io.DOMFormatter DOMFormatter
class if
more options are required.XMLObject.toDocument()
protected abstract void syncWithDocument(Node node)
public void syncAccessMethods()
null
.XMLObject.syncAccessMethods()
public void initFields()
syncAccessMethods()
instead.
syncAccessMethods
|
Enhydra 3.0.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |