class StartTag extends Content implements NamespaceResolver
This object implements NamespaceResolver
for attribute values.
Modifier and Type | Field and Description |
---|---|
(package private) Document |
document |
private Attribute |
firstAtt |
private NamespaceDecl |
firstNs
Explicitly given namespace declarations on this element.
|
private Attribute |
lastAtt |
private NamespaceDecl |
lastNs |
private java.lang.String |
localName |
private ContainerElement |
owner
If this
StartTag has the parent ContainerElement ,
that value. |
private java.lang.String |
uri
Tag name of the element.
|
Constructor and Description |
---|
StartTag(ContainerElement owner,
java.lang.String uri,
java.lang.String localName) |
StartTag(Document document,
java.lang.String uri,
java.lang.String localName) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
accept(ContentVisitor visitor)
Accepts a visitor.
|
void |
addAttribute(java.lang.String nsUri,
java.lang.String localName,
java.lang.Object arg) |
NamespaceDecl |
addNamespaceDecl(java.lang.String uri,
java.lang.String prefix,
boolean requirePrefix)
Declares a new namespace URI on this tag.
|
private void |
checkWritable()
Throws an error if the start tag has already been committed.
|
(package private) boolean |
concludesPendingStartTag()
Returns true if this
Content can guarantee that
no more new namespace decls is necessary for the currently
pending start tag. |
java.lang.String |
getPrefix(java.lang.String nsUri)
Allocates a prefix for the specified URI and returns it.
|
(package private) boolean |
isReadyToCommit()
A
StartTag can be only written after
we are sure that all the necessary namespace declarations are given. |
(package private) boolean |
isWritten()
Returns true if this start tag has already been written.
|
void |
written()
Called when this content is written to the output.
|
private java.lang.String uri
This field is also used as a flag to indicate whether the start tag has been written. This field is initially set to non-null, and then reset to null when it's written.
private final java.lang.String localName
private Attribute firstAtt
private Attribute lastAtt
private ContainerElement owner
StartTag
has the parent ContainerElement
,
that value. Otherwise null.private NamespaceDecl firstNs
Additional namespace declarations might be necessary to
generate child QName
s and attributes.
private NamespaceDecl lastNs
final Document document
public StartTag(ContainerElement owner, java.lang.String uri, java.lang.String localName)
public StartTag(Document document, java.lang.String uri, java.lang.String localName)
public void addAttribute(java.lang.String nsUri, java.lang.String localName, java.lang.Object arg)
public NamespaceDecl addNamespaceDecl(java.lang.String uri, java.lang.String prefix, boolean requirePrefix)
uri
- namespace URI to be bound. Can be empty, but must not be null.prefix
- If non-null and non-empty, this prefix is bound to the URI
on this element. If empty, then the runtime will still try to
use the URI as the default namespace, but it may fail to do so
because of the constraints in the XML.
If this parameter is null, the runtime will allocate an unique prefix.
requirePrefix
- Used only when the prefix parameter is null. If true, this indicates
that the non-empty prefix must be assigned to this URI. If false,
then this URI might be used as the default namespace.
Normally you just need to set it to false.
private void checkWritable()
boolean isWritten()
boolean isReadyToCommit()
StartTag
can be only written after
we are sure that all the necessary namespace declarations are given.isReadyToCommit
in class Content
public void written()
Content
boolean concludesPendingStartTag()
Content
Content
can guarantee that
no more new namespace decls is necessary for the currently
pending start tag.concludesPendingStartTag
in class Content
void accept(ContentVisitor visitor)
Content
public java.lang.String getPrefix(java.lang.String nsUri)
NamespaceResolver
getPrefix
in interface NamespaceResolver
nsUri
- the namespace URI to be declared. Can be empty but must not be null.