Contents | Package | Class | Tree | Deprecated | Index | Help XML for Java 1.0.4
PREV | NEXT SHOW LISTS | HIDE LISTS

Class com.ibm.xml.parser.Stderr

java.lang.Object
    |
    +----com.ibm.xml.parser.Stderr

public class Stderr
extends java.lang.Object
implements ErrorListener, StreamProducer
Stderr provides the XML4J parser's default implementations of the ErrorListener and StreamProducer interfaces.

Version:
Revision: 25 1.5 src/com/ibm/xml/parser/Stderr.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
See Also:
ErrorListener, StreamProducer

Field Summary
java.util.Hashtable  catalog
 
java.lang.String  name
 
static java.io.PrintWriter  printer
 
java.util.Stack  stack
 
java.net.URL  url
 
 

Constructor Summary
 Stderr(java.lang.String name)
Constructor.
 

Method Summary
void  closeInputStream(Source source)

Removes the input stream currently in use.

void  error(java.lang.String file, int lineNo, int charOffset, java.lang.Object key, java.lang.String msg)

Listen for XML4J parser errors, and reports these errors through the standard error stream (System.err).

static java.net.URL  file2URL(java.lang.String file)
Returns a file-protocol URL constructed from a context of the specified file and the JVM's system property "user.dir".
Source  getInputStream(java.lang.String name, java.lang.String publicID, java.lang.String systemID)

Returns the source of the input stream (could be a character stream or a byte stream) based on this constructor's name parameter and the URL specification given by systemID and publicID.

void  loadCatalog(java.io.Reader reader)
Loads a catalog which provides mapping between public IDs and system IDs.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printer

public static java.io.PrintWriter printer

name

protected java.lang.String name

url

protected java.net.URL url

stack

protected java.util.Stack stack

catalog

protected java.util.Hashtable catalog
Constructor Detail

Stderr

public Stderr(java.lang.String name)
Constructor.
Parameters:
name - URL or filespec to use as the default input stream; if a filespec is provided, this value can include a drive and directory spec. This value is also used to associate a name with errors reported to the default error listener (i.e. error() method) that have a file parameter =null.
See Also:
error
Method Detail

file2URL

public static java.net.URL file2URL(java.lang.String file) throws java.net.MalformedURLException
Returns a file-protocol URL constructed from a context of the specified file and the JVM's system property "user.dir".
Parameters:
file - The file to use in constructing the URL; this value can include a drive and directory spec.
Throws:
java.net.MalformedURLException - Thrown if unable to construct a URL based on the specified file.

error

public void error(java.lang.String file,
                  int lineNo,
                  int charOffset,
                  java.lang.Object key,
                  java.lang.String msg)

Listen for XML4J parser errors, and reports these errors through the standard error stream (System.err).

This method is defined by ErrorListener.

Implements:
error in interface ErrorListener
Parameters:
file - Processing file, or null if this constructor's name parameter is to be used.
lineNo - The line number where the current document event ends, or -1 if not available. Note that this is the line position of the first character after the text associated with the document event. Do NOT trust this value when the input stream includes invalid octet as its encoding.
charOffset - The column number where the current document event ends, or -1 if not available. Note that this is the column number of the first character after the text associated with the document event. The first column in a line is position 1. Do NOT trust this value when the input stream includes invalid octet as its encoding.
key - The object may be an instance of String or Exception. When this object is String, this value may help classify msg as an error (begins with "E_") or warning (begins with "W_").
msg - The error or warning message.
See Also:
ErrorListener

getInputStream

public Source getInputStream(java.lang.String name,
                             java.lang.String publicID,
                             java.lang.String systemID) throws java.io.IOException

Returns the source of the input stream (could be a character stream or a byte stream) based on this constructor's name parameter and the URL specification given by systemID and publicID.

This method is defined by StreamProducer.

Implements:
getInputStream in interface StreamProducer
Parameters:
name - CURRENTLY NOT IMPLEMENTED.
publicID - Entity's public ID which is to be used in preference to systemID, or null if no catalog is available.
systemID - Entity's system ID.
Returns:
The resolved source of the input stream, or null if unable to resolve.
Throws:
java.io.IOException - Thrown if unable to open the source defined by the specified IDs.
See Also:
loadCatalog, closeInputStream, ExternalID, StreamProducer

closeInputStream

public void closeInputStream(Source source)

Removes the input stream currently in use.

This method is defined by StreamProducer.

Implements:
closeInputStream in interface StreamProducer
Parameters:
source - CURRENTLY NOT IMPLEMENTED.
See Also:
getInputStream, StreamProducer

loadCatalog

public void loadCatalog(java.io.Reader reader) throws java.io.IOException
Loads a catalog which provides mapping between public IDs and system IDs.

This method reads data until it reaches the end of the stream, but it does not close the stream.

Catalog file format:
 <public ID><TAB><URL>
 <public ID><TAB><URL>
  :
  :
 

Note: Public IDs can not contain #xD or #xA.

Implements:
loadCatalog in interface StreamProducer
Parameters:
reader - Character input stream reader.
Throws:
java.io.IOException - Thrown if reader is invalid.
See Also:
getInputStream, ExternalID, loadCatalog, loadCatalog

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS