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

Quick Search    Search Deep

com.microstar.xml
Class XmlParser  view XmlParser download XmlParser.java

java.lang.Object
  extended bycom.microstar.xml.XmlParser

public class XmlParser
extends java.lang.Object

Parse XML documents and return parse events through call-backs.

You need to define a class implementing the XmlHandler interface: an object belonging to this class will receive the callbacks for the events. (As an alternative to implementing the full XmlHandler interface, you can simply extend the HandlerBase convenience class.)

Usage (assuming that MyHandler is your implementation of the XmlHandler interface):

 XmlHandler handler = new MyHandler();
 XmlParser parser = new XmlParser();
 parser.setHandler(handler);
 try {
   parser.parse("http://www.host.com/doc.xml", null);
 } catch (Exception e) {
   [do something interesting]
 }
 

Alternatively, you can use the standard SAX interfaces with the SAXDriver class as your entry point.

Version:
1.1

Field Summary
static int ATTRIBUTE_CDATA
          Constant: the attribute value is a string value.
static int ATTRIBUTE_DEFAULT_FIXED
          Constant: the attribute was declared #FIXED.
static int ATTRIBUTE_DEFAULT_IMPLIED
          Constant: the attribute was declared #IMPLIED.
static int ATTRIBUTE_DEFAULT_REQUIRED
          Constant: the attribute was declared #REQUIRED.
static int ATTRIBUTE_DEFAULT_SPECIFIED
          Constant: the attribute has a literal default value specified.
static int ATTRIBUTE_DEFAULT_UNDECLARED
          Constant: the attribute is not declared.
static int ATTRIBUTE_ENTITIES
          Constant: the attribute value is a list of entity names.
static int ATTRIBUTE_ENTITY
          Constant: the attribute value is the name of an entity.
static int ATTRIBUTE_ENUMERATED
          Constant: the attribute value is a token from an enumeration.
static int ATTRIBUTE_ID
          Constant: the attribute value is a unique identifier.
static int ATTRIBUTE_IDREF
          Constant: the attribute value is a reference to a unique identifier.
static int ATTRIBUTE_IDREFS
          Constant: the attribute value is a list of ID references.
static int ATTRIBUTE_NMTOKEN
          Constant: the attribute value is a name token.
static int ATTRIBUTE_NMTOKENS
          Constant: the attribute value is a list of name tokens.
static int ATTRIBUTE_NOTATION
          Constant: the attribute is the name of a notation.
static int ATTRIBUTE_UNDECLARED
          Constant: the attribute has not been declared for this element type.
private static java.util.Hashtable attributeTypeHash
          Hash table of attribute types.
private  int baseEncoding
           
private  char[] baseInputBuffer
           
private  int baseInputBufferLength
           
private  int baseInputBufferStart
           
private  java.io.InputStream baseInputStream
           
private  java.lang.String basePublicId
           
private  java.io.Reader baseReader
           
private  java.lang.String baseURI
           
private  int column
           
static int CONTENT_ANY
          Constant: the element has a content model of ANY.
static int CONTENT_ELEMENTS
          Constant: the element has element content.
static int CONTENT_EMPTY
          Constant: the element has declared content of EMPTY.
static int CONTENT_MIXED
          Constant: the element has mixed content.
static int CONTENT_UNDECLARED
          Constant: an element has not been declared.
private  int context
           
private static int CONTEXT_ATTRIBUTEVALUE
           
private static int CONTEXT_DTD
           
private static int CONTEXT_ENTITYVALUE
           
private static int CONTEXT_NONE
           
private  int currentByteCount
           
private  java.lang.String currentElement
           
private  int currentElementContent
           
private static int DATA_BUFFER_INITIAL
           
private  char[] dataBuffer
           
private  int dataBufferPos
           
private  java.util.Hashtable elementInfo
           
private  int encoding
           
private static int ENCODING_ISO_8859_1
           
private static int ENCODING_UCS_2_12
           
private static int ENCODING_UCS_2_21
           
private static int ENCODING_UCS_4_1234
           
private static int ENCODING_UCS_4_2143
           
private static int ENCODING_UCS_4_3412
           
private static int ENCODING_UCS_4_4321
           
private static int ENCODING_UTF_8
           
static int ENTITY_INTERNAL
          Constant: the entity is internal.
static int ENTITY_NDATA
          Constant: the entity is external, non-XML data.
static int ENTITY_TEXT
          Constant: the entity is external XML data.
static int ENTITY_UNDECLARED
          Constant: the entity has not been declared.
private  java.util.Hashtable entityInfo
           
private  java.util.Stack entityStack
           
private  int errorCount
           
private  java.net.URLConnection externalEntity
           
(package private)  XmlHandler handler
           
private static int INPUT_BUFFER
           
private static int INPUT_EXTERNAL
           
private static int INPUT_INTERNAL
           
private static int INPUT_NONE
           
private static int INPUT_READER
           
private static int INPUT_STREAM
           
private  java.util.Stack inputStack
           
private  java.io.InputStream is
           
private  int line
           
private static int LIT_CHAR_REF
           
private static int LIT_ENTITY_REF
           
private static int LIT_NORMALIZE
           
private static int LIT_PE_REF
           
private static int NAME_BUFFER_INITIAL
           
private  char[] nameBuffer
           
private  int nameBufferPos
           
private  java.util.Hashtable notationInfo
           
private  byte[] rawReadBuffer
           
private static int READ_BUFFER_MAX
           
private  char[] readBuffer
           
private  int readBufferLength
           
private  int readBufferOverflow
           
private  int readBufferPos
           
private  java.io.Reader reader
           
private  boolean sawCR
           
private  int sourceType
           
private static int SYMBOL_TABLE_LENGTH
           
private  java.lang.Object[] symbolTable
           
private  int tagAttributePos
           
private  java.lang.String[] tagAttributes
           
private static boolean USE_CHEATS
           
 
Constructor Summary
XmlParser()
          Construct a new parser with no associated handler.
 
Method Summary
(package private)  void checkEncoding(java.lang.String encodingName, boolean ignoreEncoding)
          Check that the encoding specified makes sense.
(package private)  void cleanupVariables()
          Clean up after the parse to allow some garbage collection.
(package private)  void copyIso8859_1ReadBuffer(int count)
          Convert a buffer of ISO-8859-1-encoded bytes into UTF-16 characters.
(package private)  void copyUcs2ReadBuffer(int count, int shift1, int shift2)
          Convert a buffer of UCS-2-encoded bytes into UTF-16 characters.
(package private)  void copyUcs4ReadBuffer(int count, int shift1, int shift2, int shift3, int shift4)
          Convert a buffer of UCS-4-encoded bytes into UTF-16 characters.
(package private)  void copyUtf8ReadBuffer(int count)
          Convert a buffer of UTF-8-encoded bytes into UTF-16 characters.
(package private)  void dataBufferAppend(char c)
          Add a character to the data buffer.
(package private)  void dataBufferAppend(char[] ch, int start, int length)
          Append (part of) a character array to the data buffer.
(package private)  void dataBufferAppend(java.lang.String s)
          Add a string to the data buffer.
(package private)  void dataBufferFlush()
          Flush the contents of the data buffer to the handler, if appropriate, and reset the buffer for new input.
(package private)  void dataBufferNormalize()
          Normalise whitespace in the data buffer.
(package private)  java.lang.String dataBufferToString()
          Convert the data buffer to a string.
 java.util.Enumeration declaredAttributes(java.lang.String elname)
          Get the declared attributes for an element type.
 java.util.Enumeration declaredElements()
          Get the declared elements for an XML document.
 java.util.Enumeration declaredEntities()
          Get declared entities.
 java.util.Enumeration declaredNotations()
          Get declared notations.
(package private)  void detectEncoding()
          Attempt to detect the encoding of an entity.
private  void doParse(java.lang.String systemId, java.lang.String publicId, java.io.Reader reader, java.io.InputStream stream, java.lang.String encoding)
           
(package private)  void encodingError(java.lang.String message, int value, int offset)
          Report a character encoding error.
(package private)  void error(java.lang.String message, char textFound, java.lang.String textExpected)
          Report a serious error.
(package private)  void error(java.lang.String message, java.lang.String textFound, java.lang.String textExpected)
          Report an error.
(package private)  java.lang.Object extendArray(java.lang.Object array, int currentSize, int requiredSize)
          Ensure the capacity of an array, allocating a new one if necessary.
(package private)  void filterCR()
          Filter carriage returns in the read buffer.
(package private)  java.lang.Object[] getAttribute(java.lang.String elName, java.lang.String name)
          Retrieve the three-member array representing an attribute declaration.
 java.lang.String getAttributeDefaultValue(java.lang.String name, java.lang.String aname)
          Retrieve the default value of a declared attribute.
 int getAttributeDefaultValueType(java.lang.String name, java.lang.String aname)
          Retrieve the default value type of a declared attribute.
 java.lang.String getAttributeEnumeration(java.lang.String name, java.lang.String aname)
          Retrieve the allowed values for an enumerated attribute type.
 java.lang.String getAttributeExpandedValue(java.lang.String name, java.lang.String aname)
          Retrieve the expanded value of a declared attribute.
 int getAttributeType(java.lang.String name, java.lang.String aname)
          Retrieve the declared type of an attribute.
 int getColumnNumber()
          Return the current column number.
(package private)  java.util.Hashtable getElementAttributes(java.lang.String name)
          Look up the attribute hash table for an element.
 java.lang.String getElementContentModel(java.lang.String name)
          Look up the content model of an element.
 int getElementContentType(java.lang.String name)
          Look up the content type of an element.
 java.lang.String getEntityNotationName(java.lang.String eName)
          Get the notation name associated with an NDATA entity.
 java.lang.String getEntityPublicId(java.lang.String ename)
          Return an external entity's public identifier, if any.
 java.lang.String getEntitySystemId(java.lang.String ename)
          Return an external entity's system identifier.
 int getEntityType(java.lang.String ename)
          Find the type of an entity.
 java.lang.String getEntityValue(java.lang.String ename)
          Return the value of an internal entity.
 int getLineNumber()
          Return the current line number.
(package private)  int getNextUtf8Byte(int pos, int count)
          Return the next byte value in a UTF-8 sequence.
 java.lang.String getNotationPublicId(java.lang.String nname)
          Look up the public identifier for a notation.
 java.lang.String getNotationSystemId(java.lang.String nname)
          Look up the system identifier for a notation.
(package private)  void initializeVariables()
          Re-initialize the variables for each parse.
 java.lang.String intern(char[] ch, int start, int length)
          Create an internalised string from a character array.
 java.lang.String intern(java.lang.String s)
          Return an internalised version of a string.
(package private)  boolean isWhitespace(char c)
          Test if a character is whitespace.
 void parse(java.lang.String systemId, java.lang.String publicId, java.io.InputStream stream, java.lang.String encoding)
          Parse an XML document from a byte stream.
 void parse(java.lang.String systemId, java.lang.String publicId, java.io.Reader reader)
          Parse an XML document from a character stream.
 void parse(java.lang.String systemId, java.lang.String publicId, java.lang.String encoding)
          Parse an XML document from a URI.
(package private)  void parseAttDef(java.lang.String elementName)
          Parse a single attribute definition.
(package private)  void parseAttlistDecl()
          Parse an attribute list declaration.
(package private)  void parseAttribute(java.lang.String name)
          Parse an attribute assignment.
(package private)  void parseCDSect()
          Parse a CDATA marked section.
(package private)  void parseCharRef()
          Read a character reference.
(package private)  void parseComment()
          Skip a comment.
(package private)  void parseConditionalSect()
          Parse a conditional section.
(package private)  void parseContent()
          Parse the content of an element.
(package private)  void parseContentspec(java.lang.String name)
          Content specification.
(package private)  void parseCp()
          Parse a content particle.
(package private)  void parseDefault(java.lang.String elementName, java.lang.String name, int type, java.lang.String enum)
          Parse the default value for an attribute.
(package private)  void parseDoctypedecl()
          Parse a document type declaration.
(package private)  void parseDocument()
          Parse an XML document.
(package private)  void parseElement()
          Parse an element, with its tags.
(package private)  void parseElementdecl()
          Parse an element type declaration.
(package private)  void parseElements()
          Parse an element-content model.
(package private)  void parseEntityDecl()
          Parse an entity declaration.
(package private)  void parseEntityRef(boolean externalAllowed)
          Parse a reference.
(package private)  void parseEnumeration()
          Parse an enumeration.
(package private)  void parseEq()
          Parse an equals sign surrounded by optional whitespace.
(package private)  void parseETag()
          Parse an end tag.
(package private)  void parseMarkupdecl()
          Parse a markup declaration in the internal or external DTD subset.
(package private)  void parseMisc()
          Parse miscellaneous markup outside the document element and DOCTYPE declaration.
(package private)  void parseMixed()
          Parse mixed content.
(package private)  void parseNotationDecl()
          Parse a notation declaration.
(package private)  void parseNotationType()
          Parse a notation type for an attribute.
(package private)  void parsePCData()
          Parse PCDATA.
(package private)  void parsePEReference(boolean isEntityValue)
          Parse a parameter entity reference.
(package private)  void parsePI()
          Parse a processing instruction and do a call-back.
(package private)  void parseProlog()
          Parse the prolog of an XML document.
(package private)  void parseTextDecl(boolean ignoreEncoding)
          Parse the Encoding PI.
(package private)  void parseUntil(java.lang.String delim)
          Read all data until we find the specified string.
(package private)  void parseWhitespace()
          Parse whitespace characters, and leave them in the data buffer.
(package private)  void parseXMLDecl(boolean ignoreEncoding)
          Parse the XML declaration.
(package private)  void popInput()
          Restore a previous input source.
(package private)  void pushCharArray(java.lang.String ename, char[] ch, int start, int length)
          Push a new internal input source.
(package private)  void pushInput(java.lang.String ename)
          Save the current input source onto the stack.
(package private)  void pushString(java.lang.String ename, java.lang.String s)
          This method pushes a string back onto input.
(package private)  void pushURL(java.lang.String ename, java.lang.String publicId, java.lang.String systemId, java.io.Reader reader, java.io.InputStream stream, java.lang.String encoding)
          Push a new external input source.
(package private)  void read8bitEncodingDeclaration()
          Read just the encoding declaration (or XML declaration) at the start of an external entity.
(package private)  int readAttType()
          Parse the attribute type.
(package private)  char readCh()
          Read a single character from the readBuffer.
(package private)  void readDataChunk()
          Read a chunk of data from an external input source.
(package private)  java.lang.String[] readExternalIds(boolean inNotation)
          Try reading external identifiers.
(package private)  java.lang.String readLiteral(int flags)
          Read a literal.
(package private)  java.lang.String readNmtoken(boolean isName)
          Read a name or name token.
(package private)  void require(char delim)
          Require a character to appear, or throw an exception.
(package private)  void require(java.lang.String delim)
          Require a string to appear, or throw an exception.
(package private)  void requireWhitespace()
          Require whitespace characters.
(package private)  void setAttribute(java.lang.String elName, java.lang.String name, int type, java.lang.String enumeration, java.lang.String value, int valueType)
          Register an attribute declaration for later retrieval.
(package private)  void setElement(java.lang.String name, int contentType, java.lang.String contentModel, java.util.Hashtable attributes)
          Register an element.
(package private)  void setEntity(java.lang.String eName, int eClass, java.lang.String pubid, java.lang.String sysid, java.lang.String value, java.lang.String nName)
          Register an entity declaration for later retrieval.
(package private)  void setExternalDataEntity(java.lang.String eName, java.lang.String pubid, java.lang.String sysid, java.lang.String nName)
          Register an external data entity.
(package private)  void setExternalTextEntity(java.lang.String eName, java.lang.String pubid, java.lang.String sysid)
          Register an external text entity.
 void setHandler(XmlHandler handler)
          Set the handler that will receive parsing events.
(package private)  void setInternalEntity(java.lang.String eName, java.lang.String value)
          Register an entity declaration for later retrieval.
(package private)  void setNotation(java.lang.String nname, java.lang.String pubid, java.lang.String sysid)
          Register a notation declaration for later retrieval.
(package private)  void skipUntil(java.lang.String delim)
          Skip all data until we find the specified string.
(package private)  void skipWhitespace()
          Skip whitespace characters.
(package private)  boolean tryEncoding(byte[] sig, byte b1, byte b2)
          Check for a two-byte signature.
(package private)  boolean tryEncoding(byte[] sig, byte b1, byte b2, byte b3, byte b4)
          Check for a four-byte signature.
(package private)  void tryEncodingDecl(boolean ignoreEncoding)
          Check for an encoding declaration.
(package private)  boolean tryRead(char delim)
          Return true if we can read the expected character.
(package private)  boolean tryRead(java.lang.String delim)
          Return true if we can read the expected string.
(package private)  boolean tryWhitespace()
          Return true if we can read some whitespace.
(package private)  void unread(char c)
          Push a single character back onto the current input stream.
(package private)  void unread(char[] ch, int length)
          Push a char array back onto the current input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_CHEATS

private static final boolean USE_CHEATS
See Also:
Constant Field Values

CONTENT_UNDECLARED

public static final int CONTENT_UNDECLARED
Constant: an element has not been declared.

See Also:
getElementContentType(java.lang.String) 55 , Constant Field Values

CONTENT_ANY

public static final int CONTENT_ANY
Constant: the element has a content model of ANY.

See Also:
getElementContentType(java.lang.String) 55 , Constant Field Values

CONTENT_EMPTY

public static final int CONTENT_EMPTY
Constant: the element has declared content of EMPTY.

See Also:
getElementContentType(java.lang.String) 55 , Constant Field Values

CONTENT_MIXED

public static final int CONTENT_MIXED
Constant: the element has mixed content.

See Also:
getElementContentType(java.lang.String) 55 , Constant Field Values

CONTENT_ELEMENTS

public static final int CONTENT_ELEMENTS
Constant: the element has element content.

See Also:
getElementContentType(java.lang.String) 55 , Constant Field Values

ENTITY_UNDECLARED

public static final int ENTITY_UNDECLARED
Constant: the entity has not been declared.

See Also:
getEntityType(java.lang.String) 55 , Constant Field Values

ENTITY_INTERNAL

public static final int ENTITY_INTERNAL
Constant: the entity is internal.

See Also:
getEntityType(java.lang.String) 55 , Constant Field Values

ENTITY_NDATA

public static final int ENTITY_NDATA
Constant: the entity is external, non-XML data.

See Also:
getEntityType(java.lang.String) 55 , Constant Field Values

ENTITY_TEXT

public static final int ENTITY_TEXT
Constant: the entity is external XML data.

See Also:
getEntityType(java.lang.String) 55 , Constant Field Values

ATTRIBUTE_UNDECLARED

public static final int ATTRIBUTE_UNDECLARED
Constant: the attribute has not been declared for this element type.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_CDATA

public static final int ATTRIBUTE_CDATA
Constant: the attribute value is a string value.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_ID

public static final int ATTRIBUTE_ID
Constant: the attribute value is a unique identifier.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_IDREF

public static final int ATTRIBUTE_IDREF
Constant: the attribute value is a reference to a unique identifier.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_IDREFS

public static final int ATTRIBUTE_IDREFS
Constant: the attribute value is a list of ID references.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_ENTITY

public static final int ATTRIBUTE_ENTITY
Constant: the attribute value is the name of an entity.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_ENTITIES

public static final int ATTRIBUTE_ENTITIES
Constant: the attribute value is a list of entity names.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_NMTOKEN

public static final int ATTRIBUTE_NMTOKEN
Constant: the attribute value is a name token.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_NMTOKENS

public static final int ATTRIBUTE_NMTOKENS
Constant: the attribute value is a list of name tokens.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_ENUMERATED

public static final int ATTRIBUTE_ENUMERATED
Constant: the attribute value is a token from an enumeration.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_NOTATION

public static final int ATTRIBUTE_NOTATION
Constant: the attribute is the name of a notation.

See Also:
getAttributeType(java.lang.String, java.lang.String) 55 , Constant Field Values

attributeTypeHash

private static java.util.Hashtable attributeTypeHash
Hash table of attribute types.


ENCODING_UTF_8

private static final int ENCODING_UTF_8
See Also:
Constant Field Values

ENCODING_ISO_8859_1

private static final int ENCODING_ISO_8859_1
See Also:
Constant Field Values

ENCODING_UCS_2_12

private static final int ENCODING_UCS_2_12
See Also:
Constant Field Values

ENCODING_UCS_2_21

private static final int ENCODING_UCS_2_21
See Also:
Constant Field Values

ENCODING_UCS_4_1234

private static final int ENCODING_UCS_4_1234
See Also:
Constant Field Values

ENCODING_UCS_4_4321

private static final int ENCODING_UCS_4_4321
See Also:
Constant Field Values

ENCODING_UCS_4_2143

private static final int ENCODING_UCS_4_2143
See Also:
Constant Field Values

ENCODING_UCS_4_3412

private static final int ENCODING_UCS_4_3412
See Also:
Constant Field Values

ATTRIBUTE_DEFAULT_UNDECLARED

public static final int ATTRIBUTE_DEFAULT_UNDECLARED
Constant: the attribute is not declared.

See Also:
getAttributeDefaultValueType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_DEFAULT_SPECIFIED

public static final int ATTRIBUTE_DEFAULT_SPECIFIED
Constant: the attribute has a literal default value specified.

See Also:
getAttributeDefaultValueType(java.lang.String, java.lang.String) 55 , getAttributeDefaultValue(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_DEFAULT_IMPLIED

public static final int ATTRIBUTE_DEFAULT_IMPLIED
Constant: the attribute was declared #IMPLIED.

See Also:
getAttributeDefaultValueType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_DEFAULT_REQUIRED

public static final int ATTRIBUTE_DEFAULT_REQUIRED
Constant: the attribute was declared #REQUIRED.

See Also:
getAttributeDefaultValueType(java.lang.String, java.lang.String) 55 , Constant Field Values

ATTRIBUTE_DEFAULT_FIXED

public static final int ATTRIBUTE_DEFAULT_FIXED
Constant: the attribute was declared #FIXED.

See Also:
getAttributeDefaultValueType(java.lang.String, java.lang.String) 55 , getAttributeDefaultValue(java.lang.String, java.lang.String) 55 , Constant Field Values

INPUT_NONE

private static final int INPUT_NONE
See Also:
Constant Field Values

INPUT_INTERNAL

private static final int INPUT_INTERNAL
See Also:
Constant Field Values

INPUT_EXTERNAL

private static final int INPUT_EXTERNAL
See Also:
Constant Field Values

INPUT_STREAM

private static final int INPUT_STREAM
See Also:
Constant Field Values

INPUT_BUFFER

private static final int INPUT_BUFFER
See Also:
Constant Field Values

INPUT_READER

private static final int INPUT_READER
See Also:
Constant Field Values

LIT_CHAR_REF

private static final int LIT_CHAR_REF
See Also:
Constant Field Values

LIT_ENTITY_REF

private static final int LIT_ENTITY_REF
See Also:
Constant Field Values

LIT_PE_REF

private static final int LIT_PE_REF
See Also:
Constant Field Values

LIT_NORMALIZE

private static final int LIT_NORMALIZE
See Also:
Constant Field Values

CONTEXT_NONE

private static final int CONTEXT_NONE
See Also:
Constant Field Values

CONTEXT_DTD

private static final int CONTEXT_DTD
See Also:
Constant Field Values

CONTEXT_ENTITYVALUE

private static final int CONTEXT_ENTITYVALUE
See Also:
Constant Field Values

CONTEXT_ATTRIBUTEVALUE

private static final int CONTEXT_ATTRIBUTEVALUE
See Also:
Constant Field Values

handler

XmlHandler handler

reader

private java.io.Reader reader

is

private java.io.InputStream is

line

private int line

column

private int column

sourceType

private int sourceType

inputStack

private java.util.Stack inputStack

externalEntity

private java.net.URLConnection externalEntity

encoding

private int encoding

currentByteCount

private int currentByteCount

errorCount

private int errorCount

READ_BUFFER_MAX

private static final int READ_BUFFER_MAX
See Also:
Constant Field Values

readBuffer

private char[] readBuffer

readBufferPos

private int readBufferPos

readBufferLength

private int readBufferLength

readBufferOverflow

private int readBufferOverflow

rawReadBuffer

private byte[] rawReadBuffer

DATA_BUFFER_INITIAL

private static int DATA_BUFFER_INITIAL

dataBuffer

private char[] dataBuffer

dataBufferPos

private int dataBufferPos

NAME_BUFFER_INITIAL

private static int NAME_BUFFER_INITIAL

nameBuffer

private char[] nameBuffer

nameBufferPos

private int nameBufferPos

elementInfo

private java.util.Hashtable elementInfo

entityInfo

private java.util.Hashtable entityInfo

notationInfo

private java.util.Hashtable notationInfo

currentElement

private java.lang.String currentElement

currentElementContent

private int currentElementContent

basePublicId

private java.lang.String basePublicId

baseURI

private java.lang.String baseURI

baseEncoding

private int baseEncoding

baseReader

private java.io.Reader baseReader

baseInputStream

private java.io.InputStream baseInputStream

baseInputBuffer

private char[] baseInputBuffer

baseInputBufferStart

private int baseInputBufferStart

baseInputBufferLength

private int baseInputBufferLength

entityStack

private java.util.Stack entityStack

context

private int context

symbolTable

private java.lang.Object[] symbolTable

SYMBOL_TABLE_LENGTH

private static final int SYMBOL_TABLE_LENGTH
See Also:
Constant Field Values

tagAttributes

private java.lang.String[] tagAttributes

tagAttributePos

private int tagAttributePos

sawCR

private boolean sawCR
Constructor Detail

XmlParser

public XmlParser()
Construct a new parser with no associated handler.

Method Detail

setHandler

public void setHandler(XmlHandler handler)
Set the handler that will receive parsing events.


parse

public void parse(java.lang.String systemId,
                  java.lang.String publicId,
                  java.lang.String encoding)
           throws java.lang.Exception
Parse an XML document from a URI.

You may parse a document more than once, but only one thread may call this method for an object at one time.


parse

public void parse(java.lang.String systemId,
                  java.lang.String publicId,
                  java.io.InputStream stream,
                  java.lang.String encoding)
           throws java.lang.Exception
Parse an XML document from a byte stream.

The URI that you supply will become the base URI for resolving relative links, but Ælfred will actually read the document from the supplied input stream.

You may parse a document more than once, but only one thread may call this method for an object at one time.


parse

public void parse(java.lang.String systemId,
                  java.lang.String publicId,
                  java.io.Reader reader)
           throws java.lang.Exception
Parse an XML document from a character stream.

The URI that you supply will become the base URI for resolving relative links, but Ælfred will actually read the document from the supplied input stream.

You may parse a document more than once, but only one thread may call this method for an object at one time.


doParse

private void doParse(java.lang.String systemId,
                     java.lang.String publicId,
                     java.io.Reader reader,
                     java.io.InputStream stream,
                     java.lang.String encoding)
              throws java.lang.Exception

error

void error(java.lang.String message,
           java.lang.String textFound,
           java.lang.String textExpected)
     throws java.lang.Exception
Report an error.


error

void error(java.lang.String message,
           char textFound,
           java.lang.String textExpected)
     throws java.lang.Exception
Report a serious e