org.codehaus.xfire.util
Class STAXUtils

java.lang.Object
  extended by org.codehaus.xfire.util.STAXUtils

public class STAXUtils
extends java.lang.Object

Common StAX utilities.

Since:
Oct 26, 2004
Author:
Dan Diephouse

Constructor Summary
STAXUtils()
           
 
Method Summary
static void copy(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer)
          Copies the reader to the writer.
static void readElements(org.w3c.dom.Element root, javax.xml.stream.XMLStreamReader reader)
           
static void writeElement(org.w3c.dom.Element e, javax.xml.stream.XMLStreamWriter writer)
          Writes an Element to an XMLStreamWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

STAXUtils

public STAXUtils()
Method Detail

copy

public static void copy(javax.xml.stream.XMLStreamReader reader,
                        javax.xml.stream.XMLStreamWriter writer)
                 throws javax.xml.stream.XMLStreamException
Copies the reader to the writer. The start and end document methods must be handled on the writer manually. TODO: if the namespace on the reader has been declared previously to where we are in the stream, this probably won't work.

Parameters:
reader -
writer -
Throws:
javax.xml.stream.XMLStreamException

writeElement

public static void writeElement(org.w3c.dom.Element e,
                                javax.xml.stream.XMLStreamWriter writer)
                         throws javax.xml.stream.XMLStreamException
Writes an Element to an XMLStreamWriter. The writer must already have started the doucment (via writeStartDocument()). Also, this probably won't work with just a fragment of a document. The Element should be the root element of the document.

Parameters:
e -
writer -
Throws:
javax.xml.stream.XMLStreamException

readElements

public static void readElements(org.w3c.dom.Element root,
                                javax.xml.stream.XMLStreamReader reader)
                         throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException