Package org.eigenbase.xom.wrappers
Class W3CDOMWrapper
java.lang.Object
org.eigenbase.xom.wrappers.W3CDOMWrapper
- All Implemented Interfaces:
DOMWrapper
This implementation of DOMWrapper wraps any w3c DOM-compliant java
XML Parser.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionW3CDOMWrapper(Node node, Locator locator) W3CDOMWrapper parses XML based on a Node. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String attrName) Return the attribute.String[]Returns a list of attribute names.Retrieve all children, and build an array of W3CDOMWrappers around each child that is of TEXT or ELEMENT type to return.Retrieve all children, and build an array of W3CDOMWrappers around each ELEMENT child.Returns the location of this element.Retrieve the tag name directly.getText()Recursively unwrap and create the contained text.intgetType()Map the Node's type to DOMWrapper's simplified concept of type.toXML()Returns this node serialized as XML.
-
Field Details
-
node
-
-
Constructor Details
-
W3CDOMWrapper
W3CDOMWrapper parses XML based on a Node. The Node may be either an Element or some form of text node.- Parameters:
node- DOM Nodelocator- Callback to find location of node. May be null.
-
-
Method Details
-
getType
public int getType()Map the Node's type to DOMWrapper's simplified concept of type.- Specified by:
getTypein interfaceDOMWrapper
-
getTagName
Retrieve the tag name directly. Return null immediately if not an element.- Specified by:
getTagNamein interfaceDOMWrapper
-
getAttribute
Return the attribute. Return null if the attribute isn't defined, or if not an element. This behavior differs from the underlying DOM, which returns an empty string for undefined attributes.- Specified by:
getAttributein interfaceDOMWrapper
-
getAttributeNames
Description copied from interface:DOMWrapperReturns a list of attribute names.- Specified by:
getAttributeNamesin interfaceDOMWrapper
-
getText
Recursively unwrap and create the contained text. If the node is a comment, return the comment text; but ignore comments inside elements.- Specified by:
getTextin interfaceDOMWrapper
-
toXML
Description copied from interface:DOMWrapperReturns this node serialized as XML.- Specified by:
toXMLin interfaceDOMWrapper
-
getChildren
Retrieve all children, and build an array of W3CDOMWrappers around each child that is of TEXT or ELEMENT type to return.- Specified by:
getChildrenin interfaceDOMWrapper
-
getElementChildren
Retrieve all children, and build an array of W3CDOMWrappers around each ELEMENT child.- Specified by:
getElementChildrenin interfaceDOMWrapper
-
getLocation
Description copied from interface:DOMWrapperReturns the location of this element.- Specified by:
getLocationin interfaceDOMWrapper
-