|
xArch/xADL 2.0 Data Binding Library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.uci.isr.xarch.DOMUtils
Some utility functions for working with the DOM API.
| Field Summary | |
protected static boolean |
WRONG_DOCUMENT_ERR_WORKAROUND
This variable is set to TRUE if we're using JDK 1.4.2 or below; this fixes an obscure DOM bug that involves parsed documents' Attrs not having the proper ownerDocument and sometimes causing WRONG_DOCUMENT_ERR |
| Constructor Summary | |
DOMUtils()
|
|
| Method Summary | |
static void |
addXSIType(Element elt,
String namespaceURI,
String typeName)
Adds the xsi:type attribute to an element. |
static Element |
cloneAndRename(Element elt,
Document doc,
String newNamespaceURI,
String newTagName)
Clones a DOM element and gives the clone a new tag name and namespace URI. |
static Element |
cloneAndRename(Element elt,
String newTagName)
Clones a DOM element and gives the clone a new tag name. |
static Element |
cloneAndRename(Element elt,
String newNamespaceURI,
String newTagName)
Clones a DOM element and gives the clone a new tag name and namespace URI. |
static String |
getAttributeValue(Node node,
String namespaceURI,
String attrName)
Given a node, a namespace URI and attribute name for an attribute, gets that attribute value, or null if the attribute
does not exist. |
static NodeList |
getChildren(Node parentNode,
String namespaceURI,
String childName)
Gets all the children of a given DOM node with a specific namespace URI/name combination. |
static Object |
getDOMLock(Node n)
Gets the DOM lock for a particular node. |
static QName |
getXSIType(Element elt)
Gets the xsi:type of an element in the form of a qualified name. |
static boolean |
hasXSIType(Element elt,
String namespaceURI,
String typeName)
Determines if the element has the given xsi:type. |
static String |
normalizeString(String s)
|
static boolean |
objNullEq(Object object1,
Object object2)
Determines if two objects are equal. |
static void |
order(Element elt,
SequenceOrder order)
Given an element with children and a sequence order of tag names, does a stable sort on the children of the element. |
static void |
removeAttribute(Node node,
String namespaceURI,
String attrName)
Given a node, a namespace URI and attribute name for an attribute, remoevs that attribute. |
static void |
removeChildren(Node parentNode,
String namespaceURI,
String childName)
Removes all the children of a given DOM node with a specific namespace URI/name combination. |
static void |
setAttribute(Node node,
String namespaceURI,
String attrName,
String attrVal)
Given a node, a namespace URI and attribute name for an attribute, creates that attribute. |
static void |
setXSIType(Node node,
String typeName)
Sets the xsi:type attribute on a node. |
static String |
stripPrefix(String name)
Strips the namespace prefix from a tag name. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static boolean WRONG_DOCUMENT_ERR_WORKAROUND
| Constructor Detail |
public DOMUtils()
| Method Detail |
public static final Object getDOMLock(Node n)
n - The node
public static void addXSIType(Element elt,
String namespaceURI,
String typeName)
elt - Element to annotatenamespaceURI - Namespace URI for the xsi:typetypeName - Type name for the xsi:type
public static boolean hasXSIType(Element elt,
String namespaceURI,
String typeName)
elt - Element to checknamespaceURI - Namespace URI for the xsi:typetypeName - Type name for the xsi:type
true if the element has the given xsi:type,
false otherwise or if the namespace URI cannot be determined.public static QName getXSIType(Element elt)
elt - Element to check
public static String stripPrefix(String name)
name - Name to strip the prefix from.
public static NodeList getChildren(Node parentNode,
String namespaceURI,
String childName)
parentNode - DOM node to check for children.namespaceURI - Namespace URI to look for in the children.childName - Name to look for in the children.
NodeList containing all children with the given
namespace URI and child name.
public static void removeChildren(Node parentNode,
String namespaceURI,
String childName)
parentNode - DOM node to check for children.namespaceURI - Namespace URI to look for in the children.childName - Name to look for in the children.
public static String getAttributeValue(Node node,
String namespaceURI,
String attrName)
null if the attribute
does not exist.
node - Node to check for attributenamespaceURI - Namespace URI of attribute to check forattrName - Name of attribute to check for
null if attribute
does not exist.
public static void removeAttribute(Node node,
String namespaceURI,
String attrName)
node - Node to check for attributenamespaceURI - Namespace URI of attribute to removeattrName - Name of attribute to remove
public static void setAttribute(Node node,
String namespaceURI,
String attrName,
String attrVal)
node - Node to add attribute tonamespaceURI - Namespace URI of attribute to addattrName - Name of attribute to add
public static void setXSIType(Node node,
String typeName)
node - Node to set type ontypeName - Value for xsi:type attribute.
public static void order(Element elt,
SequenceOrder order)
elt - Element on which to sort children.order - Sequence order defining sort order for children.
public static boolean objNullEq(Object object1,
Object object2)
null
objects are considered to be equal. If only one of the
objects is non-null, they are not equal.
If both are non-null, then this returns object1.equals(object2);
object1 - First object to compare.object2 - Second object to compare.
true or false according
to the above description.
public static Element cloneAndRename(Element elt,
String newTagName)
elt - Element to clone.newTagName - New tag name for clone.
public static Element cloneAndRename(Element elt,
String newNamespaceURI,
String newTagName)
elt - Element to clone.newNamespaceURI - New namespace URI for clone.newTagName - New tag name for clone.
public static Element cloneAndRename(Element elt,
Document doc,
String newNamespaceURI,
String newTagName)
elt - Element to clone.newNamespaceURI - New namespace URI for clone.newTagName - New tag name for clone.
public static String normalizeString(String s)
|
xArch/xADL 2.0 Data Binding Library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||