|
Oracle Security Developer Tools XML Security Java API Reference 10g (10.1.4.0.1) B28178-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.xmlsec.util.XMLNode
oracle.security.xmlsec.util.XMLElement
Abstract superclass for XML element objects.
XMLElement
serves as a wrapper class for an instance of org.w3c.dom.Element
. Every public method of that interface is implemented here, and is forwarded to the enclosed Element
. Additionally, XMLElement
extends XMLNode
in much the same way that Element
extends Node
. This allows instances of XMLElement
to be manipulated in the same manner as instances of Element
. The one exception is that a XMLElement
cannot be directly appended to a Node
using the Node.appendChild()
method; instead use the XMLNode.getNode()
method to obtain the XMLElement
's enclosed Element
node, and pass the result to the Node.appendChild()
method.
Field Summary |
Fields inherited from class oracle.security.xmlsec.util.XMLNode |
node, systemId |
Constructor Summary | |
protected |
XMLElement(org.w3c.dom.Document owner, java.lang.String nsURI, java.lang.String localName) Creates a new XMLElement instance in the given Document with the given namespace and tag name. |
protected |
XMLElement(org.w3c.dom.Document owner, java.lang.String nsURI, java.lang.String localName, java.lang.String systemId) Creates a new XMLElement instance in the given Document with the given namespace and tag name. |
protected |
XMLElement(org.w3c.dom.Element element) Creates a new XMLElement instance for the given org.w3c.dom.Element . |
protected |
XMLElement(org.w3c.dom.Element element, java.lang.String systemId) Creates a new XMLElement instance for the given org.w3c.dom.Element . |
Method Summary | |
static void |
addNSPrefixAttr(org.w3c.dom.Element element, java.lang.String prefix, java.lang.String nsURI) Adds a "xmlns" attribute to the given Element that maps the given prefix to the given namespace URI. |
void |
addNSPrefixAttr(java.lang.String prefix, java.lang.String nsURI) Adds a "xmlns" attribute to this XMLElement that maps the given prefix to the given namespace URI. |
static void |
addNSPrefixAttrDefault(org.w3c.dom.Element element, java.lang.String nsURI) Adds a "xmlns" attribute to the given Element that maps the default prefix to the given namespace URI. |
void |
addNSPrefixAttrDefault(java.lang.String nsURI) Adds a "xmlns" attribute to this XMLElement that maps the default prefix to the given namespace URI. |
java.lang.String |
getAttribute(java.lang.String name) Retrieves an attribute value by name. |
org.w3c.dom.Attr |
getAttributeNode(java.lang.String name) Retrieves an attribute node by name. |
org.w3c.dom.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. |
static org.w3c.dom.NodeList |
getChildElementsByTagName(org.w3c.dom.Element parent, java.lang.String name) Returns a NodeList of all child Element s of the given parent Element with a given tag name, in the order in which they are encountered in a preorder traversal of the child Element s of this given Element . |
org.w3c.dom.NodeList |
getChildElementsByTagName(java.lang.String name) Returns a NodeList of all child Element s of this Element with a given tag name, in the order in which they are encountered in a preorder traversal of the child Element s of this Element . |
static org.w3c.dom.NodeList |
getChildElementsByTagNameNS(org.w3c.dom.Element parent, java.lang.String namespaceURI, java.lang.String name) Returns a NodeList of all child Element s of this with the given parent Element and a given local name and namespace URI, in the order in which they are encountered in a preorder traversal of the child Element s of this parent Element . |
org.w3c.dom.NodeList |
getChildElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String name) Returns a NodeList of all child Element s of this Element with a given local name and namespace URI, in the order in which they are encountered in a preorder traversal of the child Element s of this Element . |
static java.lang.String |
getDefaultNSPrefix(java.lang.String nsURI) Returns the default prefix for the given namespace URI. |
org.w3c.dom.NodeList |
getElementsByTagName(java.lang.String name) Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are encountered in a preorder traversal of this Element tree. |
org.w3c.dom.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 |
getTagName() Returns 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. |
void |
removeAttribute(java.lang.String name) Removes an attribute by name. |
org.w3c.dom.Attr |
removeAttributeNode(org.w3c.dom.Attr oldAttr) Removes the specified attribute node. |
void |
removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName) Removes an attribute by local name and namespace URI. |
void |
setAttribute(java.lang.String name, java.lang.String value) Adds a new attribute. |
org.w3c.dom.Attr |
setAttributeNode(org.w3c.dom.Attr newAttr) Adds a new attribute node. |
org.w3c.dom.Attr |
setAttributeNodeNS(org.w3c.dom.Attr newAttr) Adds a new attribute. |
void |
setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value) Adds a new attribute. |
static void |
setDefaultNSPrefix(java.lang.String nsURI, java.lang.String prefix) Maps a namespace URI to a prefix. |
Methods inherited from class oracle.security.xmlsec.util.XMLNode |
appendChild, appendChild, appendTo, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getSystemId, hasAttributes, hasChildNodes, insertBefore, insertBefore, isSupported, normalize, removeChild, removeChild, replaceChild, replaceChild, setNodeValue, setPrefix, setSystemId, toBytesXML, toStringXML |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected XMLElement(org.w3c.dom.Element element) throws org.w3c.dom.DOMException
XMLElement
instance for the given org.w3c.dom.Element
. This constructor should be invoked by the constructors of all subclasses to set the XMLNode.node
field.element
- The org.w3c.dom.Element
that will be contained in this XMLElement
.org.w3c.dom.DOMException
- If the local name of element
is invalid for an instance of this XMLNode
's type.protected XMLElement(org.w3c.dom.Element element, java.lang.String systemId) throws org.w3c.dom.DOMException
XMLElement
instance for the given org.w3c.dom.Element
. This constructor should be invoked by the constructors of all subclasses to set the XMLNode.node
field.element
- The org.w3c.dom.Element
that will be contained in this XMLElement
.systemId
- The URI string system ID for the XMLElement
.org.w3c.dom.DOMException
- If the local name of element
is invalid for an instance of this XMLNode
's type.XMLNode.setSystemId(java.lang.String)
protected XMLElement(org.w3c.dom.Document owner, java.lang.String nsURI, java.lang.String localName) throws org.w3c.dom.DOMException
XMLElement
instance in the given Document with the given namespace and tag name. Additionally, if a default namespace prefix is mapped for the given URI, it will be prepended to the tag name. This constructor should be invoked by the constructors of all subclasses that want a new Node to be created.owner
- The owner document of the new Element.nsURI
- The namespace URI in which the new Element is to be created.localName
- The local name of the new Element. If a default namespace has been mapped to nsURI
, is will be prepended to tagName
.protected XMLElement(org.w3c.dom.Document owner, java.lang.String nsURI, java.lang.String localName, java.lang.String systemId) throws org.w3c.dom.DOMException
XMLElement
instance in the given Document with the given namespace and tag name. Additionally, if a default namespace prefix is mapped for the given URI, it will be prepended to the tag name. This constructor should be invoked by the constructors of all subclasses that want a new Node to be created.owner
- The owner document of the new Element.nsURI
- The namespace URI in which the new Element is to be created.localName
- The local name of the new Element. If a default namespace has been mapped to nsURI
, is will be prepended to tagName
.systemId
- The URI string system ID for the XMLElement
.XMLNode.setSystemId(java.lang.String)
Method Detail |
public org.w3c.dom.NodeList getChildElementsByTagName(java.lang.String name)
Element
s of this Element
with a given tag name, in the order in which they are encountered in a preorder traversal of the child Element
s of this Element
.name
- The name of the tag to match on. The special value "*" matches all tags.public org.w3c.dom.NodeList getChildElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String name)
Element
s of this Element
with a given local name and namespace URI, in the order in which they are encountered in a preorder traversal of the child Element
s of this Element
.namespaceURI
- The namespace URI of the elements to match on. The special value "*" matches all namespaces.name
- The name of the tag to match on. The special value "*" matches all tags.public static org.w3c.dom.NodeList getChildElementsByTagName(org.w3c.dom.Element parent, java.lang.String name)
Element
s of the given parent Element
with a given tag name, in the order in which they are encountered in a preorder traversal of the child Element
s of this given Element
.parent
- The parent element.name
- The name of the tag to match on. The special value "*" matches all tags.public static org.w3c.dom.NodeList getChildElementsByTagNameNS(org.w3c.dom.Element parent, java.lang.String namespaceURI, java.lang.String name)
Element
s of this with the given parent Element
and a given local name and namespace URI, in the order in which they are encountered in a preorder traversal of the child Element
s of this parent Element
.parent
- The parent element.namespaceURI
- The namespace URI of the elements to match on. The special value "*" matches all namespaces.name
- The name of the tag to match on. The special value "*" matches all tags.public static void setDefaultNSPrefix(java.lang.String nsURI, java.lang.String prefix)
XMLElement
s created with the given namespace URI.nsURI
- The namespace URI to be mapped.prefix
- The default prefix corresponding to the given namespace. If this is null
, any existing mapping for the given namespace URI will be removed.public static java.lang.String getDefaultNSPrefix(java.lang.String nsURI)
nsURI
- The namespace URI to look up.null
if none is mapped.public static void addNSPrefixAttr(org.w3c.dom.Element element, java.lang.String prefix, java.lang.String nsURI) throws org.w3c.dom.DOMException
element
- The org.w3c.dom.Element
to which the attribute will be added.prefix
- The namespace prefix to be defined in the "xmlns" attribute.nsURI
- The namespace URI to be mapped to the given prefix.org.w3c.dom.DOMException
public static void addNSPrefixAttrDefault(org.w3c.dom.Element element, java.lang.String nsURI) throws org.w3c.dom.DOMException
element
- The org.w3c.dom.Element
to which the attribute will be added.nsURI
- The namespace URI to be mapped to the default prefix.org.w3c.dom.DOMException
public void addNSPrefixAttr(java.lang.String prefix, java.lang.String nsURI) throws org.w3c.dom.DOMException
XMLElement
that maps the given prefix to the given namespace URI.prefix
- The namespace prefix to be defined in the "xmlns" attribute.nsURI
- The namespace URI to be mapped to the given prefix.org.w3c.dom.DOMException
public void addNSPrefixAttrDefault(java.lang.String nsURI) throws org.w3c.dom.DOMException
XMLElement
that maps the default prefix to the given namespace URI.nsURI
- The namespace URI to be mapped to the default prefix.org.w3c.dom.DOMException
addNSPrefixAttr(String prefix, String nsURI)
, getDefaultNSPrefix(java.lang.String)
public java.lang.String getTagName()
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 org.w3c.dom.DOMException
Attr
node plus any Text
and EntityReference
nodes, build the appropriate subtree, and use setAttributeNode(org.w3c.dom.Attr)
to assign it as the value of an attribute.
To set an attribute with a qualified name and namespace URI, use the setAttributeNS(java.lang.String, java.lang.String, java.lang.String)
method.
name
- The name of the attribute to create or alter.value
- Value to set in string form.org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.public void removeAttribute(java.lang.String name) throws org.w3c.dom.DOMException
To remove an attribute by local name and namespace URI, use the {#link #removeAttributeNS} method.
name
- The name of the attribute to remove.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
To retrieve an attribute node by qualified name and namespace URI, use the getAttributeNodeNS(java.lang.String, java.lang.String)
method.
name
- The name of the attribute to retrieve.Attr
node with the specified name, or null
if there is no such attribute.public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr) throws org.w3c.dom.DOMException
To add a new attribute node with a qualified name and namespace URI, use the setAttributeNodeNS(org.w3c.dom.Attr)
method.
newAttr
- The Attr
node to add to the attribute list.newAttr
attribute replaces an existing attribute, the replaced Attr
node is returned, otherwise null
is returned.org.w3c.dom.DOMException
- WRONG_DOCUMENT_ERR: Raised if 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 org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr) throws org.w3c.dom.DOMException
Attr
has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix, when applicable.oldAttr
- The Attr
node to remove from the attribute list.Attr
node that was removed.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.oldAttr
is not an attribute of the element.public org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
NodeList
of all descendant Elements
with a given tag name, in the order in which they are encountered in a preorder traversal of this Element
tree.name
- The name of the tag to match on. The special value "*" matches all tags.Element
nodes.public java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI
- The namespace URI of the attribute to retrieve.localName
- The local 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 setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value) throws org.w3c.dom.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(org.w3c.dom.Attr)
or setAttributeNode(org.w3c.dom.Attr)
to assign it as the value of an attribute.namespaceURI
- The namespace URI of the attribute to create or alter.qualifiedName
- The qualified name of the attribute to create or alter.value
- The value to set in string form.org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.qualifiedName
is malformed, if the qualifiedName
has a prefix and the namespaceURI
is null
, if the qualifiedName
has a prefix that is "xml" and the namespaceURI
is different from "http://www.w3.org/XML/1998/namespace", or if the qualifiedName
is "xmlns" and the namespaceURI
is different from "http://www.w3.org/2000/xmlns/".public void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName) throws org.w3c.dom.DOMException
namespaceURI
- The namespace URI of the attribute to remove.localName
- The local name of the attribute to remove.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
Attr
node by local name and namespace URI.namespaceURI
- The namespace URI of the attribute to retrieve.localName
- The local name of the attribute to retrieve.Attr
node with the specified attribute local name and namespace URI or null
if there is no such attribute.public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr) throws org.w3c.dom.DOMException
newAttr
- The Attr
node to add to the attribute list.newAttr
attribute replaces an existing attribute with the same local name and namespace URI, the replaced Attr
node is returned, otherwise null
is returned.org.w3c.dom.DOMException
- WRONG_DOCUMENT_ERR: Raised if 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 org.w3c.dom.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.namespaceURI
- The namespace URI of the elements to match on. The special value "*" matches all namespaces.localName
- The local name of the elements to match on. The special value "*" matches all local names.NodeList
object containing all the matched Elements
.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.name
- The name of the attribute to look for.true
if an attribute with the given name is specified on this element or has a default value, false
otherwise.public 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.namespaceURI
- The namespace URI of the attribute to look for.localName
- The local name of the attribute to look for.true
if an attribute with the given local name and namespace URI is specified or has a default value on this element, false
otherwise.
|
Oracle Security Developer Tools XML Security Java API Reference 10g (10.1.4.0.1) B28178-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |