Package org.gjt.xpp.impl.tag
Class StartTag
java.lang.Object
org.gjt.xpp.impl.tag.Tag
org.gjt.xpp.impl.tag.StartTag
- All Implemented Interfaces:
XmlStartTag
,XmlTag
- Direct Known Subclasses:
Node
Encapsulate XML STag and EmptyElement
- Author:
- Aleksander Slominski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String namespaceUri, String localName, String rawName, String value) parameters modeled after SAX2 attribute approachvoid
addAttribute
(String namespaceUri, String localName, String rawName, String value, boolean isNamespaceDeclaration) Parameter isNamespaceDeclaration if true indicates that attribute is related to namespace management and may be ignored by normal processingvoid
ensureAttributesCapacity
(int minCapacity) Make sure that there is enough space to keep size attributes.boolean
int
Return number of attributes.getAttributeLocalName
(int index) Get localName of attribute number index (starts from 0) if namespaces enabled or just attribute name if namespaces disabled.getAttributeNamespaceUri
(int index) Get uri of attribute number index (starts from 0).getAttributePrefix
(int index) Returns the prefix of the specified attribute Returns null if invalid index or if element has no prefix.getAttributeRawName
(int index) Return qName of atrribute number index (starts from 0)getAttributeValue
(int index) Return value of attribute number index.getAttributeValueFromName
(String uri, String localName) Return value of attribute named (uri, localName) or null of no such attribute found.Return value of attribute named qName or null of no such attribute found.boolean
isAttributeNamespaceDeclaration
(int index) Return true if attribute at index is namespace declaration such as xmlns='...' or xmlns:prefix='...'protected void
printFields
(StringBuffer buf) Print into StringBuffer element nameboolean
removeAttributeByName
(String uri, String localName) This method tries to remove attribute identified by namespace uti and local name.boolean
removeAttributeByRawName
(String rawName) This method tries to remove attribute identified by raw name.void
remove all atributevoid
Reinitialize start tag content to nonetoString()
Return string representation of start tag including name and list of attributes.Methods inherited from class org.gjt.xpp.impl.tag.Tag
getLocalName, getNamespaceUri, getPrefix, getRawName, hashCode, modifyTag, resetTag
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.gjt.xpp.XmlTag
getLocalName, getNamespaceUri, getPrefix, getRawName, modifyTag, resetTag
-
Constructor Details
-
StartTag
public StartTag()
-
-
Method Details
-
resetStartTag
public void resetStartTag()Reinitialize start tag content to none- Specified by:
resetStartTag
in interfaceXmlStartTag
-
getAttributeCount
public int getAttributeCount()Return number of attributes.- Specified by:
getAttributeCount
in interfaceXmlStartTag
-
getAttributeNamespaceUri
Get uri of attribute number index (starts from 0). (meaningful only if namespaces enabled)- Specified by:
getAttributeNamespaceUri
in interfaceXmlStartTag
-
getAttributeLocalName
Get localName of attribute number index (starts from 0) if namespaces enabled or just attribute name if namespaces disabled.- Specified by:
getAttributeLocalName
in interfaceXmlStartTag
-
getAttributePrefix
Description copied from interface:XmlStartTag
Returns the prefix of the specified attribute Returns null if invalid index or if element has no prefix.- Specified by:
getAttributePrefix
in interfaceXmlStartTag
-
getAttributeRawName
Return qName of atrribute number index (starts from 0)- Specified by:
getAttributeRawName
in interfaceXmlStartTag
-
getAttributeValue
Return value of attribute number index.- Specified by:
getAttributeValue
in interfaceXmlStartTag
-
isAttributeNamespaceDeclaration
public boolean isAttributeNamespaceDeclaration(int index) Description copied from interface:XmlStartTag
Return true if attribute at index is namespace declaration such as xmlns='...' or xmlns:prefix='...'- Specified by:
isAttributeNamespaceDeclaration
in interfaceXmlStartTag
-
getAttributeValueFromName
Return value of attribute named (uri, localName) or null of no such attribute found. (meaningful only if namespaces enabled)- Specified by:
getAttributeValueFromName
in interfaceXmlStartTag
-
getAttributeValueFromRawName
Return value of attribute named qName or null of no such attribute found.- Specified by:
getAttributeValueFromRawName
in interfaceXmlStartTag
-
addAttribute
parameters modeled after SAX2 attribute approach- Specified by:
addAttribute
in interfaceXmlStartTag
-
addAttribute
public void addAttribute(String namespaceUri, String localName, String rawName, String value, boolean isNamespaceDeclaration) Description copied from interface:XmlStartTag
Parameter isNamespaceDeclaration if true indicates that attribute is related to namespace management and may be ignored by normal processingNOTE: this class has no support for resolving namespaces and such support may be added later (see XmlNode and namespaces methids)
- Specified by:
addAttribute
in interfaceXmlStartTag
-
ensureAttributesCapacity
public void ensureAttributesCapacity(int minCapacity) Make sure that there is enough space to keep size attributes.- Specified by:
ensureAttributesCapacity
in interfaceXmlStartTag
-
removeAttributeByRawName
Description copied from interface:XmlStartTag
This method tries to remove attribute identified by raw name.- Specified by:
removeAttributeByRawName
in interfaceXmlStartTag
- Returns:
- true if attribute was removed or false otherwise.
-
removeAttributeByName
Description copied from interface:XmlStartTag
This method tries to remove attribute identified by namespace uti and local name.- Specified by:
removeAttributeByName
in interfaceXmlStartTag
- Returns:
- true if attribute was removed or false otherwise.
-
removeAttributes
public void removeAttributes()remove all atribute- Specified by:
removeAttributes
in interfaceXmlStartTag
-
printFields
Description copied from class:Tag
Print into StringBuffer element name- Overrides:
printFields
in classTag
-
toString
Return string representation of start tag including name and list of attributes. -
equals
-