public interface OMNamedInformationItem extends OMInformationItem
Modifier and Type | Method and Description |
---|---|
String |
getLocalName()
Get the local name of the information item.
|
OMNamespace |
getNamespace()
Get the namespace this information item is part of.
|
String |
getNamespaceURI()
Get the namespace URI of this information item.
|
String |
getPrefix()
Get the prefix of this information item.
|
QName |
getQName()
Get the QName of this information item.
|
boolean |
hasName(QName name)
Determine if this information item has the given name.
|
void |
setLocalName(String localName)
Set the local name of this information item.
|
void |
setNamespace(OMNamespace namespace,
boolean declare)
Set the namespace for this information item.
|
clone, getOMFactory
String getLocalName()
void setLocalName(String localName)
localName
- the new local name of the information itemOMNamespace getNamespace()
null
if the information item
has no namespace. Note that this implies that the method never returns an
OMNamespace
object with both prefix and namespace URI set to the empty
string. In addition, the prefix of the returned OMNamespace
object (if any)
is never null
: if a null
prefix was specified when creating
this information item, then a prefix has been automatically assigned and the assigned
prefix is returned.void setNamespace(OMNamespace namespace, boolean declare)
declare
is true
this method ensures that a corresponding namespace declaration exists: if no corresponding
namespace declaration is already in scope, then a new one will be added to the nearest
element (i.e. the element itself if this information item is an element or the owner element
if this information item is an attribute).namespace
- The new namespace for this information item, or null
to remove the
namespace from this information item. If an OMNamespace
instance with a
null
prefix is given, then a prefix will be generated automatically.
In this case, the generated prefix can be determined using getNamespace()
method.declare
- Indicates whether a namespace declaration should be generated if necessary;
ignored if the information item is an attribute without owner element.IllegalArgumentException
- if an attempt is made to change the namespace of the information item in such a
way that it would make the document ill-formed with respect to namespaces (e.g.
binding a prefix to the empty namespace name)QName getQName()
Note that if you simply need to check if the information item has a given QName, then you
should use hasName(QName)
instead of this method.
QName
for the information itemString getPrefix()
Node.getPrefix()
(when called on an Element
or Attr
).null
if the information item has
no prefixString getNamespaceURI()
Node.getNamespaceURI()
(when called on an
Element
or Attr
).null
if the information
item has no namespaceboolean hasName(QName name)
The result of the expression node.hasName(name)
is the same as
node.getQName().equals(name)
. However, the former expression is generally more
efficient than the latter because it avoids the creation of the QName
object. In
addition, for an OMSourcedElement
it avoids the expansion of the element if the
prefix is unknown.
name
- the QName to compare with the QName of this information itemtrue
if the information item has the given name, false
otherwiseCopyright © The Apache Software Foundation. All Rights Reserved.