Package org.eigenbase.xom
Interface DOMWrapper
- All Known Implementing Classes:
W3CDOMWrapper
public interface DOMWrapper
DOMWrapper implements a Wrapper around the Element class from any DOM-style
XML parser. The wrapper is used to isolate ElementParser, ElementDef, and
all ElementDef subclasses from the specifics of the underlying XML
parser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
CDATA is a type of DOM Element representing a piece of text embedded in a CDATA section, for example,<![CDATA[Some text]]>
.static final int
COMMENT is a type of DOM Element representing an XML comment.static final int
ELEMENT is a type of DOM Element representing a named tag, possibly containing attributes, child elements, and text.static final int
FREETEXT is a type of DOM Element representing a piece of text (but not a CDATA section).static final int
UNKNOWN is used for DOM Element types unsupported by the wrapper. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String attrName) Returns the value of the attribute with the given attrName.String[]
Returns a list of attribute names.Returns all children of this element, including TEXT elements, as an array of DOMWrappers.Returns all element children of this element as an array of DOMWrappers.Returns the location of this element.Returns the tag name of this element, or null for TEXT elements.getText()
Returns a flattened representation of the text inside thie element.int
getType()
Returns the type of this element/node.toXML()
Returns this node serialized as XML.
-
Field Details
-
UNKNOWN
static final int UNKNOWNUNKNOWN is used for DOM Element types unsupported by the wrapper.- See Also:
-
FREETEXT
static final int FREETEXTFREETEXT is a type of DOM Element representing a piece of text (but not a CDATA section). For example,Some text
. FREETEXT elements always have a tag name of NULL and have no children. It maps to aTextDef
.- See Also:
-
ELEMENT
static final int ELEMENTELEMENT is a type of DOM Element representing a named tag, possibly containing attributes, child elements, and text. It maps to aElementDef
(or a generated class derived from it), or aGenericDef
.- See Also:
-
COMMENT
static final int COMMENTCOMMENT is a type of DOM Element representing an XML comment. It maps to aCommentDef
.- See Also:
-
CDATA
static final int CDATACDATA is a type of DOM Element representing a piece of text embedded in a CDATA section, for example,<![CDATA[Some text]]>
. CDATA elements always have a tag name of NULL and have no children. It maps to aCdataDef
.- See Also:
-
-
Method Details
-
getType
int getType() -
getTagName
String getTagName()Returns the tag name of this element, or null for TEXT elements. -
getAttribute
Returns the value of the attribute with the given attrName. If the attribute is not defined, this method returns null. -
getAttributeNames
String[] getAttributeNames()Returns a list of attribute names. -
getText
String getText()Returns a flattened representation of the text inside thie element. For a TEXT element, this returns the text itself. For an ELEMENT element, this returns all pieces of text within the element, with all markup removed. -
toXML
String toXML()Returns this node serialized as XML. -
getChildren
DOMWrapper[] getChildren()Returns all children of this element, including TEXT elements, as an array of DOMWrappers. -
getElementChildren
DOMWrapper[] getElementChildren()Returns all element children of this element as an array of DOMWrappers. -
getLocation
Location getLocation()Returns the location of this element.
-