public final class AttributeUtil extends Object
AttributeDefaultValue
and
PreserveSpaceDefaultValue
.Modifier and Type | Method and Description |
---|---|
static String |
getAttribute(Element element,
Name name,
AttributeDefaultValue defaultValue)
Returns value of specified attribute.
|
static String |
getSpaceAttribute(Element element)
|
static boolean |
hasPreserveSpace(Element element)
Returns
true if whitespace must be preserved in specified
element. |
static String |
lookupAttribute(Element element,
Name[] attrNames,
AttributeDefaultValue defaultValue)
Same as
lookupAttribute(Element, Name, AttributeDefaultValue)
expect that this method searches any of the specified
attributes. |
static String |
lookupAttribute(Element element,
Name attrName,
AttributeDefaultValue defaultValue)
Searches specified attribute in specified element and all its ancestors.
|
public static String getAttribute(Element element, Name name, AttributeDefaultValue defaultValue)
null
if this
attribute is not found.element
- element which is searched for specified attributename
- name of attributedefaultValue
- an object which is queried when the element
does not contain specified attribute. May be null
.null
public static String lookupAttribute(Element element, Name attrName, AttributeDefaultValue defaultValue)
null
if this attribute is not found.element
- element which is searched for specified attributeattrName
- name of searched attributedefaultValue
- an object which is queried when the element
does not contain specified attribute. May be null
.null
public static String lookupAttribute(Element element, Name[] attrNames, AttributeDefaultValue defaultValue)
lookupAttribute(Element, Name, AttributeDefaultValue)
expect that this method searches any of the specified
attributes.public static String getSpaceAttribute(Element element)
PreserveSpaceDefaultValue
public static boolean hasPreserveSpace(Element element)
true
if whitespace must be preserved in specified
element. Returns false
otherwise.
Searches specified element and all its ancestors using
lookupAttribute(element, Name.XML_SPACE,
PreserveSpaceDefaultValue.INSTANCE)
.
PreserveSpaceDefaultValue