net.n3.nanoxml
Interface IXMLReader

All Known Implementing Classes:
StdXMLReader

public interface IXMLReader

IXMLReader reads the data to be parsed.

Version:
$Name$, $Revision: 1183 $
Author:
Marc De Scheemaecker

Method Summary
 boolean atEOF()
          Returns true if there are no more characters left to be read.
 boolean atEOFOfCurrentStream()
          Returns true if the current stream has no more characters left to be read.
 int getLineNr()
          Returns the line number of the data in the current stream.
 java.lang.String getPublicID()
          Returns the current public ID.
 java.lang.String getSystemID()
          Returns the current system ID.
 java.io.Reader openStream(java.lang.String publicID, java.lang.String systemID)
          Opens a stream from a public and system ID.
 char read()
          Reads a character.
 void setPublicID(java.lang.String publicID)
          Sets the public ID of the current stream.
 void setSystemID(java.lang.String systemID)
          Sets the system ID of the current stream.
 void startNewStream(java.io.Reader reader)
          Starts a new stream from a Java reader.
 void unread(char ch)
          Pushes the last character read back to the stream.
 

Method Detail

read

public char read()
          throws java.io.IOException
Reads a character.

Returns:
the character
Throws:
java.io.IOException - if no character could be read

atEOFOfCurrentStream

public boolean atEOFOfCurrentStream()
                             throws java.io.IOException
Returns true if the current stream has no more characters left to be read.

Throws:
java.io.IOException - if an I/O error occurred

atEOF

public boolean atEOF()
              throws java.io.IOException
Returns true if there are no more characters left to be read.

Throws:
java.io.IOException - if an I/O error occurred

unread

public void unread(char ch)
            throws java.io.IOException
Pushes the last character read back to the stream.

Parameters:
ch - the character to push back
Throws:
java.io.IOException - if an I/O error occurred

getLineNr

public int getLineNr()
Returns the line number of the data in the current stream.


openStream

public java.io.Reader openStream(java.lang.String publicID,
                                 java.lang.String systemID)
                          throws java.net.MalformedURLException,
                                 java.io.FileNotFoundException,
                                 java.io.IOException
Opens a stream from a public and system ID.

Parameters:
publicID - the public ID, which may be null
systemID - the system ID, which is never null
Throws:
java.net.MalformedURLException - if the system ID does not contain a valid URL
java.io.FileNotFoundException - if the system ID refers to a local file which does not exist
java.io.IOException - if an error occurred opening the stream

startNewStream

public void startNewStream(java.io.Reader reader)
Starts a new stream from a Java reader. The new stream is used temporary to read data from. If that stream is exhausted, control returns to the parent stream.

Parameters:
reader - the reader to read the new data from

setSystemID

public void setSystemID(java.lang.String systemID)
                 throws java.net.MalformedURLException
Sets the system ID of the current stream.

Parameters:
systemID - the system ID
Throws:
java.net.MalformedURLException - if the system ID does not contain a valid URL

setPublicID

public void setPublicID(java.lang.String publicID)
Sets the public ID of the current stream.

Parameters:
publicID - the public ID

getSystemID

public java.lang.String getSystemID()
Returns the current system ID.


getPublicID

public java.lang.String getPublicID()
Returns the current public ID.