Devsphere.com


com.devsphere.examples.xml.saxdomix
Class DOMOutputter

java.lang.Object
  |
  +--com.devsphere.examples.xml.saxdomix.OutputterBase
        |
        +--com.devsphere.examples.xml.saxdomix.DOMOutputter
All Implemented Interfaces:
SDXController

public class DOMOutputter
extends OutputterBase
implements SDXController

This class outputs DOM sub-trees and implements SDXController. It is used by MixedParsing.

See Also:
OutputterBase, MixedParsing

Field Summary
protected  java.util.Vector elements
          The names of the elements that will be the roots of the DOM sub-trees
 
Fields inherited from class com.devsphere.examples.xml.saxdomix.OutputterBase
DEFAULT_MAX_DATA_LENGTH, level, maxDataLength
 
Constructor Summary
DOMOutputter(java.util.Vector elements)
          Creates a new outputter and takes as parameter a vector containing the element names for which wantDOM() will return true.
 
Method Summary
 void handleDOM(org.w3c.dom.Element element)
          Outputs the constructed DOM sub-tree
 void output(org.w3c.dom.Node node)
          Outputs a DOM node and is called recursively for all children
 boolean wantDOM(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes)
          Returns true when the application wants to receive a DOM sub-tree for handling, that is the elements vector contains the qualified name of the current element
 
Methods inherited from class com.devsphere.examples.xml.saxdomix.OutputterBase
blankLine, decLevel, getLevel, getMaxDataLength, incLevel, output, output, setLevel, setMaxDataLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

protected java.util.Vector elements
The names of the elements that will be the roots of the DOM sub-trees

Constructor Detail

DOMOutputter

public DOMOutputter(java.util.Vector elements)
Creates a new outputter and takes as parameter a vector containing the element names for which wantDOM() will return true.

Method Detail

wantDOM

public boolean wantDOM(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qualifiedName,
                       org.xml.sax.Attributes attributes)
                throws org.xml.sax.SAXException
Returns true when the application wants to receive a DOM sub-tree for handling, that is the elements vector contains the qualified name of the current element

Specified by:
wantDOM in interface SDXController
Parameters:
namespaceURI - The element's namespace URI
localName - The element's local name
qualifiedName - The element's qualified name
attributes - The element's attributes
Returns:
A boolean value indicating whether the builder must enter in DOM parsing mode or must remain in SAX parsing mode
Throws:
org.xml.sax.SAXException - If an error must be signaled

handleDOM

public void handleDOM(org.w3c.dom.Element element)
               throws org.xml.sax.SAXException
Outputs the constructed DOM sub-tree

Specified by:
handleDOM in interface SDXController
Parameters:
element - The root of the DOM sub-tree
Throws:
org.xml.sax.SAXException - If an error must be signaled

output

public void output(org.w3c.dom.Node node)
Outputs a DOM node and is called recursively for all children


 Devsphere.com