org.apache.jetspeed.util
Class SAXPIFilter

java.lang.Object
  extended byorg.xml.sax.HandlerBase
      extended byorg.apache.jetspeed.util.SAXPIFilter
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SAXPIFilter
extends org.xml.sax.HandlerBase

This class is used to either strip and/or insert PIs in a XML document. It uses SAX-1 API and outputs text to an output stream. WARNING: This behavior will be modified in the future.

Version:
$Id: SAXPIFilter.java,v 1.9 2005/03/21 18:21:44 sgala Exp $
Author:
Raphaël Luta

Field Summary
protected  java.io.PrintWriter out
           
 
Constructor Summary
SAXPIFilter(java.io.PrintWriter outPW)
          Creates of simple parser which outputs its document to the PrintWriter passed as arguments.
SAXPIFilter(java.io.PrintWriter outPW, boolean strip)
          In this mode the parser may be used as a simple well-formedness checker or a PI stripper.
SAXPIFilter(java.io.PrintWriter outPW, boolean strip, java.lang.String PI)
          In this mode the parser can strip existing PIs and insert new ones just after the document declaration
 
Method Summary
 void addProcessingInstruction(java.lang.String pi)
           
 void characters(char[] ch, int start, int length)
          SAX Handler implementation
 void endDocument()
          SAX Handler implementation
 void endElement(java.lang.String name)
          SAX Handler implementation
 void error(org.xml.sax.SAXParseException ex)
          SAX Handler implementation
 void fatalError(org.xml.sax.SAXParseException ex)
          SAX Handler implementation
 java.lang.String[] getProcessingInstructions()
          Get all permitted processing instructions
 void ignorableWhitespace(char[] ch, int start, int length)
          SAX Handler implementation
protected  java.lang.String normalize(java.lang.String s)
          Escapes characters data
 void print(java.io.InputStream in)
          Parse and output the content of the stream
 void print(java.io.Reader in)
          Parse and output the content of the reader
 void print(java.lang.String uri)
          Parse and output the content of the URL given as parameter.
 void processingInstruction(java.lang.String target, java.lang.String data)
          SAX Handler implementation
 void startDocument()
          SAX Handler implementation
 void startElement(java.lang.String name, org.xml.sax.AttributeList attrs)
          SAX Handler implementation
 void warning(org.xml.sax.SAXParseException ex)
          SAX Handler implementation
 
Methods inherited from class org.xml.sax.HandlerBase
notationDecl, resolveEntity, setDocumentLocator, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected java.io.PrintWriter out
Constructor Detail

SAXPIFilter

public SAXPIFilter(java.io.PrintWriter outPW)
            throws java.io.UnsupportedEncodingException
Creates of simple parser which outputs its document to the PrintWriter passed as arguments. In this mode the parser may be used as a simple well-formedness checker.

Parameters:
outPW - the printWriter where to output parsed data

SAXPIFilter

public SAXPIFilter(java.io.PrintWriter outPW,
                   boolean strip)
            throws java.io.UnsupportedEncodingException
In this mode the parser may be used as a simple well-formedness checker or a PI stripper.

Parameters:
outPW - the printWriter where to output parsed data
strip - configure the parser to strip PIs if strip is true

SAXPIFilter

public SAXPIFilter(java.io.PrintWriter outPW,
                   boolean strip,
                   java.lang.String PI)
            throws java.io.UnsupportedEncodingException
In this mode the parser can strip existing PIs and insert new ones just after the document declaration

Parameters:
outPW - the printWriter where to output parsed data
strip - configure the parser to strip PIs if strip is true
PI - string reprensenting the PI to be output after the document declaration
Method Detail

getProcessingInstructions

public java.lang.String[] getProcessingInstructions()
Get all permitted processing instructions


addProcessingInstruction

public void addProcessingInstruction(java.lang.String pi)

print

public void print(java.lang.String uri)
Parse and output the content of the URL given as parameter.

Parameters:
uri - URL where to fetch the document to be parsed

print

public void print(java.io.InputStream in)
Parse and output the content of the stream

Parameters:
in - a content InputStream

print

public void print(java.io.Reader in)
Parse and output the content of the reader

Parameters:
in - a content Reader

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
SAX Handler implementation


startDocument

public void startDocument()
SAX Handler implementation


startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList attrs)
SAX Handler implementation


characters

public void characters(char[] ch,
                       int start,
                       int length)
SAX Handler implementation


ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
SAX Handler implementation


endElement

public void endElement(java.lang.String name)
SAX Handler implementation


endDocument

public void endDocument()
SAX Handler implementation


warning

public void warning(org.xml.sax.SAXParseException ex)
SAX Handler implementation


error

public void error(org.xml.sax.SAXParseException ex)
SAX Handler implementation


fatalError

public void fatalError(org.xml.sax.SAXParseException ex)
                throws org.xml.sax.SAXException
SAX Handler implementation

Throws:
org.xml.sax.SAXException

normalize

protected java.lang.String normalize(java.lang.String s)
Escapes characters data



Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.