org.apache.batik.xml.scanner
Class AbstractScanner

java.lang.Object
  |
  +--org.apache.batik.xml.scanner.AbstractScanner
All Implemented Interfaces:
Localizable
Direct Known Subclasses:
DocumentScanner

public class AbstractScanner
extends java.lang.Object
implements Localizable

This class contains the basic methods needed by an XML scanners.


Field Summary
protected  char[] buffer
          The buffer used to store the value of the current lexical unit.
static java.lang.String BUNDLE_CLASSNAME
          The default resource bundle base name.
protected  InputBuffer inputBuffer
          The input buffer.
protected  boolean lastFragment
          Must be set to true when the current lexical unit is the last string fragment of an attribute value or an entity value.
protected  LocalizableSupport localizableSupport
          The localizable support.
protected  int type
          The type of the current lexical unit.
protected  char[] value
          The value of the current lexical unit.
 
Constructor Summary
protected AbstractScanner(java.io.Reader r)
          Creates a new AbstractScanner object.
 
Method Summary
protected  LexicalException createException(java.lang.String message)
          Returns a LexicalException initialized with the given message.
 int currentType()
          The current lexical unit type like defined in LexicalUnits.
 java.lang.String formatMessage(java.lang.String key, java.lang.Object[] args)
          Implements Localizable.formatMessage(String,Object[]).
 InputBuffer getInputBuffer()
          Returns the input buffer.
 java.util.Locale getLocale()
          Implements Localizable.getLocale().
protected  int readComment()
          Reads a comment.
protected  int readIdentifier(java.lang.String s, int type, int ntype)
          Reads the given identifier.
protected  int readName(int type)
          Reads a name.
protected  int readNmtoken()
          Reads a Nmtoken.
protected  int readPEReference()
          Reads a parameter entity reference.
protected  int readPIStart()
          Reads a processing instruction start.
protected  int readReference()
          Reads an entity or character reference.
protected  int readString()
          Reads a simple string, like the ones used for version, encoding, public/system identifiers...
 void setLocale(java.util.Locale l)
          Implements Localizable.setLocale(Locale).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE_CLASSNAME

public static final java.lang.String BUNDLE_CLASSNAME
The default resource bundle base name.

localizableSupport

protected LocalizableSupport localizableSupport
The localizable support.

inputBuffer

protected InputBuffer inputBuffer
The input buffer.

buffer

protected char[] buffer
The buffer used to store the value of the current lexical unit.

value

protected char[] value
The value of the current lexical unit.

type

protected int type
The type of the current lexical unit.

lastFragment

protected boolean lastFragment
Must be set to true when the current lexical unit is the last string fragment of an attribute value or an entity value.
Constructor Detail

AbstractScanner

protected AbstractScanner(java.io.Reader r)
                   throws LexicalException
Creates a new AbstractScanner object.
Parameters:
r - The reader to scan.
Method Detail

setLocale

public void setLocale(java.util.Locale l)
Implements Localizable.setLocale(Locale).
Specified by:
setLocale in interface Localizable
Following copied from interface: org.apache.batik.i18n.Localizable
Parameters:
l - The locale to set.

getLocale

public java.util.Locale getLocale()
Implements Localizable.getLocale().
Specified by:
getLocale in interface Localizable

formatMessage

public java.lang.String formatMessage(java.lang.String key,
                                      java.lang.Object[] args)
                               throws java.util.MissingResourceException
Implements Localizable.formatMessage(String,Object[]).
Specified by:
formatMessage in interface Localizable
Following copied from interface: org.apache.batik.i18n.Localizable
Parameters:
key - The key used to retreive the message from the resource bundle.
args - The objects that compose the message.
Throws:
java.util.MissingResourceException - if the key is not in the bundle.

getInputBuffer

public InputBuffer getInputBuffer()
Returns the input buffer.

currentType

public int currentType()
The current lexical unit type like defined in LexicalUnits.

readIdentifier

protected int readIdentifier(java.lang.String s,
                             int type,
                             int ntype)
                      throws java.io.IOException,
                             LexicalException
Reads the given identifier.
Parameters:
s - The portion of the identifier to read.
type - The lexical unit type of the identifier.
ntype - The lexical unit type to set if the identifier do not match or -1 if an error must be signaled.

readName

protected int readName(int type)
                throws java.io.IOException,
                       LexicalException
Reads a name. The current character must be the first character.
Parameters:
type - The lexical unit type to set.
Returns:
type.

readNmtoken

protected int readNmtoken()
                   throws java.io.IOException,
                          LexicalException
Reads a Nmtoken. The current character must be the first character.
Returns:
LexicalUnits.NMTOKEN.

readComment

protected int readComment()
                   throws java.io.IOException,
                          LexicalException
Reads a comment. '<!-' must have been read.
Returns:
type.

readString

protected int readString()
                  throws java.io.IOException,
                         LexicalException
Reads a simple string, like the ones used for version, encoding, public/system identifiers... The current character must be the string delimiter.
Returns:
type.

readReference

protected int readReference()
                     throws java.io.IOException,
                            LexicalException
Reads an entity or character reference. The current character must be '&'.
Returns:
type.

readPEReference

protected int readPEReference()
                       throws java.io.IOException,
                              LexicalException
Reads a parameter entity reference. The current character must be '%'.
Returns:
type.

readPIStart

protected int readPIStart()
                   throws java.io.IOException,
                          LexicalException
Reads a processing instruction start.
Returns:
type.

createException

protected LexicalException createException(java.lang.String message)
Returns a LexicalException initialized with the given message.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.