public class AttributeList extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AttributeList.AttributeEntry
A name/value pair of the attribute list.
|
Modifier and Type | Field and Description |
---|---|
static String |
XML_NAMESPACE
A constant containing the XML namespace identifier.
|
static String |
XMLNS_NAMESPACE
A constant containing the XML-Namespace namespace identifier.
|
Constructor and Description |
---|
AttributeList()
Creates an empty attribute list with no default values.
|
Modifier and Type | Method and Description |
---|---|
void |
addNamespaceDeclaration(String prefix,
String namespaceUri)
Adds a namespace declaration.
|
String |
getAttribute(String namespace,
String name)
Returns the attribute value for the given attribute name or null, if the attribute is not defined in this list.
|
String |
getAttribute(String namespace,
String name,
String defaultValue)
Returns the attribute value for the given attribute name or the given defaultvalue, if the attribute is not defined
in this list.
|
boolean |
isEmpty()
Checks, whether this list is empty.
|
boolean |
isNamespacePrefixDefined(String prefix)
Checks, whether the given prefix is defined.
|
boolean |
isNamespaceUriDefined(String uri)
Checks, whether the given namespace URI has a defined prefix.
|
Iterator |
iterator()
Deprecated.
use toArray instead.
|
void |
removeAttribute(String namespace,
String name)
Removes the attribute with the given name from the list.
|
void |
removeNamespaceDeclaration(String prefix)
Removes a namespace declaration from this attribute list.
|
void |
setAttribute(String namespace,
String name,
String value)
Defines an attribute.
|
AttributeList.AttributeEntry[] |
toArray() |
public static final String XMLNS_NAMESPACE
public static final String XML_NAMESPACE
public AttributeList()
public Iterator iterator()
public AttributeList.AttributeEntry[] toArray()
public void setAttribute(String namespace, String name, String value)
namespace
- the namespace of the attribute.name
- the name of the attribute to be definedvalue
- the value of the attribute.public String getAttribute(String namespace, String name)
namespace
- the namespace of the attribute.name
- the name of the attributepublic String getAttribute(String namespace, String name, String defaultValue)
namespace
- the namespace of the attribute.name
- the name of the attribute.defaultValue
- the default value.public void removeAttribute(String namespace, String name)
namespace
- the namespace of the attribute that should be removed.name
- the name of the attribute which should be removed..public boolean isEmpty()
public void addNamespaceDeclaration(String prefix, String namespaceUri)
prefix
- the desired namespace prefix (can be null or empty to define the default namespace.namespaceUri
- the URI of the namespace.public void removeNamespaceDeclaration(String prefix)
prefix
- the declared namespace prefix.public boolean isNamespacePrefixDefined(String prefix)
prefix
- the namespace prefix.public boolean isNamespaceUriDefined(String uri)
uri
- the uri.Copyright © 2019 Hitachi Vantara. All rights reserved.