org.apache.cocoon.sax.util
Class XMLUtils

java.lang.Object
  extended by org.apache.cocoon.sax.util.XMLUtils

public abstract class XMLUtils
extends Object

Utilities for the usage of an XMLReader together with a SAXConsumer.


Field Summary
static Attributes EMPTY_ATTRIBUTES
          Empty attributes immutable object.
 
Constructor Summary
XMLUtils()
           
 
Method Summary
static XMLReader createXMLReader(ContentHandler contentHandler)
           
static void toOutputStream(OutputStream outputStream, org.apache.cocoon.xml.sax.SAXBuffer saxBuffer)
          Serialize the content of a SAXBuffer into an OutputStream.
static void toSax(InputStream inputStream, ContentHandler contentHandler)
          Use a SAX parser and read the content of an InputStream into an SAXConsumer.
static void toSax(String string, ContentHandler contentHandler)
          Use a SAX parser and read the content of an InputStream into an SAXConsumer.
static void toSax(URLConnection urlConnection, ContentHandler contentHandler)
          Stream a URLConnection into an SAXConsumer by using toSax(InputStream, ContentHandler).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ATTRIBUTES

public static final Attributes EMPTY_ATTRIBUTES
Empty attributes immutable object.

Constructor Detail

XMLUtils

public XMLUtils()
Method Detail

toOutputStream

public static void toOutputStream(OutputStream outputStream,
                                  org.apache.cocoon.xml.sax.SAXBuffer saxBuffer)
Serialize the content of a SAXBuffer into an OutputStream.

Parameters:
outputStream - OutputStream to use.
saxBuffer - A SaxBuffer containing the SAX events.

toSax

public static void toSax(InputStream inputStream,
                         ContentHandler contentHandler)
                  throws IOException,
                         SAXException
Use a SAX parser and read the content of an InputStream into an SAXConsumer.

Parameters:
inputStream - InputStream containing the content to be parsed.
contentHandler - The ContentHandler to use.
Throws:
IOException - if the InputStream can't be used.
SAXException - if the InputStream can't be parsed.

toSax

public static void toSax(String string,
                         ContentHandler contentHandler)
                  throws IOException,
                         SAXException
Use a SAX parser and read the content of an InputStream into an SAXConsumer.

Parameters:
string - A String to be parsed.
contentHandler - The ContentHandler to use.
Throws:
IOException - if the InputStream can't be used.
SAXException - if the InputStream can't be parsed.

toSax

public static void toSax(URLConnection urlConnection,
                         ContentHandler contentHandler)
Stream a URLConnection into an SAXConsumer by using toSax(InputStream, ContentHandler). The URLConnection is closed after streaming.

Parameters:
urlConnection - The URLConnection to be streamed.
contentHandler - An ContentHandler as target.

createXMLReader

public static XMLReader createXMLReader(ContentHandler contentHandler)


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.