|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.shibboleth.utilities.java.support.xml.AttributeSupport
public final class AttributeSupport
Set of helper methods for working with DOM Attributes.
| Constructor Summary | |
|---|---|
private |
AttributeSupport()
Constructor. |
| Method Summary | |
|---|---|
static void |
addXMLBase(Element element,
String base)
Adds a xml:base attribute to the given Element. |
static void |
addXMLId(Element element,
String id)
Adds a xml:id attribute to the given Element. |
static void |
addXMLLang(Element element,
String lang)
Adds a xml:lang attribute to the given Element. |
static void |
addXMLSpace(Element element,
XmlSpace space)
Adds a xml:space attribute to the given Element. |
static void |
appendAttribute(Element element,
QName attributeName,
List<String> attributeValues,
boolean isIDAttribute)
Adds an attribute name and value to a DOM Element. |
static void |
appendAttribute(Element element,
QName attributeName,
String attributeValue)
Adds an non-id attribute name and value to a DOM Element. |
static void |
appendAttribute(Element element,
QName attributeName,
String attributeValue,
boolean isIDAttribute)
Adds an attribute name and value to a DOM Element. |
static void |
appendDateTimeAttribute(Element element,
QName attributeName,
long duration)
Adds an attribute to the given element. |
static void |
appendDurationAttribute(Element element,
QName attributeName,
long duration)
Adds an attribute to given element. |
static Attr |
constructAttribute(Document owningDocument,
QName attributeName)
Constructs an attribute owned by the given document with the given name. |
static Attr |
constructAttribute(Document document,
String namespaceURI,
String localName,
String prefix)
Constructs an attribute owned by the given document with the given name. |
static Attr |
getAttribute(Element element,
QName attributeName)
Gets the attribute with the given name. |
static String |
getAttributeValue(Element element,
QName attributeName)
Gets the value of an attribute from an element. |
static String |
getAttributeValue(Element element,
String namespace,
String attributeLocalName)
Gets the value of an attribute from an element. |
static Boolean |
getAttributeValueAsBoolean(Attr attribute)
Parses the attribute's value. |
static List<String> |
getAttributeValueAsList(Attr attribute)
Gets the value of a list-type attribute as a list. |
static QName |
getAttributeValueAsQName(Attr attribute)
Constructs a QName from an attributes value. |
static Long |
getDateTimeAttributeAsLong(Attr attribute)
Gets the value of a dateTime-type attribute in milliseconds since the epoch. |
static Long |
getDurationAttributeValueAsLong(Attr attribute)
Gets the value of a duration-type attribute in milliseconds. |
static Attr |
getIdAttribute(Element element)
Gets the ID attribute of a DOM element. |
static String |
getXMLBase(Element element)
Gets the xml:base attribute from a given Element. |
static String |
getXMLId(Element element)
Gets the xml:id attribute from a given Element. |
static String |
getXMLLang(Element element)
Gets the xml:lang attribute from a given Element. |
static Locale |
getXMLLangAsLocale(Element element)
Gets the locale currently active for the element. |
static XmlSpace |
getXMLSpace(Element element)
Gets the xml:space attribute from a given Element. |
static boolean |
hasAttribute(Element element,
QName name)
Checks if the given attribute has an attribute with the given name. |
static boolean |
removeAttribute(Element element,
QName attributeName)
Removes an attribute from an element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private AttributeSupport()
| Method Detail |
|---|
public static void addXMLBase(@Nonnull
Element element,
@Nonnull
String base)
xml:base attribute to the given Element.
element - the element to which to add the attributebase - the base value
public static void addXMLId(@Nonnull
Element element,
@Nonnull
String id)
xml:id attribute to the given Element.
element - the element to which to add the attributeid - the Id value
public static void addXMLLang(@Nonnull
Element element,
@Nonnull
String lang)
xml:lang attribute to the given Element.
element - the element to which to add the attributelang - the lang value
public static void addXMLSpace(@Nonnull
Element element,
@Nonnull
XmlSpace space)
xml:space attribute to the given Element.
element - the element to which to add the attributespace - the space value
public static void appendAttribute(@Nonnull
Element element,
@Nonnull
QName attributeName,
List<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
attribute
public static void appendAttribute(@Nonnull
Element element,
@Nonnull
QName attributeName,
@Nonnull
String attributeValue)
attributeName - the attribute name in QName formattributeValue - the attribute valueselement - the target element to which to marshall
public static void appendAttribute(@Nonnull
Element element,
@Nonnull
QName attributeName,
@Nonnull
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
attribute
public static void appendDateTimeAttribute(@Nonnull
Element element,
@Nonnull
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
public static void appendDurationAttribute(@Nonnull
Element element,
@Nonnull
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 Attr constructAttribute(@Nonnull
Document owningDocument,
@Nonnull
QName attributeName)
owningDocument - the owning documentattributeName - the name of that attribute
@Nonnull
public static Attr constructAttribute(@Nonnull
Document document,
@Nullable
String namespaceURI,
@Nonnull
String localName,
@Nullable
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 Attr getAttribute(@Nullable
Element element,
@Nullable
QName attributeName)
element - element that may contain the attribute, may be nullattributeName - name of the attribute, may be null
@Nullable
public static String getAttributeValue(@Nullable
Element element,
@Nullable
QName attributeName)
element - the element from which to retrieve the attribute valueattributeName - the name of the attribute
@Nullable
public static String getAttributeValue(@Nullable
Element element,
@Nullable
String namespace,
@Nullable
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 Boolean getAttributeValueAsBoolean(@Nullable
Attr attribute)
attribute - attribute whose value will be converted to a boolean
@Nonnull
public static List<String> getAttributeValueAsList(@Nullable
Attr attribute)
attribute - attribute whose value will be turned into a list
@Nullable
public static QName getAttributeValueAsQName(@Nullable
Attr attribute)
attribute - the attribute with a QName value
@Nullable
public static Long getDateTimeAttributeAsLong(@Nullable
Attr attribute)
attribute - attribute from which to extract the value, may be null
@Nullable
public static Long getDurationAttributeValueAsLong(@Nullable
Attr attribute)
attribute - attribute from which to extract the value, may be null
@Nullable
public static Attr getIdAttribute(@Nullable
Element element)
element - the DOM element
@Nullable
public static String getXMLBase(@Nullable
Element element)
xml:base attribute from a given Element.
element - the element from which to extract the attribute
@Nullable
public static String getXMLId(@Nullable
Element element)
xml:id attribute from a given Element.
element - the element from which to extract the attribute
@Nullable
public static String getXMLLang(@Nullable
Element element)
xml:lang attribute from a given Element.
element - the element from which to extract the attribute
@Nullable
public static Locale getXMLLangAsLocale(@Nullable
Element element)
element - element to retrieve local information for
@Nullable
public static XmlSpace getXMLSpace(@Nullable
Element element)
xml:space attribute from a given Element.
element - the element from which to extract the attribute
public static boolean hasAttribute(@Nullable
Element element,
@Nullable
QName name)
element - element to checkname - name of the attribute
public static boolean removeAttribute(@Nullable
Element element,
@Nullable
QName attributeName)
element - element from which the attribute should be removedattributeName - name of the attribute to be removed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||