Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.media.mn8.protocol.jabber.xmlparser
Class XMLParser  view XMLParser download XMLParser.java

java.lang.Object
  extended byorg.media.mn8.protocol.jabber.xmlparser.XMLParser

public class XMLParser
extends java.lang.Object

The main XML Parser class.


Nested Class Summary
(package private)  class XMLParser.InPlaintextReadEndChecker
          Class to indicate the end of reading a plain text section
(package private)  class XMLParser.InTagReadEndChecker
          Class to indicate the end of reading a tag section
 
Field Summary
private  java.lang.StringBuffer dataBuffer
          The buffer for incomming data.
private  XMLEventListener eventHandler
          The handler for XML Events.
private  XMLParser.InPlaintextReadEndChecker inPlaintextReadEndChecker
          Shared instance of the plain text end checker.
private  java.io.Reader inputReader
          The reader from which the stream is being read
private  XMLParser.InTagReadEndChecker inTagReadEndChecker
          Shared instance of the tag end checker.
private  java.io.InputStream is
          The input stream being read.
private  boolean isUTF8Encoded
          Flag to say whether or not this stream is UTF-8 encoded.
private  java.lang.String rootTag
          The root tag for the document.
 
Constructor Summary
XMLParser(XMLEventListener _eventHandler)
          Constructor, Used to override default dispatcher.
 
Method Summary
 int getNextCharacter()
          Method to get the next character from the input stream.
private  java.util.Hashtable handleAttributes(java.lang.String data)
          Method to handle the attributes in a tag
private  void handlePlainText()
          Method to handle the reading in and dispatching of events for plain text.
private  void handleTag()
          Method to handle the reading and dispatch of tag data.
private  boolean isWhitespace(char c)
          Method to determine if a character is a whitespace.
 void parse(java.io.InputStream _is)
          Parse wrapper for InputStreams
 void parse(java.io.Reader _inputReader)
          The main parsing loop.
private  java.lang.String readUntilEnd(ReadEndChecker checker)
          Method to read until an end condition.
 void setInputUTF8Encoded(boolean flag)
          Method to set the flag to state whether or not the input is UTF-8 encoded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputReader

private java.io.Reader inputReader
The reader from which the stream is being read


eventHandler

private XMLEventListener eventHandler
The handler for XML Events.


rootTag

private java.lang.String rootTag
The root tag for the document.


isUTF8Encoded

private boolean isUTF8Encoded
Flag to say whether or not this stream is UTF-8 encoded.


dataBuffer

private java.lang.StringBuffer dataBuffer
The buffer for incomming data.


is

private java.io.InputStream is
The input stream being read.


inPlaintextReadEndChecker

private final XMLParser.InPlaintextReadEndChecker inPlaintextReadEndChecker
Shared instance of the plain text end checker.


inTagReadEndChecker

private final XMLParser.InTagReadEndChecker inTagReadEndChecker
Shared instance of the tag end checker.

Constructor Detail

XMLParser

public XMLParser(XMLEventListener _eventHandler)
Constructor, Used to override default dispatcher.

Method Detail

isWhitespace

private boolean isWhitespace(char c)
Method to determine if a character is a whitespace.


setInputUTF8Encoded

public void setInputUTF8Encoded(boolean flag)
Method to set the flag to state whether or not the input is UTF-8 encoded. For the UTF-8 decoding to work the parse method MUST be called by passing it a java.io.DataInputStream object.


getNextCharacter

public int getNextCharacter()
                     throws java.io.IOException
Method to get the next character from the input stream.


readUntilEnd

private java.lang.String readUntilEnd(ReadEndChecker checker)
                               throws java.io.IOException,
                                      EndOfXMLException
Method to read until an end condition.


handleAttributes

private java.util.Hashtable handleAttributes(java.lang.String data)
Method to handle the attributes in a tag


handleTag

private void handleTag()
                throws java.io.IOException,
                       EndOfXMLException
Method to handle the reading and dispatch of tag data.


handlePlainText

private void handlePlainText()
                      throws java.io.IOException,
                             EndOfXMLException
Method to handle the reading in and dispatching of events for plain text.


parse

public void parse(java.io.InputStream _is)
           throws java.io.IOException
Parse wrapper for InputStreams


parse

public void parse(java.io.Reader _inputReader)
           throws java.io.IOException
The main parsing loop.