cleanString
public static String cleanString(String orig)
countKids
public static int countKids(Element elem,
short nodeType)
Count number of children of a certain type of the given element.
elem
- the element whose kids are to be counted
- the number of matching kids.
findChildElementWithAttribute
public static Element findChildElementWithAttribute(Element elem,
String attrName,
String attrValue)
Return the first child element of the given element which has the
given attribute with the given value.
elem
- the element whose children are to be searchedattrName
- the attrib that must be presentattrValue
- the desired value of the attribute
- the first matching child element.
getAttribute
public static String getAttribute(Element el,
String attrName)
Returns the value of an attribute of an element. Returns null
if the attribute is not found (whereas Element.getAttribute
returns "" if an attrib is not found). This method should be
used for elements that support extension attributes because it
does not track unexpected attributes.
el
- Element whose attrib is looked forattrName
- name of attribute to look for
- the attribute value
getAttribute
public static String getAttribute(Element el,
String attrName,
List remainingAttrs)
Returns the value of an attribute of an element. Returns null
if the attribute is not found (whereas Element.getAttribute
returns "" if an attrib is not found). This method should be
used for elements that do not support extension attributes
because it tracks the element's remaining attributes so that
eventually any unexpected attributes can be identified.
el
- Element whose attrib is looked forattrName
- name of attribute to look forremainingAttrs
- List of remaining attributes
- the attribute value
getAttributeNS
public static String getAttributeNS(Element el,
String namespaceURI,
String localPart)
Returns the value of an attribute of an element. Returns null
if the attribute is not found (whereas Element.getAttributeNS
returns "" if an attrib is not found).
el
- Element whose attrib is looked fornamespaceURI
- namespace URI of attribute to look forlocalPart
- local part of attribute to look for
- the attribute value
getAttributes
public static List getAttributes(Element el)
Returns a list of attributes of an element. Returns an
empty list if the element has no attributes. Does not
include namespace declarations.
el
- Element whose attributes are returned
- the List of Attr
getChildCharacterData
public static String getChildCharacterData(Element parentEl)
Concat all the text and cdata node children of this elem and return
the resulting text.
parentEl
- the element whose cdata/text node values are to
be combined.
- the concatanated string.
getFirstChildElement
public static Element getFirstChildElement(Element elem)
Return the first child element of the given element. Null if no
children are found.
elem
- Element whose child is to be returned
- the first child element.
getNamespaceURIFromPrefix
public static String getNamespaceURIFromPrefix(Node context,
String prefix)
Given a prefix and a node, return the namespace URI that the prefix
has been associated with. This method is useful in resolving the
namespace URI of attribute values which are being interpreted as
QNames. If prefix is null, this method will return the default
namespace.
context
- the starting node (looks up recursively from here)prefix
- the prefix to find an xmlns:prefix=uri for
- the namespace URI or null if not found
getNextSiblingElement
public static Element getNextSiblingElement(Element elem)
Return the next sibling element of the given element. Null if no
more sibling elements are found.
elem
- Element whose sibling element is to be returned
- the next sibling element.
getQualifiedAttributeValue
public static QName getQualifiedAttributeValue(Element el,
String attrName,
String elDesc,
boolean isRequired,
Definition def)
throws WSDLException
This method should be used for elements that support extension attributes
because it does not track the remaining attributes to test for unexpected
attributes.
getQualifiedAttributeValue
public static QName getQualifiedAttributeValue(Element el,
String attrName,
String elDesc,
boolean isRequired,
Definition def,
List remainingAttrs)
throws WSDLException
This method should be used for elements that do not support extension attributes
because it tracks the remaining attributes so that eventually any
unexpected attributes can be identified.
getQualifiedValue
public static String getQualifiedValue(String namespaceURI,
String localPart,
Definition def)
throws WSDLException
printAttribute
public static void printAttribute(String name,
String value,
PrintWriter pw)
printQualifiedAttribute
public static void printQualifiedAttribute(String name,
QName value,
Definition def,
PrintWriter pw)
throws WSDLException
printQualifiedAttribute
public static void printQualifiedAttribute(QName name,
String value,
Definition def,
PrintWriter pw)
throws WSDLException
Prints attributes with qualified names.
registerUniquePrefix
public static void registerUniquePrefix(String prefix,
String namespaceURI,
Definition def)
throwWSDLException
public static void throwWSDLException(Element location)
throws WSDLException
throwWSDLException
public static void throwWSDLException(Element location,
List remainingAttrs)
throws WSDLException