com.thaiopensource.pullax
Interface XmlItem

All Known Subinterfaces:
XmlAttributeItem, XmlContentItem

public interface XmlItem


Field Summary
static int ATTRIBUTE
          The item type for an attribute.
static int BUILTIN_ENTITY_REFERENCE
          The item type for a reference to one of the 5 builtin entities (<, >, &, ", ').
static int CDATA_SECTION
          The item type for a CDATA section.
static int CHARACTER_REFERENCE
          The item type for a character reference.
static int COMMENT
          The item type for a comment.
static int DOCUMENT_TYPE
          The item type for a document type declaration.
static int EMPTY_ELEMENT
          The item type for an empty element.
static int END_ELEMENT
          The item type for the end of an element.
static int END_ENTITY
          The item type for the end of the replacement of a general entity.
static int PROCESSING_INSTRUCTION
          The item type for a processing instruction.
static int START_ELEMENT
          The item type for the start of an element.
static int START_ENTITY
          The item type for the start of the replacement of a general entity.
static int TEXT
          The item type for characters of data.
static int TOP_LEVEL_WHITESPACE
          The item type for a top-level whitespace.
static int UNEXPANDED_ENTITY_REFERENCE
          The item type for an unexpanded entity reference.
 
Method Summary
 XmlContext getContext()
          Returns the context of this item.
 int getItemType()
          Returns the type of this item.
 java.lang.String getLocalName()
          Returns the local name of this item, or null if the item does not gave a name.
 XmlLocation getLocation()
          Returns the location of the first character of the item.
 java.lang.String getName()
          Returns the name of the this item, or null if the item does not have a name.
 java.lang.String getNamespaceUri()
          Returns the namespace URI of this item, or null if the item does not have a namespaced URI.
 java.lang.String getPrefix()
          Returns the prefix of this item, or null if the item does not have a prefix.
 java.lang.String getValue()
          Returns the value of this item or null if the item does not have a value.
 

Field Detail

START_ELEMENT

public static final int START_ELEMENT
The item type for the start of an element.
See Also:
getItemType()

END_ELEMENT

public static final int END_ELEMENT
The item type for the end of an element.
See Also:
getItemType()

TEXT

public static final int TEXT
The item type for characters of data.
See Also:
getItemType()

ATTRIBUTE

public static final int ATTRIBUTE
The item type for an attribute. Attributes that serve as namespace declarations are reported as attributes.
See Also:
getItemType()

EMPTY_ELEMENT

public static final int EMPTY_ELEMENT
The item type for an empty element. An empty element is returned as an EMPTY_ELEMENT only if the SHOW_EMPTY_ELEMENT feature is present. Otherwise, an empty element will be returned as a START_ELEMENT, END_ELEMENT pair; the closing > will be treated as belonging to the END_ELEMENT and all the other characters will be treated as belonging to the START_ELEMENT.
See Also:
getItemType()

CDATA_SECTION

public static final int CDATA_SECTION
The item type for a CDATA section. A CDATA section is returned as a CDATA_SECTION only if the SHOW_CDATA_SECTION feature is present. Otherwise, the characters from the CDATA section will be included in a TEXT.
See Also:
getItemType()

PROCESSING_INSTRUCTION

public static final int PROCESSING_INSTRUCTION
The item type for a processing instruction. A processing instruction is returned as a PROCESSING_INSTRUCTION only if the SHOW_PROCESSING_INSTRUCTION feature is present. Otherwise, processing instructions are skipped.
See Also:
getItemType()

COMMENT

public static final int COMMENT
The item type for a comment. A comment is returned as a COMMENT only if the SHOW_COMMENT feature is present. Otherwise, comments are skipped.
See Also:
getItemType()

START_ENTITY

public static final int START_ENTITY
The item type for the start of the replacement of a general entity. The context for a START_ENTITY entity is the context of the start of the replacement text rather that the context of the start of the reference. The context must reflect the XML or text declaration at the beginning of the entity if the entity is the document entity or an external entity and the entity has an XML or text declaration. The name of the entity will be null if the entity is the document entity.
See Also:
getItemType()

END_ENTITY

public static final int END_ENTITY
The item type for the end of the replacement of a general entity. Context is same as context for corresponding START_ENTITY item.
See Also:
getItemType()

UNEXPANDED_ENTITY_REFERENCE

public static final int UNEXPANDED_ENTITY_REFERENCE
The item type for an unexpanded entity reference. A reference to a builtin entity is returned as a UNEXPANDED_ENTITY_REFERENCE only if the SHOW_UNEXPANDED_ENTITY_REFERENCE feature is present. Otherwise, Otherwise, unexpanded entity references are skipped.
See Also:
getItemType()

BUILTIN_ENTITY_REFERENCE

public static final int BUILTIN_ENTITY_REFERENCE
The item type for a reference to one of the 5 builtin entities (<, >, &, ", '). A reference to a builtin entity is returned as a BUILTIN_ENTITY_REFERENCE only if the SHOW_BUILTIN_ENTITY_REFERENCE feature is present. Otherwise, the referenced character will be included in a TEXT. The value is the referenced character. The name is the sequence of characters between the & and the ; (exclusive).
See Also:
getItemType()

CHARACTER_REFERENCE

public static final int CHARACTER_REFERENCE
The item type for a character reference. This includes both decimal and hex numeric character references but not references to builtin or other entities. A character reference is returned as a CHARACTER_REFERENCE only if the SHOW_CHARACTER_REFERENCE feature is present. Otherwise, the referenced character will be included in a TEXT. The value of a CHARACTER_REFERENCE is the referenced character (which will be represented by two Java chars if the the character code is greater than 0xFFFF, and otherwise by one Java char). The name of the character reference is the sequence of characters between the &# and the ; (exclusive).
See Also:
getItemType()

DOCUMENT_TYPE

public static final int DOCUMENT_TYPE
The item type for a document type declaration. A document type declaration is returned as a DOCUMENT_TYPE only if the SHOW_DOCUMENT_TYPE feature is present. Otherwise, no item will be returned for the document type declaration and its contents.
See Also:
getItemType()

TOP_LEVEL_WHITESPACE

public static final int TOP_LEVEL_WHITESPACE
The item type for a top-level whitespace. Top-level whitespace is whitespace that matches the Misc production of the XML Recommendation, that is, whitespace before or after the document element that is not contained within any processing instruction, comment, document type declaration or XML declaration. Top-level whitespace is returned as a TOP_LEVEL_WHITESPACE only if the SHOW_TOP_LEVEL_WHITESPACE feature is present. Otherwise, no item will be returned for top-level whitespace. The value is the string of whitespace characters. It is implementation dependendent how top-level whitespace is chunked into TOP_LEVEL_WHITESPACE items.
See Also:
getItemType()
Method Detail

getItemType

public int getItemType()
Returns the type of this item.
Returns:
the item type of this item
See Also:
START_ELEMENT, END_ELEMENT, TEXT, ATTRIBUTE, EMPTY_ELEMENT, CDATA_SECTION, PROCESSING_INSTRUCTION, COMMENT, START_ENTITY, END_ENTITY, UNEXPANDED_ENTITY_REFERENCE, BUILTIN_ENTITY_REFERENCE, CHARACTER_REFERENCE, DOCUMENT_TYPE, TOP_LEVEL_WHITESPACE

getName

public java.lang.String getName()
Returns the name of the this item, or null if the item does not have a name. An item has a name if and only if its item type is one of ATTRIBUTE, START_ELEMENT, END_ELEMENT, EMPTY_ELEMENT, DOCUMENT_TYPE, PROCESSING_INSTRUCTION, START_ENTITY, END_ENTITY, BUILTIN_ENTITY_REFERENCE, UNEXPANDED_ENTITY_REFERENCE or CHARACTER_REFERENCE.
Returns:
a String containing the name of the this item or null if the item does not have a name

getLocalName

public java.lang.String getLocalName()
Returns the local name of this item, or null if the item does not gave a name. The local name is the part of the name following the colon. If the name does not contain a colon, then the local name is the same as the name. An item has a name if and only if its item type is one of ATTRIBUTE, START_ELEMENT, END_ELEMENT, EMPTY_ELEMENT, DOCUMENT_TYPE, PROCESSING_INSTRUCTION, START_ENTITY, END_ENTITY, BUILTIN_ENTITY_REFERENCE, UNEXPANDED_ENTITY_REFERENCE or CHARACTER_REFERENCE.
Returns:
a String containing the local name of this item or null if the item does not have a name

getPrefix

public java.lang.String getPrefix()
Returns the prefix of this item, or null if the item does not have a prefix. The prefix is the part of the name preceding the colon. If the name does not contain a colon, then the prefix is null. An item can have a non-null prefix only if its type is one of ATTRIBUTE, START_ELEMENT, END_ELEMENT, EMPTY_ELEMENT, DOCUMENT_TYPE.
Returns:
a String containing the prefix of the this item or null if the item does not have a prefix

getNamespaceUri

public java.lang.String getNamespaceUri()
Returns the namespace URI of this item, or null if the item does not have a namespaced URI. The namespace URI of an item whose prefix is xml is http://www.w3.org/XML/1998/namespace. The namespace URI of an attribute that is serving as a namespace declaration is http://www.w3.org/2000/xmlns/. An item can have a non-null namespace URI only if its type is one of ATTRIBUTE, START_ELEMENT, END_ELEMENT or EMPTY_ELEMENT.
Returns:
a String containing the namespace URI of this item or null if the item does not have a namespace URI
See Also:
XmlNamespaces.XML, XmlNamespaces.XMLNS

getValue

public java.lang.String getValue()
                          throws java.io.IOException
Returns the value of this item or null if the item does not have a value. An item has a non-null value if and only if its item type is one of ATTRIBUTE, TEXT, PROCESSING_INSTRUCTION, COMMENT, BUILTIN_ENTITY_REFERENCE, UNEXPANDED_ENTITY_REFERENCE, CHARACTER_REFERENCE or TOP_LEVEL_WHITESPACE.
Returns:
a String containing the value of the this item
Throws:
java.io.IOException - if an I/O error occurs

getLocation

public XmlLocation getLocation()
Returns the location of the first character of the item.

getContext

public XmlContext getContext()
Returns the context of this item.