org.sbml.jsbml.xml
public abstract class XMLToken extends AbstractTreeNode
This class of objects is defined by JSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.
Modifier and Type | Field and Description |
---|---|
protected XMLAttributes |
attributes |
protected java.lang.StringBuilder |
characters |
protected long |
column |
protected boolean |
isEndElement |
protected boolean |
isEOF |
protected boolean |
isStartElement |
protected boolean |
isText |
protected long |
line |
protected XMLNamespaces |
namespaces |
private static long |
serialVersionUID
Generated serial version identifier
|
protected XMLTriple |
triple
the XMLTripe (name, uri and prefix) of this XML element.
|
listOfListeners, parent, UNKNOWN_ATTRIBUTES, UNKNOWN_ELEMENTS
Constructor and Description |
---|
XMLToken()
Creates a new empty
XMLToken . |
XMLToken(java.lang.String chars)
Creates a text
XMLToken . |
XMLToken(java.lang.String chars,
long line)
Creates a text
XMLToken . |
XMLToken(java.lang.String chars,
long line,
long column)
Creates a text
XMLToken . |
XMLToken(XMLToken orig)
Copy constructor; creates a copy of this
XMLToken . |
XMLToken(XMLTriple triple)
Creates an end element
XMLToken . |
XMLToken(XMLTriple triple,
long line)
Creates an end element
XMLToken . |
XMLToken(XMLTriple triple,
long line,
long column)
Creates an end element
XMLToken . |
XMLToken(XMLTriple triple,
XMLAttributes attributes)
Creates a start element
XMLToken with the given set of attributes. |
XMLToken(XMLTriple triple,
XMLAttributes attributes,
long line)
Creates a start element
XMLToken with the given set of attributes. |
XMLToken(XMLTriple triple,
XMLAttributes attributes,
long line,
long column)
Creates a start element
XMLToken with the given set of attributes. |
XMLToken(XMLTriple triple,
XMLAttributes attributes,
XMLNamespaces namespaces)
Creates a start element
XMLToken with the given set of attributes and
namespace declarations. |
XMLToken(XMLTriple triple,
XMLAttributes attributes,
XMLNamespaces namespaces,
long line)
Creates a start element
XMLToken with the given set of attributes and
namespace declarations. |
XMLToken(XMLTriple triple,
XMLAttributes attributes,
XMLNamespaces namespaces,
long line,
long column)
Creates a start element
XMLToken with the given set of attributes and
namespace declarations. |
Modifier and Type | Method and Description |
---|---|
int |
addAttr(java.lang.String name,
java.lang.String value)
Adds an attribute to the attribute set in this
XMLToken optionally
with a prefix and URI defining a namespace. |
int |
addAttr(java.lang.String name,
java.lang.String value,
java.lang.String namespaceURI)
Adds an attribute to the attribute set in this
XMLToken optionally
with a prefix and URI defining a namespace. |
int |
addAttr(java.lang.String name,
java.lang.String value,
java.lang.String namespaceURI,
java.lang.String prefix)
Adds an attribute to the attribute set in this
XMLToken optionally
with a prefix and URI defining a namespace. |
int |
addAttr(XMLTriple triple,
java.lang.String value)
|
int |
addNamespace(java.lang.String uri)
Appends an XML namespace URI to this
XMLToken . |
int |
addNamespace(java.lang.String uri,
java.lang.String prefix)
Appends an XML namespace prefix and URI pair to this
XMLToken . |
void |
append(java.lang.String chars)
Appends characters to this XML text content.
|
int |
clearAttributes()
Clears (deletes) all attributes in this
XMLToken . |
int |
clearNamespaces()
Clears (deletes) all XML namespace declarations in the
XMLNamespaces of
this XMLToken . |
abstract XMLToken |
clone() |
boolean |
equals(java.lang.Object obj) |
XMLAttributes |
getAttributes()
Returns the attributes of this element.
|
int |
getAttributesLength()
Returns the number of attributes in the attributes set.
|
int |
getAttrIndex(java.lang.String name)
Returns the index of an attribute with the given local name.
|
int |
getAttrIndex(java.lang.String name,
java.lang.String uri)
Returns the index of an attribute with the given local name and namespace URI.
|
int |
getAttrIndex(XMLTriple triple)
Returns the index of an attribute with the given
XMLTriple . |
java.lang.String |
getAttrName(int index)
Returns the local name of an attribute in the attributes set in this
XMLToken (by position). |
java.lang.String |
getAttrPrefix(int index)
Returns the prefix of an attribute in the attribute set in this
XMLToken (by position). |
java.lang.String |
getAttrPrefixedName(int index)
Returns the prefixed name of an attribute in the attribute set in this
XMLToken (by position). |
java.lang.String |
getAttrURI(int index)
Returns the namespace URI of an attribute in the attribute set in this
XMLToken (by position). |
java.lang.String |
getAttrValue(int index)
Returns the value of an attribute in the attribute set in this
XMLToken
(by position). |
java.lang.String |
getAttrValue(java.lang.String name)
Returns a value of an attribute with the given local name.
|
java.lang.String |
getAttrValue(java.lang.String name,
java.lang.String uri)
Returns a value of an attribute with the given local name and namespace URI.
|
java.lang.String |
getAttrValue(XMLTriple triple)
Returns a value of an attribute with the given
XMLTriple . |
java.lang.String |
getCharacters()
Returns the text of this element.
|
long |
getColumn()
Returns the column at which this
XMLToken occurred in the input
document or data stream. |
long |
getLine()
Returns the line at which this
XMLToken occurred in the input document
or data stream. |
java.lang.String |
getName()
Returns the (unqualified) name of this XML element.
|
int |
getNamespaceIndex(java.lang.String uri)
Returns the index of an XML namespace declaration by URI.
|
int |
getNamespaceIndexByPrefix(java.lang.String prefix)
Returns the index of an XML namespace declaration by prefix.
|
java.lang.String |
getNamespacePrefix(int index)
Returns the prefix of an XML namespace declaration by position.
|
java.lang.String |
getNamespacePrefix(java.lang.String uri)
Returns the prefix of an XML namespace declaration by its URI.
|
XMLNamespaces |
getNamespaces()
Returns the XML namespace declarations for this XML element.
|
int |
getNamespacesLength()
Returns the number of XML namespaces stored in the
XMLNamespaces
of this XMLToken . |
java.lang.String |
getNamespaceURI()
Returns the URI of an XML namespace declaration for the empty prefix.
|
java.lang.String |
getNamespaceURI(int index)
Returns the URI of an XML namespace declaration by its position.
|
java.lang.String |
getNamespaceURI(java.lang.String prefix)
Returns the URI of an XML namespace declaration by its prefix.
|
java.lang.String |
getPrefix()
Returns the namespace prefix of this XML element.
|
java.lang.String |
getURI()
Returns the namespace URI of this XML element.
|
boolean |
hasAttr(int index)
Returns
true or false depending on whether
an attribute with the given index exists in the attribute set in this
XMLToken . |
boolean |
hasAttr(java.lang.String name)
Returns
true or false depending on whether
an attribute with the given local name exists
in the attribute set in this XMLToken . |
boolean |
hasAttr(java.lang.String name,
java.lang.String uri)
Returns
true or false depending on whether
an attribute with the given local name and namespace URI exists
in the attribute set in this XMLToken . |
boolean |
hasAttr(XMLTriple triple)
Returns
true or false depending on whether
an attribute with the given XML triple exists in the attribute set in
this XMLToken |
int |
hashCode() |
boolean |
hasNamespaceNS(java.lang.String uri,
java.lang.String prefix)
Returns
true or false depending on whether
an XML Namespace with the given uri/prefix pair is contained in the
XMLNamespaces of this XMLToken . |
boolean |
hasNamespacePrefix(java.lang.String prefix)
Returns
true or false depending on whether
an XML Namespace with the given prefix is contained in the XMLNamespaces of
this XMLToken . |
boolean |
hasNamespaceURI(java.lang.String uri)
Returns
true or false depending on whether
an XML Namespace with the given URI is contained in the XMLNamespaces of
this XMLToken . |
boolean |
isAttributesEmpty()
|
boolean |
isElement()
|
boolean |
isEnd()
|
boolean |
isEndFor(XMLToken element)
Returns
true or false depending on whether
this XMLToken is an XML end element for the given start element. |
boolean |
isEOF()
|
boolean |
isNamespacesEmpty()
|
boolean |
isStart()
|
boolean |
isText()
|
int |
removeAttr(int n)
Removes an attribute with the given index from the attribute set in
this
XMLToken . |
int |
removeAttr(java.lang.String name)
Removes an attribute with the given local name from
the attribute set in this
XMLToken . |
int |
removeAttr(java.lang.String name,
java.lang.String uri)
Removes an attribute with the given local name and namespace URI from
the attribute set in this
XMLToken . |
int |
removeAttr(XMLTriple triple)
|
int |
removeNamespace(int index)
Removes an XML Namespace stored in the given position of the
XMLNamespaces
of this XMLToken . |
int |
removeNamespace(java.lang.String prefix)
Removes an XML Namespace with the given prefix.
|
int |
setAttributes(XMLAttributes attributes)
Sets an
XMLAttributes to this XMLToken . |
void |
setCharacters(java.lang.String chars)
Sets the characters in this
XMLToken . |
int |
setEnd()
Declares this XML start element is also an end element.
|
int |
setEOF()
Declares this
XMLToken is an end-of-file (input) marker. |
int |
setNamespaces(XMLNamespaces namespaces)
Sets an XMLnamespaces to this XML element.
|
int |
setTriple(XMLTriple triple)
Sets the XMLTripe (name, uri and prefix) of this XML element.
|
java.lang.String |
toString() |
int |
unsetEnd()
Declares this XML start/end element is no longer an end element.
|
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, fireNodeRemovedEvent, firePropertyChange, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getParent, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, notifyChildChange, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySet
private static final long serialVersionUID
protected XMLAttributes attributes
protected java.lang.StringBuilder characters
protected long column
protected boolean isEndElement
protected boolean isEOF
protected boolean isStartElement
protected boolean isText
protected long line
protected XMLNamespaces namespaces
protected XMLTriple triple
public XMLToken()
XMLToken
.public XMLToken(java.lang.String chars)
XMLToken
.
chars
- a string, the text to be added to the XMLToken
public XMLToken(java.lang.String chars, long line)
XMLToken
.
chars
- a string, the text to be added to the XMLToken
line
- a long integer, the line number (default = 0).public XMLToken(java.lang.String chars, long line, long column)
XMLToken
.
chars
- a String
, the text to be added to the XMLToken
line
- a long integer, the line number (default = 0).column
- a long integer, the column number (default = 0).
public XMLToken(XMLTriple triple)
XMLToken
.
triple
- XMLTriple
.
public XMLToken(XMLTriple triple, long line)
XMLToken
.
triple
- XMLTriple
.line
- a long integer, the line number (default = 0).
public XMLToken(XMLTriple triple, long line, long column)
XMLToken
.
triple
- XMLTriple
.line
- a long integer, the line number (default = 0).column
- a long integer, the column number (default = 0).
public XMLToken(XMLTriple triple, XMLAttributes attributes)
XMLToken
with the given set of attributes.
triple
- XMLTriple
.attributes
- XMLAttributes
, the attributes to set.
public XMLToken(XMLTriple triple, XMLAttributes attributes, long line)
XMLToken
with the given set of attributes.
triple
- XMLTriple
.attributes
- XMLAttributes
, the attributes to set.line
- a long integer, the line number (default = 0).
public XMLToken(XMLTriple triple, XMLAttributes attributes, long line, long column)
XMLToken
with the given set of attributes.
triple
- XMLTriple
.attributes
- XMLAttributes
, the attributes to set.line
- a long integer, the line number (default = 0).column
- a long integer, the column number (default = 0).
public XMLToken(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces)
XMLToken
with the given set of attributes and
namespace declarations.
triple
- XMLTriple
.attributes
- XMLAttributes
, the attributes to set.namespaces
- XMLNamespaces
, the namespaces to set.
public XMLToken(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces, long line)
XMLToken
with the given set of attributes and
namespace declarations.
triple
- XMLTriple
.attributes
- XMLAttributes
, the attributes to set.namespaces
- XMLNamespaces
, the namespaces to set.line
- a long integer, the line number (default = 0).
public XMLToken(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces, long line, long column)
XMLToken
with the given set of attributes and
namespace declarations.
triple
- XMLTriple
.attributes
- XMLAttributes
, the attributes to set.namespaces
- XMLNamespaces
, the namespaces to set.line
- a long integer, the line number (default = 0).column
- a long integer, the column number (default = 0).
public int addAttr(java.lang.String name, java.lang.String value)
XMLToken
optionally
with a prefix and URI defining a namespace.
Nothing will be done if this XMLToken
is not a start element.
name
- a string, the local name of the attribute.value
- a string, the value of the attribute.
public int addAttr(java.lang.String name, java.lang.String value, java.lang.String namespaceURI)
XMLToken
optionally
with a prefix and URI defining a namespace.
Nothing will be done if this XMLToken
is not a start element.
name
- a string, the local name of the attribute.value
- a string, the value of the attribute.namespaceURI
- a string, the namespace URI of the attribute.
public int addAttr(java.lang.String name, java.lang.String value, java.lang.String namespaceURI, java.lang.String prefix)
XMLToken
optionally
with a prefix and URI defining a namespace.
Nothing will be done if this XMLToken
is not a start element.
name
- a string, the local name of the attribute.value
- a string, the value of the attribute.namespaceURI
- a string, the namespace URI of the attribute.prefix
- a string, the prefix of the namespace
public int addAttr(XMLTriple triple, java.lang.String value)
XMLTriple
/value pair to the attribute set
in this XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
triple
- an XMLTriple
, the XML triple of the attribute.value
- a string, the value of the attribute.
public int addNamespace(java.lang.String uri)
XMLToken
.
If there is an XML namespace with the given prefix in this XMLToken
,
then the existing XML namespace will be overwritten by the new one.
Nothing will be done if this XMLToken
is not a start element.
uri
- a string, the uri for the namespace
public int addNamespace(java.lang.String uri, java.lang.String prefix)
XMLToken
.
If there is an XML namespace with the given prefix in this XMLToken
,
then the existing XML namespace will be overwritten by the new one.
Nothing will be done if this XMLToken
is not a start element.
uri
- a string, the uri for the namespaceprefix
- a string, the prefix for the namespace
java.lang.IllegalArgumentException
- if one of the arguments is null or if the prefix is malformed.public void append(java.lang.String chars)
public int clearAttributes()
XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
public int clearNamespaces()
XMLNamespaces
of
this XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
public abstract XMLToken clone()
clone
in class AbstractTreeNode
public boolean equals(java.lang.Object obj)
equals
in class AbstractTreeNode
public XMLAttributes getAttributes()
XMLAttributes
of this XML element.public int getAttributesLength()
XMLToken
.public int getAttrIndex(java.lang.String name)
name
- a string, the local name of the attribute.
public int getAttrIndex(java.lang.String name, java.lang.String uri)
name
- a string, the local name of the attribute.uri
- a string, the namespace URI of the attribute.
public int getAttrIndex(XMLTriple triple)
XMLTriple
.
public java.lang.String getAttrName(int index)
XMLToken
(by position).
index
- an integer, the position of the attribute whose local name
is required.
public java.lang.String getAttrPrefix(int index)
XMLToken
(by position).
index
- an integer, the position of the attribute whose prefix is
required.
public java.lang.String getAttrPrefixedName(int index)
XMLToken
(by position).
index
- an integer, the position of the attribute whose prefixed
name is required.
public java.lang.String getAttrURI(int index)
XMLToken
(by position).
index
- an integer, the position of the attribute whose namespace
URI is required.
public java.lang.String getAttrValue(int index)
XMLToken
(by position).
index
- an integer, the position of the attribute whose value is
required.
public java.lang.String getAttrValue(java.lang.String name)
name
- a string, the local name of the attribute whose value is required.
public java.lang.String getAttrValue(java.lang.String name, java.lang.String uri)
name
- a string, the local name of the attribute whose value is required.uri
- a string, the namespace URI of the attribute.
public java.lang.String getAttrValue(XMLTriple triple)
XMLTriple
.
triple
- an XMLTriple
, the XML triple of the attribute whose
value is required.
public java.lang.String getCharacters()
public long getColumn()
XMLToken
occurred in the input
document or data stream.
XMLToken
occurred.public long getLine()
XMLToken
occurred in the input document
or data stream.
XMLToken
occurred.public java.lang.String getName()
public int getNamespaceIndex(java.lang.String uri)
uri
- a string, uri of the required namespace.
public int getNamespaceIndexByPrefix(java.lang.String prefix)
prefix
- a string, prefix of the required namespace.
public java.lang.String getNamespacePrefix(int index)
Callers should use getNamespacesLength() to find out how many
namespaces are stored in the XMLNamespaces
.
index
- an integer, position of the required prefix.
XMLNamespaces
(by position).
getNamespacesLength()
public java.lang.String getNamespacePrefix(java.lang.String uri)
uri
- a string, the URI of the prefix being sought
public XMLNamespaces getNamespaces()
public int getNamespacesLength()
XMLNamespaces
of this XMLToken
.
public java.lang.String getNamespaceURI()
public java.lang.String getNamespaceURI(int index)
index
- an integer, position of the required URI.
XMLNamespaces
(by position).
getNamespacesLength()
public java.lang.String getNamespaceURI(java.lang.String prefix)
prefix
- a string, the prefix of the required URI
public java.lang.String getPrefix()
public java.lang.String getURI()
public boolean hasAttr(int index)
true
or false
depending on whether
an attribute with the given index exists in the attribute set in this
XMLToken
.
index
- an integer, the position of the attribute.
true
if an attribute with the given index exists in the attribute
set in this XMLToken
, false
otherwise.public boolean hasAttr(java.lang.String name)
true
or false
depending on whether
an attribute with the given local name exists
in the attribute set in this XMLToken
.
name
- a string, the local name of the attribute.
true
if an attribute with the given local name
exists in the attribute set in this XMLToken
, false
otherwise.public boolean hasAttr(java.lang.String name, java.lang.String uri)
true
or false
depending on whether
an attribute with the given local name and namespace URI exists
in the attribute set in this XMLToken
.
name
- a string, the local name of the attribute.uri
- a string, the namespace URI of the attribute.
true
if an attribute with the given local name and namespace
URI exists in the attribute set in this XMLToken
, false
otherwise.public boolean hasAttr(XMLTriple triple)
true
or false
depending on whether
an attribute with the given XML triple exists in the attribute set in
this XMLToken
public int hashCode()
hashCode
in class AbstractTreeNode
public boolean hasNamespaceNS(java.lang.String uri, java.lang.String prefix)
true
or false
depending on whether
an XML Namespace with the given uri/prefix pair is contained in the
XMLNamespaces
of this XMLToken
.
uri
- a string, the uri for the namespaceprefix
- a string, the prefix for the namespace
true
if an XML Namespace with the given uri/prefix pair is
contained in the XMLNamespaces
of this XMLToken
, false
otherwise.public boolean hasNamespacePrefix(java.lang.String prefix)
true
or false
depending on whether
an XML Namespace with the given prefix is contained in the XMLNamespaces
of
this XMLToken
.
prefix
- a string, the prefix for the namespace
true
if an XML Namespace with the given URI is contained in the
XMLNamespaces
of this XMLToken
, false
otherwise.public boolean hasNamespaceURI(java.lang.String uri)
true
or false
depending on whether
an XML Namespace with the given URI is contained in the XMLNamespaces
of
this XMLToken
.
uri
- a string, the uri for the namespace
true
if an XML Namespace with the given URI is contained in the
XMLNamespaces
of this XMLToken
, false
otherwise.public boolean isAttributesEmpty()
true
if the attribute set in this XMLToken
is empty,
false
otherwise.public boolean isElement()
true
if this XMLToken
is an XML element, false
otherwise.public boolean isEnd()
true
if this XMLToken
is an XML end element, false
otherwise.public boolean isEndFor(XMLToken element)
true
or false
depending on whether
this XMLToken
is an XML end element for the given start element.
public boolean isEOF()
true
if this XMLToken
is an end of file (input) marker, false
otherwise.public boolean isNamespacesEmpty()
true
if the XMLNamespaces
of this XMLToken
is empty,
false
otherwise.public boolean isStart()
true
if this XMLToken
is an XML start element, false
otherwise.public boolean isText()
true
if this XMLToken
is an XML text element, false
otherwise.public int removeAttr(int n)
XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
n
- an integer the index of the resource to be deleted
public int removeAttr(java.lang.String name)
XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
name
- a string, the local name of the attribute.
public int removeAttr(java.lang.String name, java.lang.String uri)
XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
name
- a string, the local name of the attribute.uri
- a string, the namespace URI of the attribute.
public int removeAttr(XMLTriple triple)
XMLTriple
from the attribute set
in this XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
triple
- an XMLTriple
, the XML triple of the attribute.
public int removeNamespace(int index)
XMLNamespaces
of this XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
index
- an integer, position of the removed namespace.
public int removeNamespace(java.lang.String prefix)
XMLToken
is not a start element.
prefix
- a string, prefix of the required namespace.
public int setAttributes(XMLAttributes attributes)
XMLAttributes
to this XMLToken
.
Nothing will be done if this XMLToken
is not a start element.
attributes
- XMLAttributes
to be set to this XMLToken
.
public void setCharacters(java.lang.String chars)
XMLToken
.chars
- the characters to setpublic int setEnd()
public int setEOF()
XMLToken
is an end-of-file (input) marker.
public int setNamespaces(XMLNamespaces namespaces)
Nothing will be done if this XMLToken
is not a start element.
namespaces
- XMLNamespaces
to be set to this XMLToken
.
public int setTriple(XMLTriple triple)
Nothing will be done if this XML element is a text node.
triple
- XMLTriple
to be added to this XML element.
public java.lang.String toString()
toString
in class AbstractTreeNode
public int unsetEnd()