org.gjt.xpp.impl.tag

Class StartTag

Implemented Interfaces:
XmlStartTag, XmlTag
Known Direct Subclasses:
Node

public class StartTag
extends Tag
implements XmlStartTag

Encapsulate XML STag and EmptyElement
Author:
Aleksander Slominski

Constructor Summary

StartTag()

Method Summary

void
addAttribute(String namespaceUri, String localName, String rawName, String value)
parameters modeled after SAX2 attribute approach
void
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 processing

NOTE: this class has no support for resolving namespaces and such support may be added later (see XmlNode and namespaces methids)

void
ensureAttributesCapacity(int minCapacity)
Make sure that there is enough space to keep size attributes.
boolean
equals(Object o)
int
getAttributeCount()
Return number of attributes.
String
getAttributeLocalName(int index)
Get localName of attribute number index (starts from 0) if namespaces enabled or just attribute name if namespaces disabled.
String
getAttributeNamespaceUri(int index)
Get uri of attribute number index (starts from 0).
String
getAttributePrefix(int index)
Returns the prefix of the specified attribute Returns null if invalid index or if element has no prefix.
String
getAttributeRawName(int index)
Return qName of atrribute number index (starts from 0)
String
getAttributeValue(int index)
Return value of attribute number index.
String
getAttributeValueFromName(String uri, String localName)
Return value of attribute named (uri, localName) or null of no such attribute found.
String
getAttributeValueFromRawName(String qName)
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 name
boolean
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
removeAttributes()
remove all atribute
void
resetStartTag()
Reinitialize start tag content to none
String
toString()
Return string representation of start tag including name and list of attributes.

Methods inherited from class org.gjt.xpp.impl.tag.Tag

equals, getLocalName, getNamespaceUri, getPrefix, getRawName, hashCode, modifyTag, printFields, resetTag

Constructor Details

StartTag

public StartTag()

Method Details

addAttribute

public void addAttribute(String namespaceUri,
                         String localName,
                         String rawName,
                         String value)
parameters modeled after SAX2 attribute approach
Specified by:
addAttribute in interface XmlStartTag

addAttribute

public void 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 processing

NOTE: this class has no support for resolving namespaces and such support may be added later (see XmlNode and namespaces methids)

Specified by:
addAttribute in interface XmlStartTag

ensureAttributesCapacity

public void ensureAttributesCapacity(int minCapacity)
Make sure that there is enough space to keep size attributes.
Specified by:
ensureAttributesCapacity in interface XmlStartTag

equals

public boolean equals(Object o)
Overrides:
equals in interface Tag

getAttributeCount

public int getAttributeCount()
Return number of attributes.
Specified by:
getAttributeCount in interface XmlStartTag

getAttributeLocalName

public 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:
getAttributeLocalName in interface XmlStartTag

getAttributeNamespaceUri

public String getAttributeNamespaceUri(int index)
Get uri of attribute number index (starts from 0). (meaningful only if namespaces enabled)
Specified by:
getAttributeNamespaceUri in interface XmlStartTag

getAttributePrefix

public String getAttributePrefix(int index)
Returns the prefix of the specified attribute Returns null if invalid index or if element has no prefix.
Specified by:
getAttributePrefix in interface XmlStartTag

getAttributeRawName

public String getAttributeRawName(int index)
Return qName of atrribute number index (starts from 0)
Specified by:
getAttributeRawName in interface XmlStartTag

getAttributeValue

public String getAttributeValue(int index)
Return value of attribute number index.
Specified by:
getAttributeValue in interface XmlStartTag

getAttributeValueFromName

public String getAttributeValueFromName(String uri,
                                        String localName)
Return value of attribute named (uri, localName) or null of no such attribute found. (meaningful only if namespaces enabled)
Specified by:
getAttributeValueFromName in interface XmlStartTag

getAttributeValueFromRawName

public String getAttributeValueFromRawName(String qName)
Return value of attribute named qName or null of no such attribute found.
Specified by:
getAttributeValueFromRawName in interface XmlStartTag

isAttributeNamespaceDeclaration

public boolean isAttributeNamespaceDeclaration(int index)
Return true if attribute at index is namespace declaration such as xmlns='...' or xmlns:prefix='...'
Specified by:
isAttributeNamespaceDeclaration in interface XmlStartTag

printFields

protected void printFields(StringBuffer buf)
Print into StringBuffer element name
Overrides:
printFields in interface Tag

removeAttributeByName

public boolean removeAttributeByName(String uri,
                                     String localName)
This method tries to remove attribute identified by namespace uti and local name.
Specified by:
removeAttributeByName in interface XmlStartTag
Returns:
true if attribute was removed or false otherwise.

removeAttributeByRawName

public boolean removeAttributeByRawName(String rawName)
This method tries to remove attribute identified by raw name.
Specified by:
removeAttributeByRawName in interface XmlStartTag
Returns:
true if attribute was removed or false otherwise.

removeAttributes

public void removeAttributes()
remove all atribute
Specified by:
removeAttributes in interface XmlStartTag

resetStartTag

public void resetStartTag()
Reinitialize start tag content to none
Specified by:
resetStartTag in interface XmlStartTag

toString

public String toString()
Return string representation of start tag including name and list of attributes.

Copyright (c) 2003 IU Extreme! Lab http://www.extreme.indiana.edu/ All Rights Reserved.

Note this package is deprecated by
XPP3 that implements XmlPull API