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
public class StartTag extends Tag implements XmlStartTag
Encapsulate XML STag and EmptyElement- Author:
- Aleksander Slominski
-
-
Constructor Summary
Constructors Constructor Description StartTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(java.lang.String namespaceUri, java.lang.String localName, java.lang.String rawName, java.lang.String value)parameters modeled after SAX2 attribute approachvoidaddAttribute(java.lang.String namespaceUri, java.lang.String localName, java.lang.String rawName, java.lang.String value, boolean isNamespaceDeclaration)Parameter isNamespaceDeclaration if true indicates that attribute is related to namespace management and may be ignored by normal processingvoidensureAttributesCapacity(int minCapacity)Make sure that there is enough space to keep size attributes.booleanequals(java.lang.Object o)intgetAttributeCount()Return number of attributes.java.lang.StringgetAttributeLocalName(int index)Get localName of attribute number index (starts from 0) if namespaces enabled or just attribute name if namespaces disabled.java.lang.StringgetAttributeNamespaceUri(int index)Get uri of attribute number index (starts from 0).java.lang.StringgetAttributePrefix(int index)Returns the prefix of the specified attribute Returns null if invalid index or if element has no prefix.java.lang.StringgetAttributeRawName(int index)Return qName of atrribute number index (starts from 0)java.lang.StringgetAttributeValue(int index)Return value of attribute number index.java.lang.StringgetAttributeValueFromName(java.lang.String uri, java.lang.String localName)Return value of attribute named (uri, localName) or null of no such attribute found.java.lang.StringgetAttributeValueFromRawName(java.lang.String qName)Return value of attribute named qName or null of no such attribute found.booleanisAttributeNamespaceDeclaration(int index)Return true if attribute at index is namespace declaration such as xmlns='...' or xmlns:prefix='...'protected voidprintFields(java.lang.StringBuffer buf)Print into StringBuffer element namebooleanremoveAttributeByName(java.lang.String uri, java.lang.String localName)This method tries to remove attribute identified by namespace uti and local name.booleanremoveAttributeByRawName(java.lang.String rawName)This method tries to remove attribute identified by raw name.voidremoveAttributes()remove all atributevoidresetStartTag()Reinitialize start tag content to nonejava.lang.StringtoString()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
-
-
-
-
Method Detail
-
resetStartTag
public void resetStartTag()
Reinitialize start tag content to none- Specified by:
resetStartTagin interfaceXmlStartTag
-
getAttributeCount
public int getAttributeCount()
Return number of attributes.- Specified by:
getAttributeCountin interfaceXmlStartTag
-
getAttributeNamespaceUri
public java.lang.String getAttributeNamespaceUri(int index)
Get uri of attribute number index (starts from 0). (meaningful only if namespaces enabled)- Specified by:
getAttributeNamespaceUriin interfaceXmlStartTag
-
getAttributeLocalName
public java.lang.String getAttributeLocalName(int index)
Get localName of attribute number index (starts from 0) if namespaces enabled or just attribute name if namespaces disabled.- Specified by:
getAttributeLocalNamein interfaceXmlStartTag
-
getAttributePrefix
public java.lang.String getAttributePrefix(int index)
Description copied from interface:XmlStartTagReturns the prefix of the specified attribute Returns null if invalid index or if element has no prefix.- Specified by:
getAttributePrefixin interfaceXmlStartTag
-
getAttributeRawName
public java.lang.String getAttributeRawName(int index)
Return qName of atrribute number index (starts from 0)- Specified by:
getAttributeRawNamein interfaceXmlStartTag
-
getAttributeValue
public java.lang.String getAttributeValue(int index)
Return value of attribute number index.- Specified by:
getAttributeValuein interfaceXmlStartTag
-
isAttributeNamespaceDeclaration
public boolean isAttributeNamespaceDeclaration(int index)
Description copied from interface:XmlStartTagReturn true if attribute at index is namespace declaration such as xmlns='...' or xmlns:prefix='...'- Specified by:
isAttributeNamespaceDeclarationin interfaceXmlStartTag
-
getAttributeValueFromName
public java.lang.String getAttributeValueFromName(java.lang.String uri, java.lang.String localName)Return value of attribute named (uri, localName) or null of no such attribute found. (meaningful only if namespaces enabled)- Specified by:
getAttributeValueFromNamein interfaceXmlStartTag
-
getAttributeValueFromRawName
public java.lang.String getAttributeValueFromRawName(java.lang.String qName)
Return value of attribute named qName or null of no such attribute found.- Specified by:
getAttributeValueFromRawNamein interfaceXmlStartTag
-
addAttribute
public void addAttribute(java.lang.String namespaceUri, java.lang.String localName, java.lang.String rawName, java.lang.String value)parameters modeled after SAX2 attribute approach- Specified by:
addAttributein interfaceXmlStartTag
-
addAttribute
public void addAttribute(java.lang.String namespaceUri, java.lang.String localName, java.lang.String rawName, java.lang.String value, boolean isNamespaceDeclaration)Description copied from interface:XmlStartTagParameter 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:
addAttributein interfaceXmlStartTag
-
ensureAttributesCapacity
public void ensureAttributesCapacity(int minCapacity)
Make sure that there is enough space to keep size attributes.- Specified by:
ensureAttributesCapacityin interfaceXmlStartTag
-
removeAttributeByRawName
public boolean removeAttributeByRawName(java.lang.String rawName)
Description copied from interface:XmlStartTagThis method tries to remove attribute identified by raw name.- Specified by:
removeAttributeByRawNamein interfaceXmlStartTag- Returns:
- true if attribute was removed or false otherwise.
-
removeAttributeByName
public boolean removeAttributeByName(java.lang.String uri, java.lang.String localName)Description copied from interface:XmlStartTagThis method tries to remove attribute identified by namespace uti and local name.- Specified by:
removeAttributeByNamein interfaceXmlStartTag- Returns:
- true if attribute was removed or false otherwise.
-
removeAttributes
public void removeAttributes()
remove all atribute- Specified by:
removeAttributesin interfaceXmlStartTag
-
printFields
protected void printFields(java.lang.StringBuffer buf)
Description copied from class:TagPrint into StringBuffer element name- Overrides:
printFieldsin classTag
-
toString
public java.lang.String toString()
Return string representation of start tag including name and list of attributes.- Overrides:
toStringin classjava.lang.Object
-
-