org.codehaus.xfire.util
Class STAXStreamReader

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

public class STAXStreamReader
extends java.lang.Object

Reads a DOM4J Document, as well as other Nodes, from a StAX XMLStreamReader.

Author:
Dan Diephouse, Christian Niles

Constructor Summary
STAXStreamReader()
          Constructs a default STAXEventReader instance with a default DocumentFactory.
STAXStreamReader(org.dom4j.DocumentFactory factory)
          Constructs a STAXStreamReader instance that uses the specified DocumentFactoryto construct DOM4J Nodes.
 
Method Summary
 org.dom4j.Element createElement(javax.xml.stream.XMLStreamReader reader)
           
 org.dom4j.Document readDocument(java.io.InputStream is)
          Constructs a StAX event stream from the provided I/O stream and reads a DOM4J document from it.
 org.dom4j.Document readDocument(java.io.InputStream is, java.lang.String systemId)
           
 org.dom4j.Document readDocument(java.io.Reader reader)
          Constructs a StAX event stream from the provided I/O character stream and reads a DOM4J document from it.
 org.dom4j.Document readDocument(java.io.Reader reader, java.lang.String systemId)
          Constructs a StAX event stream from the provided I/O character stream and reads a DOM4J document from it.
 org.dom4j.Document readDocument(javax.xml.stream.XMLStreamReader reader)
          Reads a DOM4J Documentfrom the provided stream.
 org.dom4j.Element readElement(javax.xml.stream.XMLStreamReader reader)
           
 org.dom4j.Entity readEntityReference(javax.xml.stream.XMLStreamReader reader)
           
 void readNode(javax.xml.stream.XMLStreamReader reader, org.dom4j.Branch node)
           
 org.dom4j.ProcessingInstruction readProcessingInstruction(javax.xml.stream.XMLStreamReader reader)
          Constructs a DOM4J ProcessingInstruction from the provided event stream.
 void setDocumentFactory(org.dom4j.DocumentFactory factory)
          Sets the DocumentFactory to be used when constructing DOM4J nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

STAXStreamReader

public STAXStreamReader()
Constructs a default STAXEventReader instance with a default DocumentFactory.


STAXStreamReader

public STAXStreamReader(org.dom4j.DocumentFactory factory)
Constructs a STAXStreamReader instance that uses the specified DocumentFactoryto construct DOM4J Nodes.

Parameters:
factory - The DocumentFactory to use when constructing DOM4J nodes, or null if a default should be used.
Method Detail

setDocumentFactory

public void setDocumentFactory(org.dom4j.DocumentFactory factory)
Sets the DocumentFactory to be used when constructing DOM4J nodes.

Parameters:
factory - The DocumentFactory to use when constructing DOM4J nodes, or null if a default should be used.

readDocument

public org.dom4j.Document readDocument(java.io.InputStream is)
                                throws javax.xml.stream.XMLStreamException
Constructs a StAX event stream from the provided I/O stream and reads a DOM4J document from it.

Parameters:
is - The I/O stream from which the Document will be read.
Returns:
The Document that was read from the stream.
Throws:
javax.xml.stream.XMLStreamException - If an error occurs reading content from the stream.

readDocument

public org.dom4j.Document readDocument(java.io.Reader reader)
                                throws javax.xml.stream.XMLStreamException
Constructs a StAX event stream from the provided I/O character stream and reads a DOM4J document from it.

Parameters:
reader - The character stream from which the Document will be read.
Returns:
The Document that was read from the stream.
Throws:
javax.xml.stream.XMLStreamException - If an error occurs reading content from the stream.

readDocument

public org.dom4j.Document readDocument(java.io.InputStream is,
                                       java.lang.String systemId)
                                throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readDocument

public org.dom4j.Document readDocument(java.io.Reader reader,
                                       java.lang.String systemId)
                                throws javax.xml.stream.XMLStreamException
Constructs a StAX event stream from the provided I/O character stream and reads a DOM4J document from it.

Parameters:
reader - The character stream from which the Document will be read.
systemId - A system id used to resolve entities.
Returns:
The Document that was read from the stream.
Throws:
javax.xml.stream.XMLStreamException - If an error occurs reading content from the stream.

readNode

public void readNode(javax.xml.stream.XMLStreamReader reader,
                     org.dom4j.Branch node)
              throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readDocument

public org.dom4j.Document readDocument(javax.xml.stream.XMLStreamReader reader)
                                throws javax.xml.stream.XMLStreamException
Reads a DOM4J Documentfrom the provided stream. The stream should be positioned at the start of a document, or before a StartElementevent.

Parameters:
reader - The event stream from which to read the Document.
Returns:
The Documentthat was read from the stream.
Throws:
javax.xml.stream.XMLStreamException - If an error occurs reading events from the stream.

readElement

public org.dom4j.Element readElement(javax.xml.stream.XMLStreamReader reader)
                              throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readEntityReference

public org.dom4j.Entity readEntityReference(javax.xml.stream.XMLStreamReader reader)
                                     throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readProcessingInstruction

public org.dom4j.ProcessingInstruction readProcessingInstruction(javax.xml.stream.XMLStreamReader reader)
                                                          throws javax.xml.stream.XMLStreamException
Constructs a DOM4J ProcessingInstruction from the provided event stream. The stream must be positioned before a ProcessingInstruction event.

Parameters:
reader - The event stream from which to read the ProcessingInstruction.
Returns:
The ProcessingInstruction that was read from the stream.
Throws:
javax.xml.stream.XMLStreamException - If an error occured reading events from the stream, or the stream was not positioned before a ProcessingInstructionevent.

createElement

public org.dom4j.Element createElement(javax.xml.stream.XMLStreamReader reader)


Copyright © 2004 Codehaus. All Rights Reserved.