|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
oracle.xml.parser.v2.XMLElement
Element
, XMLParser
, NodeFactory
, DOMParser.setNodeFactory(oracle.xml.parser.v2.NodeFactory)
, Serialized FormFields 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 | |
XMLElement() Deprecated. use createElement(String) method of XMLDocument |
|
XMLElement(java.lang.String tag) Creates an element with the given name |
|
XMLElement(java.lang.String name, java.lang.String prefix, java.lang.String namespace) Creates an element with the given name, prefix, and namespace |
|
XMLElement(java.lang.String name, java.lang.String prefix, java.lang.String qname, java.lang.String namespace) Private constructor doesn't intern names Creates an element with the given name, prefix, and namespace |
Method Summary | |
Node |
cloneNode(boolean deep) Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. |
java.lang.String |
getAttribute(java.lang.String name) Retrieves an attribute value by name. |
Attr |
getAttributeNode(java.lang.String name) Retrieves an Attr node by name. |
Attr |
getAttributeNode(java.lang.String name, java.lang.String namespace) Deprecated. As of DOM 2 |
Attr |
getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName) Retrieves an Attr node by local name and namespace URI. |
java.lang.String |
getAttributeNS(java.lang.String namespaceURI, java.lang.String localName) Retrieves an attribute value by local name and namespace URI. |
NamedNodeMap |
getAttributes() A NamedNodeMap containing the attributes of this node (if it is an Element ) or null otherwise. |
NodeList |
getChildrenByTagName(java.lang.String name) Returns a NodeList of all immediate children with a given tag name, |
NodeList |
getChildrenByTagName(java.lang.String name, java.lang.String ns) Returns a NodeList of all immediate children with a given tag name and namespace |
NodeList |
getElementsByTagName(java.lang.String name) Returns a NodeList of all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the Element tree. |
NodeList |
getElementsByTagName(java.lang.String name, java.lang.String ns) Deprecated. As of DOM 2 |
NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName) Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. |
java.lang.String |
getExpandedName() Get the fully resolved name for this element. |
XMLNode |
getFirstAttribute() Retrieves the first Attr . |
java.lang.String |
getLocalName() Gets the local Name for this element. |
java.lang.String |
getNamespace() Get the resolved Namespace for this name |
java.lang.String |
getNamespaceURI() The namespace URI of this node, or null if it is unspecified. |
short |
getNodeType() Gets a code representing the type of the underlying object |
java.lang.String |
getPrefix() Get the namespace prefix for this element. |
java.lang.String |
getQualifiedName() Get the qualified name for this element. |
java.lang.String |
getTagName() Gets the name of the element. |
boolean |
hasAttribute(java.lang.String name) Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise. |
boolean |
hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName) Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise. |
boolean |
hasAttributes() Returns whether this node (if it is an element) has any attributes. |
void |
normalize() Deprecated. As of DOM 2 |
void |
readExternal(java.io.ObjectInput inArg) This method restores the information written by writeExternal by reading the input stream and regenerating the objects as per the information of the input stream. |
void |
readExternal(oracle.xml.io.XMLObjectInput in, oracle.xml.comp.CXMLContext cxmlContext) This method restores the information written by writeExternal by reading the input stream and regenerating the objects as per the information of the input stream. |
void |
removeAttribute(java.lang.String name) Removes an attribute by name. |
Attr |
removeAttributeNode(Attr oldAttr) Removes the specified attribute. |
void |
removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName) Removes an attribute by local name and namespace URI. |
void |
reportSAXEvents(ContentHandler cntHandler) Report SAX Events from a DOM Tree |
java.lang.String |
resolveNamespacePrefix(java.lang.String prefix) Given a namespace prefix, find the namespace definition in scope in this element. |
void |
setAttribute(java.lang.String name, java.lang.String value) Adds a new attribute. |
Attr |
setAttributeNode(Attr newAttr) Adds a new attribute. |
Attr |
setAttributeNodeNS(Attr newAttr) Adds a new attribute. |
void |
setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value) Adds a new attribute. |
boolean |
validateContent(DTD dtd) Validates the content of a element node. |
boolean |
validateContent(XMLSchema schema) Validates the content of the element against given XML Schema param schema - schema used to validate |
boolean |
validateContent(XMLSchema schema, java.lang.String mode) Validates the content of the element against given XML Schema in the given mode. |
void |
writeExternal(java.io.ObjectOutput outArg) DOM Serialization/Compression API's *** *********** The Binary syntax of the compressed stream generated by this node <TAG_DEF/TAG_TOKEN> [element node info] {attributes <END>} <END> |
void |
writeExternal(oracle.xml.io.XMLObjectOutput out, oracle.xml.comp.CXMLContext cxmlContext) This method saves the state of the object by writing the object information in a binary compressed stream. |
Constructor Detail |
public XMLElement()
public XMLElement(java.lang.String tag)
tag
- Name of the elementpublic XMLElement(java.lang.String name, java.lang.String prefix, java.lang.String namespace)
name
- Local name of the elementprefix
- Prefix of the elementnamespace
- Namespace of the elementpublic XMLElement(java.lang.String name, java.lang.String prefix, java.lang.String qname, java.lang.String namespace)
name
- Local name of the elementprefix
- Prefix of the elementqname
- Qname of the elementnamespace
- Namespace of the elementMethod Detail |
public java.lang.String getTagName()
tagName
has the value "elementExample"
. Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the tagName
of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.public java.lang.String getQualifiedName()
public java.lang.String getNamespace()
Get the resolved Namespace for this element.
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.public java.lang.String getLocalName()
public java.lang.String getPrefix()
public java.lang.String getExpandedName()
public short getNodeType()
public java.lang.String getAttribute(java.lang.String name)
name
- The name of the attribute to retrieve.Attr
value as a string, or the empty string if that attribute does not have a specified or default value.public void setAttribute(java.lang.String name, java.lang.String value) throws DOMException
Attr
node plus any Text
and EntityReference
nodes, build the appropriate subtree, and use setAttributeNode
to assign it as the value of an attribute. This method is namespace unaware and hence wont result in update of namespace table if a new attr is added thru this methodname
- The name of the attribute to create or alter.value
- Value to set in string form.public void removeAttribute(java.lang.String name) throws DOMException
name
- The name of the attribute to remove.public Attr getAttributeNode(java.lang.String name)
Attr
node by name.name
- The name of the attribute to retrieve.Attr
node with the specified attribute name or null
if there is no such attribute.public XMLNode getFirstAttribute()
Attr
.Attr
node null
if there is no attribute.public Attr getAttributeNode(java.lang.String name, java.lang.String namespace)
getAttributeNodeNS(String ,String)
public Attr setAttributeNode(Attr newAttr) throws DOMException
newAttr
- The Attr
node to add to the attribute list.newAttr
attribute replaces an existing attribute with the same name, the previously existing Attr
node is returned, otherwise null
is returned.newAttr
was created from a different document than the one that created the element.newAttr
is already an attribute of another Element
object. The DOM user must explicitly clone Attr
nodes to re-use them in other elements.public Attr removeAttributeNode(Attr oldAttr) throws DOMException
oldAttr
- The Attr
node to remove from the attribute list. If the removed Attr
has a default value it is immediately replaced.Attr
node that was removed.oldAttr
is not an attribute of the element.public NodeList getChildrenByTagName(java.lang.String name)
NodeList
of all immediate children with a given tag name,name
- The name of the tag to match on.public NodeList getChildrenByTagName(java.lang.String name, java.lang.String ns)
NodeList
of all immediate children with a given tag name and namespacename
- The name of the tag to match on. (should be local name)ns
- The name spacepublic NodeList getElementsByTagName(java.lang.String name)
NodeList
of all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the Element
tree.name
- The name of the tag to match on. The special value "*" matches all tags.Element
nodes.public NodeList getElementsByTagName(java.lang.String name, java.lang.String ns)
name
- The name of the tag to match on. The special value "*" matches all tags. (should be local name)ns
- The namespace of the elementsElement
nodes.Returns a
NodeList of all descendant elements with a given tag name, and namespace in the order in which they would be encountered in a preorder traversal of the Element
tree.public java.lang.String resolveNamespacePrefix(java.lang.String prefix)
prefix
- Namespace prefix to be resolved if the prefix == #default, return the default namespacepublic void normalize()
Text
nodes in the full depth of the sub-tree underneath this Element
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 doc1ument tree structure are to be used.XMLNode.normalize()
public NamedNodeMap getAttributes()
NamedNodeMap
containing the attributes of this node (if it is an Element
) or null
otherwise.public 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.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 reportSAXEvents(ContentHandler cntHandler) throws SAXException
ContentHandler
- cntHandlerpublic boolean validateContent(DTD dtd)
public boolean validateContent(XMLSchema schema) throws XMLParseException
public boolean validateContent(XMLSchema schema, java.lang.String mode) throws XMLParseException
schem
- - schema used to validate the contentmode
- - the validation modepublic java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
String
- namespaceURI ,String localName of the attribute to be retrievedpublic void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value) throws DOMException
qualifiedName
, and its value is changed to be the value
parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr
node plus any Text
and EntityReference
nodes, build the appropriate subtree, and use setAttributeNodeNS
or setAttributeNode
to assign it as the value of an attribute.String
- namespaceURI ,String localName of the attribute to be retrievedpublic void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName) throws DOMException
String
- namespaceURI ,String localName of the attribute to be removedpublic Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
Attr
node by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.String
- namespaceURI ,String localName of the attribute to be retrievedpublic Attr setAttributeNodeNS(Attr newAttr) throws DOMException
Attribute
- node to be addedpublic NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
NodeList
of all the descendant Elements
with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element
tree.public boolean hasAttribute(java.lang.String name)
true
when an attribute with a given name is specified on this element or has a default value, false
otherwise.String
- name of the attribute whose presence is checkedpublic boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
true
when an attribute with a given local name and namespace URI is specified on this element or has a default value, false
otherwise. HTML-only DOM implementations do not need to implement this method.String
- namespaceURI,String localName of the attribute whose presence is checkedpublic boolean hasAttributes()
true
if this node has any attributes, false
otherwise.public void writeExternal(java.io.ObjectOutput outArg) throws java.io.IOException
public void writeExternal(oracle.xml.io.XMLObjectOutput out, oracle.xml.comp.CXMLContext cxmlContext) throws java.io.IOException
out
- The ObjectOutput stream used to write the serialized/ comressed stream.cxmlContext
- The context of the output compressed streampublic void readExternal(java.io.ObjectInput inArg) throws java.io.IOException, java.lang.ClassNotFoundException
in
- is the ObjectInput stream used to read the compressed stream.public void readExternal(oracle.xml.io.XMLObjectInput in, oracle.xml.comp.CXMLContext cxmlContext) throws java.io.IOException, java.lang.ClassNotFoundException
in
- is the XMLObjectInput stream used to read the compressed stream
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.