Oracle Security Developer Tools XML Security Java API Reference
10g Release 2 (10.1.2.0.2)

B15571-01


oracle.security.xmlsec.util
Class XMLUtils

java.lang.Object
  extended byoracle.security.xmlsec.util.XMLUtils


public class XMLUtils
extends java.lang.Object

Class containing static utility methods for XML and XML-DSIG.


Constructor Summary
XMLUtils()

Method Summary
static void addIdAttribute(java.lang.String namespaceURI, java.lang.String attrName)
Sets the namespace in which a given attribute is defined as being of type ID.
static java.lang.String canonicalize(java.util.Collection nodeSet, boolean withComments)
Applies Canonical XML to the input node-set.
static java.lang.String canonicalize(org.w3c.dom.Node input, boolean withComments)
Applies Canonical XML to the input sub-tree rooted in the given Node.
static java.lang.String canonicalize(org.w3c.dom.NodeList input, boolean withComments)
Applies Canonical XML to the input NodeList.
static java.lang.String collectText(org.w3c.dom.Node node)
Collects all of a node's text-node children into a single string.
static void copyNSPrefix(org.w3c.dom.Element source, org.w3c.dom.Element target)
Propagates the given source element tag name's namespace prefix to the given target element, if both elements have the same namespace URI and the source prefix is not null or empty.
static javax.xml.parsers.DocumentBuilder createDocBuilder()
Returns a new javax.xml.parsers.DocumentBuilder instance with the NamespaceAware property set to true.
static org.w3c.dom.Document createDocument()
Returns a new org.w3c.dom.Document instance.
static org.jaxen.NamespaceContext createNamespaceContext(org.w3c.dom.Node nsContextNode)
Creates a jaxen XPath namespace context containing the prefix mappings in scope for the given node.
static javax.xml.transform.Transformer createTransformer()
Returns a new javax.xml.transform.Transformer instance ('identity' trasformer).
static java.lang.String fixURL(java.lang.String urlStr)
Expands a relative URL to an absolute URL using the "file" protocol and the file-system current directory path.
static java.lang.String fixURL(java.lang.String urlStr, java.lang.String systemId)
Expands a relative URL to an absolute URL using the given document base URL.
static java.lang.String formatDate(java.util.Date date)
Formats a date as a String in UTC format.
static java.lang.String formatDateTime(java.util.Date date)
Formats a date and time as a String in UTC format.
static java.lang.String formatTime(java.util.Date date)
Formats a time as a String in UTC format.
static org.w3c.dom.Element getElementById(org.w3c.dom.Document doc, java.lang.String id)
Resolves an ID attribute value to an element.
static java.util.Vector getIdAttributes(java.lang.String namespaceURI)
Returns the list of attributes defined as type ID for the given namespace.
static java.lang.String getIdFromURI(java.lang.String uri)
Extracts the ID from a same-document URI.
static XMLElement getInstance(java.util.Collection nodes, java.lang.String tag, java.lang.String ns)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the first Element in the input node set with that tag.
static XMLElement getInstance(org.w3c.dom.Element element)
Creates a new instance of the implementation class for the given Element.
static XMLElement getInstance(org.w3c.dom.Element element, java.lang.String tag)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the Element.
static XMLElement getInstance(org.w3c.dom.Element element, java.lang.String tag, java.lang.String ns)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the Element.
static XMLElement getInstance(org.w3c.dom.NodeList nodes, java.lang.String tag, java.lang.String ns)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the first Element in the input node list with that tag.
static java.lang.String getNamespaceURI(org.w3c.dom.Node node)
Returns the namespace URI that is in scope for the given node's namespace prefix, as per the XPath data model.
static java.lang.String getNodeTypeName(org.w3c.dom.Node node)
Returns a string describing the given DOM node's type.
static java.lang.String getNodeTypeName(short type)
Returns a string describing the given DOM node type.
static org.w3c.dom.Document getOwnerDocument(org.w3c.dom.Node node)
Returns the given node's owner document, even if the node is a Document node.
static java.util.Enumeration idAttributeNamespaces()
Returns a list of namespace URIs for which ID attributes have been mapped.
static void insertChild(org.w3c.dom.Element parent, org.w3c.dom.Element child, java.lang.String[] namespaces, java.lang.String[] localNames)
Inserts a child element in the correct position relative to the given lists of child element types.
static void insertChild(org.w3c.dom.Element parent, org.w3c.dom.Element child, java.lang.String[] ns, java.lang.String[] tag, int pos)
Inserts a child element in the correct position relative to the given lists of child element types.
static void insertChild(XMLElement parent, XMLElement child, java.lang.String[] namespaces, java.lang.String[] localNames)
Inserts a child element in the correct position relative to the given lists of child element types.
static void insertChild(XMLElement parent, XMLElement child, java.lang.String[] ns, java.lang.String[] tag, int pos)
Inserts a child element in the correct position relative to the given lists of child element types.
static java.util.Date parseDateTime(java.lang.String s)
Parses a date String.
static java.lang.String randomName()
Generates a random string, suitable for use as a namespace prefix or other XML name where accidental collisions are to be avoided.
static byte[] readBytes(java.io.InputStream is)
Reads the contents of the given InputStream and returns a newly allocated byte array.
static byte[] readBytes(java.net.URL url)
Reads the bytes from the given URL.
static java.lang.String readString(java.io.Reader reader)
Returns the contents of the given java.io.Reader as a string.
static void removeChildren(org.w3c.dom.Element parent, java.lang.String ns, java.lang.String tag)
Removes any child elements with the given tag and namespace.
static java.lang.String resolveNSPrefix(java.lang.String prefix, org.w3c.dom.Node context)
Returns the namespace URI that is in scope for the given namespace prefix and context node.
static java.lang.String stripWS(java.lang.String s)
Strips whitespace from the given string.
static byte[] toBytesXML(org.w3c.dom.Node node, boolean indent, boolean xmlDecl)
Returns a byte array containing the XML for the given org.w3c.dom.Node.
static byte[] toBytesXML(XMLNode xmlNode, boolean indent, boolean xmlDecl)
Returns a byte array containing the XML for the given oracle.security.xmlsec.XMLNode.
static java.util.List toDocumentOrderList(java.util.Collection nodes)
Returns a new list containing the given nodes sorted into document order.
static void toStreamXML(java.io.OutputStream os, org.w3c.dom.Node node, boolean indent, boolean xmlDecl)
Writes the bytes of the XML for the given org.w3c.dom.Node to the given stream.
static void toStreamXML(java.io.OutputStream os, XMLNode xmlNode, boolean indent, boolean xmlDecl)
Writes the bytes of the XML for the given oracle.security.xmlsec.XMLNode to the given stream.
static java.lang.String toStringNode(org.w3c.dom.Node node)
Returns a string representation of the given DOM node (not XML).
static java.lang.String toStringNodes(java.util.Collection c)
static java.lang.String toStringXML(org.w3c.dom.Node node, boolean indent, boolean xmlDecl)
Returns a string containing the XML for the given org.w3c.dom.Node.
static java.lang.String toStringXML(XMLNode xmlNode, boolean indent, boolean xmlDecl)
Returns a string containing the XML for the given oracle.security.xmlsec.XMLNode.

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

XMLUtils

public XMLUtils()

Method Detail

createDocBuilder

public static javax.xml.parsers.DocumentBuilder createDocBuilder()
Returns a new javax.xml.parsers.DocumentBuilder instance with the NamespaceAware property set to true.

createDocument

public static org.w3c.dom.Document createDocument()
Returns a new org.w3c.dom.Document instance.

createTransformer

public static javax.xml.transform.Transformer createTransformer()
Returns a new javax.xml.transform.Transformer instance ('identity' trasformer).
Since:
1.2

getNodeTypeName

public static java.lang.String getNodeTypeName(short type)
Returns a string describing the given DOM node type.

getNodeTypeName

public static java.lang.String getNodeTypeName(org.w3c.dom.Node node)
Returns a string describing the given DOM node's type.

getOwnerDocument

public static org.w3c.dom.Document getOwnerDocument(org.w3c.dom.Node node)
Returns the given node's owner document, even if the node is a Document node.
Since:
2.0

toStringNode

public static java.lang.String toStringNode(org.w3c.dom.Node node)
Returns a string representation of the given DOM node (not XML).
Since:
2.0

toStringNodes

public static java.lang.String toStringNodes(java.util.Collection c)

toStringXML

public static java.lang.String toStringXML(XMLNode xmlNode,
                                           boolean indent,
                                           boolean xmlDecl)
                                    throws javax.xml.transform.TransformerException
Returns a string containing the XML for the given oracle.security.xmlsec.XMLNode.
Parameters:
indent - If true, element tags will begin on new lines in the output.
xmlDecl - If true, an XML declaration will be prepended to the output.
Throws:
javax.xml.transform.TransformerException - If the DOM subtree rooted in this XMLNode cannot be serialized to a character stream.

toStringXML

public static java.lang.String toStringXML(org.w3c.dom.Node node,
                                           boolean indent,
                                           boolean xmlDecl)
                                    throws javax.xml.transform.TransformerException
Returns a string containing the XML for the given org.w3c.dom.Node.
Parameters:
node - The Node to serialize to a string.
indent - If true, element tags will begin on new lines in the output.
xmlDecl - If true, an XML declaration will be prepended to the output.
Throws:
javax.xml.transform.TransformerException - If the DOM subtree rooted in this Node cannot be serialized to a character stream.

toBytesXML

public static byte[] toBytesXML(XMLNode xmlNode,
                                boolean indent,
                                boolean xmlDecl)
                         throws javax.xml.transform.TransformerException
Returns a byte array containing the XML for the given oracle.security.xmlsec.XMLNode.
Parameters:
indent - If true, element tags will begin on new lines in the output.
xmlDecl - If true, an XML declaration will be prepended to the output.
Throws:
javax.xml.transform.TransformerException - If the DOM subtree rooted in the given XMLNode cannot be serialized to a byte stream.

toBytesXML

public static byte[] toBytesXML(org.w3c.dom.Node node,
                                boolean indent,
                                boolean xmlDecl)
                         throws javax.xml.transform.TransformerException
Returns a byte array containing the XML for the given org.w3c.dom.Node.
Parameters:
node - The Node to serialize to a byte array.
indent - If true, element tags will begin on new lines in the output.
xmlDecl - If true, an XML declaration will be prepended to the output.
Throws:
javax.xml.transform.TransformerException - If the DOM subtree rooted in the given Node cannot be serialized to a byte stream.

toStreamXML

public static void toStreamXML(java.io.OutputStream os,
                               XMLNode xmlNode,
                               boolean indent,
                               boolean xmlDecl)
                        throws javax.xml.transform.TransformerException,
                               java.io.IOException
Writes the bytes of the XML for the given oracle.security.xmlsec.XMLNode to the given stream.
Parameters:
os - The OutputStream to which the XML will be written.
indent - If true, element tags will begin on new lines in the output.
xmlDecl - If true, an XML declaration will be prepended to the output.
Throws:
javax.xml.transform.TransformerException - If the DOM subtree rooted in the given XMLNode cannot be serialized to a byte stream.
java.io.IOException
Since:
2.2

toStreamXML

public static void toStreamXML(java.io.OutputStream os,
                               org.w3c.dom.Node node,
                               boolean indent,
                               boolean xmlDecl)
                        throws javax.xml.transform.TransformerException,
                               java.io.IOException
Writes the bytes of the XML for the given org.w3c.dom.Node to the given stream.
Parameters:
os - The OutputStream to which the XML will be written.
node - The Node to serialize to the stream.
indent - If true, element tags will begin on new lines in the output.
xmlDecl - If true, an XML declaration will be prepended to the output.
Throws:
javax.xml.transform.TransformerException - If the DOM subtree rooted in the given XMLNode cannot be serialized to a byte stream.
java.io.IOException
Since:
2.1 Build C

readString

public static java.lang.String readString(java.io.Reader reader)
                                   throws java.io.IOException
Returns the contents of the given java.io.Reader as a string.
Throws:
java.io.IOException

readBytes

public static byte[] readBytes(java.io.InputStream is)
                        throws java.io.IOException
Reads the contents of the given InputStream and returns a newly allocated byte array.
Throws:
java.io.IOException

readBytes

public static byte[] readBytes(java.net.URL url)
                        throws java.io.IOException
Reads the bytes from the given URL. An protocol stream handler appropriate to the URL must be available to the JVM.
Throws:
java.io.IOException

stripWS

public static java.lang.String stripWS(java.lang.String s)
Strips whitespace from the given string.

toDocumentOrderList

public static java.util.List toDocumentOrderList(java.util.Collection nodes)
Returns a new list containing the given nodes sorted into document order.
See Also:
DocOrderComparator

getInstance

public static XMLElement getInstance(org.w3c.dom.NodeList nodes,
                                     java.lang.String tag,
                                     java.lang.String ns)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the first Element in the input node list with that tag.
Parameters:
nodes - The NodeList containing the element to be wrapped.
tag - The tag name to look for.
ns - The namespace in which tag is defined.
Returns:
An instance of a subclass of XMLElement, or null if a corresponding implementation class cannot be identified or instantiated.
Since:
1.3

getInstance

public static XMLElement getInstance(java.util.Collection nodes,
                                     java.lang.String tag,
                                     java.lang.String ns)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the first Element in the input node set with that tag.
Parameters:
nodes - The java.util.Collection containing the element to be wrapped.
tag - The tag name to look for.
ns - The namespace in which tag is defined.
Returns:
An instance of a subclass of XMLElement, or null if a corresponding implementation class cannot be identified or instantiated.
Since:
2.0

getInstance

public static XMLElement getInstance(org.w3c.dom.Element element,
                                     java.lang.String tag,
                                     java.lang.String ns)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the Element. The namespace is taken from the given Element.
Parameters:
element - The element to be wrapped.
tag - The tag name to look for; if null, the tag will be taken from the element (or its xsi:type attribute).
ns - The namespace in which tag is defined; if null, the namespace will be taken from the element.
Returns:
An instance of a subclass of XMLElement, or null if a corresponding implementation class cannot be identified or instantiated.
Since:
1.3

getInstance

public static XMLElement getInstance(org.w3c.dom.Element element,
                                     java.lang.String tag)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the Element. The namespace is taken from the given Element.
Parameters:
element - The element to be wrapped.
tag - The tag name to look for; if null, the tag will be taken from the element.
Returns:
An instance of a subclass of XMLElement, or null if a corresponding implementation class cannot be identified or instantiated.

getInstance

public static XMLElement getInstance(org.w3c.dom.Element element)
Creates a new instance of the implementation class for the given Element. The tag name and namespace are taken from the Element (or its xsi:type attribute).
Parameters:
element - The element to be wrapped.
Returns:
An instance of a subclass of XMLElement, or null if a corresponding implementation class cannot be identified or instantiated.
Since:
2.1

copyNSPrefix

public static void copyNSPrefix(org.w3c.dom.Element source,
                                org.w3c.dom.Element target)
                         throws org.w3c.dom.DOMException
Propagates the given source element tag name's namespace prefix to the given target element, if both elements have the same namespace URI and the source prefix is not null or empty.
Parameters:
source - The Element from which the namespace prefix will be taken.
target - The Element to which the source's namespace prefix will be given.
Throws:
org.w3c.dom.DOMException

canonicalize

public static java.lang.String canonicalize(org.w3c.dom.Node input,
                                            boolean withComments)
                                     throws CanonicalizationException
Applies Canonical XML to the input sub-tree rooted in the given Node.
Parameters:
input - The root Node of the sub-tree to be canonicalized.
withComments - If true, comments will be preserved, otherwise they will be removed.
Returns:
The XML string obtained by canonicalizing the input sub-tree.
Throws:
CanonicalizationException

canonicalize

public static java.lang.String canonicalize(org.w3c.dom.NodeList input,
                                            boolean withComments)
                                     throws CanonicalizationException
Applies Canonical XML to the input NodeList.
Parameters:
input - The NodeList to be canonicalized.
withComments - If true, comments will be preserved, otherwise they will be removed.
Returns:
The XML string obtained by canonicalizing the input NodeList.
Throws:
CanonicalizationException

canonicalize

public static java.lang.String canonicalize(java.util.Collection nodeSet,
                                            boolean withComments)
                                     throws CanonicalizationException
Applies Canonical XML to the input node-set.
Parameters:
nodeSet - The node-set to be canonicalized.
withComments - If true, comments will be preserved, otherwise they will be removed.
Returns:
The XML string obtained by canonicalizing the input NodeSet.
Throws:
CanonicalizationException
Since:
2.0

randomName

public static java.lang.String randomName()
Generates a random string, suitable for use as a namespace prefix or other XML name where accidental collisions are to be avoided.

Note: The source of randomness used for this method is not cryptographically secure, so the results should not be used as key or seed material for any cryptographic operation.

Returns:
A random name string, specifically: 16 random bytes, base 64-encoded, with '+', '/' and '=' replaced with '1', '2', and '3', respectively.

fixURL

public static java.lang.String fixURL(java.lang.String urlStr,
                                      java.lang.String systemId)
Expands a relative URL to an absolute URL using the given document base URL.
Parameters:
urlStr - A relative URL string.
systemId - The base URL for the given relative URL. If systemId is null, the absolute URL will use the "file" protocol and the file-system current directory path.
Returns:
An absolute URL string for urlStr, based on systemId. If urlStr is already expanded, or if it or systemId is invalid, urlStr is returned unaltered.
Since:
2.0

fixURL

public static java.lang.String fixURL(java.lang.String urlStr)
Expands a relative URL to an absolute URL using the "file" protocol and the file-system current directory path.
Parameters:
urlStr - A URL string.
Returns:
The URL string with "file://" and the file-system current directory path prepended if the input URL is missing the protocol scheme. If the current directory cannot be obtained, or urlStr is invalid, then urlStr is returned unaltered.
Since:
1.2

getIdFromURI

public static java.lang.String getIdFromURI(java.lang.String uri)
Extracts the ID from a same-document URI.
Parameters:
uri - The URI string containing the ID.
Returns:
The ID string contained in the URI, or null if none could be found.
Since:
1.2

getElementById

public static org.w3c.dom.Element getElementById(org.w3c.dom.Document doc,
                                                 java.lang.String id)
Resolves an ID attribute value to an element.
Parameters:
doc - The Document to search.
id - The ID attribute value to resolve.
Returns:
The Element with the ID attribute value given by id, or null if none could be located in doc.
Since:
1.2

addIdAttribute

public static void addIdAttribute(java.lang.String namespaceURI,
                                  java.lang.String attrName)
Sets the namespace in which a given attribute is defined as being of type ID.
Parameters:
namespaceURI - The URI identifying the namespace in which the attribute is defined with ID type.
attrName - The local name of the ID attribute.
Since:
1.2
See Also:
getIdAttributes(java.lang.String)

idAttributeNamespaces

public static java.util.Enumeration idAttributeNamespaces()
Returns a list of namespace URIs for which ID attributes have been mapped.
Since:
1.2

getIdAttributes

public static java.util.Vector getIdAttributes(java.lang.String namespaceURI)
Returns the list of attributes defined as type ID for the given namespace.
Parameters:
namespaceURI - The URI identifying the namespace in which the attributes are defined with ID type.
Returns:
A java.util.Vector containing any attribute names defined to be of type ID in the given namespace.
Since:
1.2
See Also:
addIdAttribute(java.lang.String, java.lang.String)

formatDate

public static java.lang.String formatDate(java.util.Date date)
Formats a date as a String in UTC format.
Parameters:
date - The Date to parse.
Returns:
A String representation of the UTC date.
Since:
1.3

formatTime

public static java.lang.String formatTime(java.util.Date date)
Formats a time as a String in UTC format.
Returns:
A String representation of the UTC time.
Since:
1.3

formatDateTime

public static java.lang.String formatDateTime(java.util.Date date)
Formats a date and time as a String in UTC format.
Returns:
A String representation of the UTC date and time.
Since:
1.3

parseDateTime

public static java.util.Date parseDateTime(java.lang.String s)
Parses a date String.
Parameters:
s - The String to parse.
Returns:
A Date object.
Since:
1.3

collectText

public static java.lang.String collectText(org.w3c.dom.Node node)
Collects all of a node's text-node children into a single string.
Parameters:
node - The node whose text-node children are to be concatenated.
Returns:
The concatenation of all of node's text-node children's values.
Since:
1.3

resolveNSPrefix

public static java.lang.String resolveNSPrefix(java.lang.String prefix,
                                               org.w3c.dom.Node context)
Returns the namespace URI that is in scope for the given namespace prefix and context node.
Parameters:
prefix - The namespace prefix to be resolved.
context - The node to be used to determine the scope.
Returns:
A namespace URI string, or null if none could be found for the given inputs.
Since:
2.0

getNamespaceURI

public static java.lang.String getNamespaceURI(org.w3c.dom.Node node)
Returns the namespace URI that is in scope for the given node's namespace prefix, as per the XPath data model.
Parameters:
node - The node for which a namespace is to be resolved.
Returns:
A namespace URI string, or null if none could be determined. If node is an Element without a namespace prefix, the default namespace in scope, if any, will be returned. If node is an Attr without a namespace prefix, null will be returned. For all other nodes, the namespace URI will be null.
Since:
2.0

createNamespaceContext

public static org.jaxen.NamespaceContext createNamespaceContext(org.w3c.dom.Node nsContextNode)
                                                         throws XPathException
Creates a jaxen XPath namespace context containing the prefix mappings in scope for the given node.
Parameters:
nsContextNode - A node containing the namespace prefix definitions to be used for the XPath namespace context.
Returns:
An org.jaxen.NamespaceContext with the prefix mappings in scope for nsContextNode.
Throws:
XPathException
Since:
2.0

removeChildren

public static void removeChildren(org.w3c.dom.Element parent,
                                  java.lang.String ns,
                                  java.lang.String tag)
Removes any child elements with the given tag and namespace.
Parameters:
parent - The element whose children will be removed.
ns - The namespace URI of the element(s) to remove.
tag - The tag name of the child element(s) to remove.
Since:
2.0

insertChild

public static void insertChild(XMLElement parent,
                               XMLElement child,
                               java.lang.String[] ns,
                               java.lang.String[] tag,
                               int pos)
                        throws org.w3c.dom.DOMException
Inserts a child element in the correct position relative to the given lists of child element types.
Parameters:
parent - The element to which a child will be appended.
child - The child element to insert.
ns - An array of namespace URIs corresponding to the tag names in the tag array.
tag - An array of element tag names, including the one corresponding to the child element to be inserted. The tags must be presented in the order in which they appear in the parent element's schema.
pos - The position in the ns and tag arrays at which the element to be inserted appears.
Throws:
java.lang.IllegalArgumentException - If either of the tag or ns array is missing or if they do not correspond in length.
org.w3c.dom.DOMException
Since:
2.0

insertChild

public static void insertChild(org.w3c.dom.Element parent,
                               org.w3c.dom.Element child,
                               java.lang.String[] ns,
                               java.lang.String[] tag,
                               int pos)
                        throws org.w3c.dom.DOMException
Inserts a child element in the correct position relative to the given lists of child element types.
Parameters:
parent - The element to which a child will be appended.
child - The child element to insert.
ns - An array of namespace URIs corresponding to the tag names in the tag array.
tag - An array of element tag names, including the one corresponding to the child element to be inserted. The tags must be presented in the order in which they appear in the parent element's schema.
pos - The position in the ns and tag arrays at which the element to be inserted appears.
Throws:
java.lang.IllegalArgumentException - If either of the tag or ns array is missing or if they do not correspond in length.
org.w3c.dom.DOMException
Since:
2.0

insertChild

public static void insertChild(org.w3c.dom.Element parent,
                               org.w3c.dom.Element child,
                               java.lang.String[] namespaces,
                               java.lang.String[] localNames)
                        throws org.w3c.dom.DOMException
Inserts a child element in the correct position relative to the given lists of child element types. The position is determined by locating the child element's type in the namespace and local name lists.
Parameters:
parent - The element to which a child will be appended.
child - The child element to insert.
localNames - An array of element local tag names, including the one corresponding to the child element to be inserted. The tags must be presented in the order in which they appear in the parent element's schema.
Throws:
java.lang.IllegalArgumentException - If either of the namespaces or localNames array is missing or if they do not correspond in length.
org.w3c.dom.DOMException
Since:
2.1

insertChild

public static void insertChild(XMLElement parent,
                               XMLElement child,
                               java.lang.String[] namespaces,
                               java.lang.String[] localNames)
                        throws org.w3c.dom.DOMException
Inserts a child element in the correct position relative to the given lists of child element types. The position is determined by locating the child element's type in the namespace and local name lists.
Parameters:
parent - The element to which a child will be appended.
child - The child element to insert.
localNames - An array of element local tag names, including the one corresponding to the child element to be inserted. The tags must be presented in the order in which they appear in the parent element's schema.
Throws:
java.lang.IllegalArgumentException - If either of the namespaces or localNames array is missing or if they do not correspond in length.
org.w3c.dom.DOMException
Since:
2.1

Oracle Security Developer Tools XML Security Java API Reference
10g Release 2 (10.1.2.0.2)

B15571-01


Copyright © 2005 , Oracle. All rights reserved.