tribble.xml
Interface XmlItemI
- All Known Subinterfaces:
- XmlAttributeI, XmlCommentI, XmlDirectiveI, XmlElementI, XmlTextI
- public interface XmlItemI
XML item.
All XML elements, nodes, attributes, text contents, etc., implement this
interface.
There are five types of XML items:
- Attribute
-
This is name/value pair within a tagged element or directive.
The value part is optional.
For example:
sku='JR-243(H)' delivery-required
- Comment
-
This is one or more lines of comment text, which do not affect the content
or meaning of the document.
Comments may appear anywhere a tagged element can appear.
For example:
<!-- Customer record updated 2003-06-17 12:56:24 -->
- Directive
-
This is an out-of-band directive, which may contain attributes.
For example:
<?xml version='1.0'?>
- Element
-
This is a tagged node, which may contain attributes, content text, and
other (nested) tagged elements.
For example:
<item sku='JR-243(H)'>Business desk, oak finish</item>
- Text
-
This is content text of a tagged element.
Elements are not required to have content text.
Content text can have leading and trailing whitespace characters, and
may contain multiple newlines.
For example:
<item>Business desk, oak finish</item>
- Since:
- 2003-04-13
- Version:
- $Revision: 1.4 $ $Date: 2003/07/17 01:11:29 $
- Author:
- David R. Tribble
(david@tribble.com).
Copyright ©2003 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code
provided that the original copyright and authorship notices remain
intact.
Field Summary |
static java.lang.String |
REV
Revision information. |
static java.lang.String |
TYPE_ATTRIBUTE
Item type: Attribute. |
static java.lang.String |
TYPE_COMMENT
Item type: Comment. |
static java.lang.String |
TYPE_DIRECTIVE
Item type: Directive element. |
static java.lang.String |
TYPE_ELEMENT
Item type: Element (tagged node). |
static java.lang.String |
TYPE_TEXT
Item type: Text content. |
static java.lang.String |
TYPE_UNKNOWN
Item type: Unknown. |
REV
public static final java.lang.String REV
- Revision information.
- See Also:
- Constant Field Values
TYPE_UNKNOWN
public static final java.lang.String TYPE_UNKNOWN
- Item type: Unknown.
- See Also:
- Constant Field Values
TYPE_ATTRIBUTE
public static final java.lang.String TYPE_ATTRIBUTE
- Item type: Attribute.
- See Also:
- Constant Field Values
TYPE_COMMENT
public static final java.lang.String TYPE_COMMENT
- Item type: Comment.
- See Also:
- Constant Field Values
TYPE_DIRECTIVE
public static final java.lang.String TYPE_DIRECTIVE
- Item type: Directive element.
- See Also:
- Constant Field Values
TYPE_ELEMENT
public static final java.lang.String TYPE_ELEMENT
- Item type: Element (tagged node).
- See Also:
- Constant Field Values
TYPE_TEXT
public static final java.lang.String TYPE_TEXT
- Item type: Text content.
- See Also:
- Constant Field Values
getType
public java.lang.String getType()
- Retrieve the type of this XML item.
- Returns:
- Type of this item, which is one of the
TYPE_XXX constants.
- Since:
- 1.1, 2003-04-13
getLineNumber
public int getLineNumber()
- Retrieve the source line number of this XML item.
- Returns:
- Line number of the XML input source stream from which this item was
read (starting at 1), or zero if the line number is not available.
- Since:
- 1.1, 2003-04-13
getColumnNumber
public int getColumnNumber()
- Retrieve the source column number of this XML item.
- Returns:
- Column number of the XML input source stream from which this item was
read (starting at 1), or zero if the source column number is not
available.
- Since:
- 1.1, 2003-04-13
getParentElement
public XmlElementI getParentElement()
- Retrieve the parent element of this XML item.
Parsers are not required to implement this method.
If this method is not implemented, it must throw a
java.lang.UnsupportedOperationException.
- Returns:
- The XML element that contains this XML item.
Note that the top-most element has no parent (i.e., its parent is null).
- Throws:
java.lang.UnsupportedOperationException
- (unchecked)
Thrown if this method is not implemented.- Since:
- 1.4, 2003-07-06