Qizx fe-4.4p2 API

com.qizx.api.util
Class DOMToPushStream

java.lang.Object
  extended by com.qizx.api.util.DOMToPushStream

public final class DOMToPushStream
extends Object

Pushes a DOM document or an element to an XMLPushStream handler. This can be used typically to import a DOM document into an XML Library (see Library.beginImportDocument(java.lang.String)), or even to serialize a DOM document using a XMLSerializer as output.


Constructor Summary
DOMToPushStream(ItemFactory itemFactory, XMLPushStream output)
          Builds an adapter from DOM to an implementation of XMLPushStream.
 
Method Summary
static Node convertNode(Node node)
          Utility for conversion of DOM to Data Model nodes
 XMLPushStream getOutput()
          Returns the current output handler.
 void putDocument(Document document)
          Pushes a complete document to the output stream.
 void putElement(Element element)
          Pushes an element and all its descendant nodes to the output stream.
 void setOutput(XMLPushStream output)
          Redefines the current output handler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMToPushStream

public DOMToPushStream(ItemFactory itemFactory,
                       XMLPushStream output)
Builds an adapter from DOM to an implementation of XMLPushStream.

Parameters:
itemFactory - used to create QNames
output - an implementation of XMLPushStream
Method Detail

getOutput

public XMLPushStream getOutput()
Returns the current output handler.

Returns:
the XMLPushStream defined by the constructor or by setOutput.

setOutput

public void setOutput(XMLPushStream output)
Redefines the current output handler.

Parameters:
output - an implementation of XMLPushStream

putDocument

public void putDocument(Document document)
                 throws DataModelException
Pushes a complete document to the output stream.

Parameters:
document - input document to convert
Throws:
DataModelException - if thrown by the output handler

convertNode

public static Node convertNode(Node node)
                        throws DataModelException
Utility for conversion of DOM to Data Model nodes

Parameters:
node - any DOM node
Returns:
a Node of the Data Model
Throws:
DataModelException

putElement

public void putElement(Element element)
                throws DataModelException
Pushes an element and all its descendant nodes to the output stream.

Parameters:
element - a DOM element to convert
Throws:
DataModelException

© 2010 Axyana Software