public final class AttributeSupport
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
AttributeSupport()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addXMLBase(org.w3c.dom.Element element,
java.lang.String base)
Adds a
xml:base attribute to the given Element. |
static void |
addXMLId(org.w3c.dom.Element element,
java.lang.String id)
Adds a
xml:id attribute to the given Element. |
static void |
addXMLLang(org.w3c.dom.Element element,
java.lang.String lang)
Adds a
xml:lang attribute to the given Element. |
static void |
addXMLSpace(org.w3c.dom.Element element,
XMLSpace space)
Adds a
xml:space attribute to the given Element. |
static void |
appendAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName,
java.util.List<java.lang.String> attributeValues,
boolean isIDAttribute)
Adds an attribute name and value to a DOM Element.
|
static void |
appendAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName,
java.lang.String attributeValue)
Adds an non-id attribute name and value to a DOM Element.
|
static void |
appendAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName,
java.lang.String attributeValue,
boolean isIDAttribute)
Adds an attribute name and value to a DOM Element.
|
static void |
appendDateTimeAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName,
long duration)
Adds an attribute to the given element.
|
static void |
appendDurationAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName,
long duration)
Adds an attribute to given element.
|
static org.w3c.dom.Attr |
constructAttribute(org.w3c.dom.Document owningDocument,
javax.xml.namespace.QName attributeName)
Constructs an attribute owned by the given document with the given name.
|
static org.w3c.dom.Attr |
constructAttribute(org.w3c.dom.Document document,
java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String prefix)
Constructs an attribute owned by the given document with the given name.
|
static org.w3c.dom.Attr |
getAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName)
Gets the attribute with the given name.
|
static java.lang.String |
getAttributeValue(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName)
Gets the value of an attribute from an element.
|
static java.lang.String |
getAttributeValue(org.w3c.dom.Element element,
java.lang.String namespace,
java.lang.String attributeLocalName)
Gets the value of an attribute from an element.
|
static java.lang.Boolean |
getAttributeValueAsBoolean(org.w3c.dom.Attr attribute)
Parses the attribute's value.
|
static java.util.List<java.lang.String> |
getAttributeValueAsList(org.w3c.dom.Attr attribute)
Gets the value of a list-type attribute as a list.
|
static javax.xml.namespace.QName |
getAttributeValueAsQName(org.w3c.dom.Attr attribute)
Constructs a QName from an attributes value.
|
static java.lang.Long |
getDateTimeAttributeAsLong(org.w3c.dom.Attr attribute)
Gets the value of a dateTime-type attribute in milliseconds since the epoch.
|
static java.lang.Long |
getDurationAttributeValueAsLong(org.w3c.dom.Attr attribute)
Gets the value of a duration-type attribute in milliseconds.
|
static org.w3c.dom.Attr |
getIdAttribute(org.w3c.dom.Element element)
Gets the ID attribute of a DOM element.
|
static java.lang.String |
getXMLBase(org.w3c.dom.Element element)
Gets the
xml:base attribute from a given Element. |
static java.lang.String |
getXMLId(org.w3c.dom.Element element)
Gets the
xml:id attribute from a given Element. |
static java.lang.String |
getXMLLang(org.w3c.dom.Element element)
Gets the
xml:lang attribute from a given Element. |
static java.util.Locale |
getXMLLangAsLocale(org.w3c.dom.Element element)
Gets the locale currently active for the element.
|
static XMLSpace |
getXMLSpace(org.w3c.dom.Element element)
Gets the
xml:space attribute from a given Element. |
static boolean |
hasAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName name)
Checks if the given attribute has an attribute with the given name.
|
static boolean |
removeAttribute(org.w3c.dom.Element element,
javax.xml.namespace.QName attributeName)
Removes an attribute from an element.
|
public static void addXMLBase(@Nonnull
org.w3c.dom.Element element,
@Nonnull
java.lang.String base)
xml:base attribute to the given Element.element - the element to which to add the attributebase - the base valuepublic static void addXMLId(@Nonnull
org.w3c.dom.Element element,
@Nonnull
java.lang.String id)
xml:id attribute to the given Element.element - the element to which to add the attributeid - the Id valuepublic static void addXMLLang(@Nonnull
org.w3c.dom.Element element,
@Nonnull
java.lang.String lang)
xml:lang attribute to the given Element.element - the element to which to add the attributelang - the lang valuepublic static void addXMLSpace(@Nonnull
org.w3c.dom.Element element,
@Nonnull
XMLSpace space)
xml:space attribute to the given Element.element - the element to which to add the attributespace - the space valuepublic static void appendAttribute(@Nonnull
org.w3c.dom.Element element,
@Nonnull
javax.xml.namespace.QName attributeName,
java.util.List<java.lang.String> attributeValues,
boolean isIDAttribute)
attributeName - the attribute name in QName formattributeValues - the attribute valueselement - the target element to which to marshallisIDAttribute - flag indicating whether the attribute being marshalled should be handled as an ID-typed
attributepublic static void appendAttribute(@Nonnull
org.w3c.dom.Element element,
@Nonnull
javax.xml.namespace.QName attributeName,
@Nonnull
java.lang.String attributeValue)
attributeName - the attribute name in QName formattributeValue - the attribute valueselement - the target element to which to marshallpublic static void appendAttribute(@Nonnull
org.w3c.dom.Element element,
@Nonnull
javax.xml.namespace.QName attributeName,
@Nonnull
java.lang.String attributeValue,
boolean isIDAttribute)
attributeName - the attribute name in QName formattributeValue - the attribute valueelement - the target element to which to marshallisIDAttribute - flag indicating whether the attribute being marshalled should be handled as an ID-typed
attributepublic static void appendDateTimeAttribute(@Nonnull
org.w3c.dom.Element element,
@Nonnull
javax.xml.namespace.QName attributeName,
long duration)
element - element to which the attribute will be added, not nullattributeName - name of the attribute, not nullduration - duration, in milliseconds, must be greater than 0public static void appendDurationAttribute(@Nonnull
org.w3c.dom.Element element,
@Nonnull
javax.xml.namespace.QName attributeName,
long duration)
element - element to which the attribute will be added, not nullattributeName - name of the attribute, not nullduration - duration, in milliseconds, must be greater than 0@Nonnull
public static org.w3c.dom.Attr constructAttribute(@Nonnull
org.w3c.dom.Document owningDocument,
@Nonnull
javax.xml.namespace.QName attributeName)
owningDocument - the owning documentattributeName - the name of that attribute@Nonnull
public static org.w3c.dom.Attr constructAttribute(@Nonnull
org.w3c.dom.Document document,
@Nullable
java.lang.String namespaceURI,
@Nonnull
java.lang.String localName,
@Nullable
java.lang.String prefix)
document - the owning documentnamespaceURI - the URI for the namespace the attribute is inlocalName - the local nameprefix - the prefix of the namespace that attribute is in@Nonnull
public static org.w3c.dom.Attr getAttribute(@Nullable
org.w3c.dom.Element element,
@Nullable
javax.xml.namespace.QName attributeName)
element - element that may contain the attribute, may be nullattributeName - name of the attribute, may be null@Nullable
public static java.lang.String getAttributeValue(@Nullable
org.w3c.dom.Element element,
@Nullable
javax.xml.namespace.QName attributeName)
element - the element from which to retrieve the attribute valueattributeName - the name of the attribute@Nullable
public static java.lang.String getAttributeValue(@Nullable
org.w3c.dom.Element element,
@Nullable
java.lang.String namespace,
@Nullable
java.lang.String attributeLocalName)
element - the element from which to retrieve the attribute valuenamespace - the namespace URI of the attributeattributeLocalName - the local (unqualified) attribute name@Nullable
public static java.lang.Boolean getAttributeValueAsBoolean(@Nullable
org.w3c.dom.Attr attribute)
attribute - attribute whose value will be converted to a boolean@Nonnull
public static java.util.List<java.lang.String> getAttributeValueAsList(@Nullable
org.w3c.dom.Attr attribute)
attribute - attribute whose value will be turned into a list@Nullable
public static javax.xml.namespace.QName getAttributeValueAsQName(@Nullable
org.w3c.dom.Attr attribute)
attribute - the attribute with a QName value@Nullable
public static java.lang.Long getDateTimeAttributeAsLong(@Nullable
org.w3c.dom.Attr attribute)
attribute - attribute from which to extract the value, may be null@Nullable
public static java.lang.Long getDurationAttributeValueAsLong(@Nullable
org.w3c.dom.Attr attribute)
attribute - attribute from which to extract the value, may be null@Nullable
public static org.w3c.dom.Attr getIdAttribute(@Nullable
org.w3c.dom.Element element)
element - the DOM element@Nullable
public static java.lang.String getXMLBase(@Nullable
org.w3c.dom.Element element)
xml:base attribute from a given Element.element - the element from which to extract the attribute@Nullable
public static java.lang.String getXMLId(@Nullable
org.w3c.dom.Element element)
xml:id attribute from a given Element.element - the element from which to extract the attribute@Nullable
public static java.lang.String getXMLLang(@Nullable
org.w3c.dom.Element element)
xml:lang attribute from a given Element.element - the element from which to extract the attribute@Nullable
public static java.util.Locale getXMLLangAsLocale(@Nullable
org.w3c.dom.Element element)
element - element to retrieve local information for@Nullable public static XMLSpace getXMLSpace(@Nullable org.w3c.dom.Element element)
xml:space attribute from a given Element.element - the element from which to extract the attributepublic static boolean hasAttribute(@Nullable
org.w3c.dom.Element element,
@Nullable
javax.xml.namespace.QName name)
element - element to checkname - name of the attributepublic static boolean removeAttribute(@Nullable
org.w3c.dom.Element element,
@Nullable
javax.xml.namespace.QName attributeName)
element - element from which the attribute should be removedattributeName - name of the attribute to be removed