GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse.toolkit
Class CoroutineDtd<T extends Parser>

java.lang.Object
  extended by ca.gorman.xml.parse.toolkit.Coroutine_NoCallback<T>
      extended by ca.gorman.xml.parse.toolkit.Coroutine_Callback<T>
          extended by ca.gorman.xml.parse.toolkit.CoroutineDtd<T>
All Implemented Interfaces:
CurrentDtd, Dtd, Runnable

public final class CoroutineDtd<T extends Parser>
extends Coroutine_Callback<T>
implements CurrentDtd, Runnable

Invokes DTD handler from the parser thread to run in the application thread.


Constructor Summary
CoroutineDtd()
           Construct instance that cannot be used until initialized by setCoroutine, setListener and setParams.
CoroutineDtd(Coroutine coroutine)
           Construct instance that cannot be used until initialized by setListener and setParams.
CoroutineDtd(Coroutine coroutine, Listener<T> listener)
           Construct instance that cannot be used until initialized by setParams.
CoroutineDtd(Coroutine coroutine, Listener<T> listener, String name, String publicId, String systemId)
           Construct fully initialized instance, ready for immediate use.
 
Method Summary
 String getDocTypeName()
           Get the document type name.
 Listener<T> getListener()
           Get the listener.
 String getPublicId()
           Get the public identifier for the external DTD subset.
 String getSystemId()
           Get the system identifier for the external DTD subset.
 void parseContent()
           Parse the content of a Dtd.
 void run()
           Execute a callback from the parser thread to run the DTD handler in the application thread.
 void setListener(Listener<T> listener)
           Set or reset the listener.
 void setParams(String name, String publicId, String systemId)
           Set or reset data to be sent to the DTD handler.
 
Methods inherited from class ca.gorman.xml.parse.toolkit.Coroutine_Callback
getCoroutine, setCoroutine
 
Methods inherited from class ca.gorman.xml.parse.toolkit.Coroutine_NoCallback
getParser, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoroutineDtd

public CoroutineDtd()

Construct instance that cannot be used until initialized by setCoroutine, setListener and setParams.


CoroutineDtd

public CoroutineDtd(Coroutine coroutine)

Construct instance that cannot be used until initialized by setListener and setParams.

Throws:
NullPointerException - if coroutine is null

CoroutineDtd

public CoroutineDtd(Coroutine coroutine,
                    Listener<T> listener)

Construct instance that cannot be used until initialized by setParams.

Throws:
NullPointerException - if coroutine or listener is null

CoroutineDtd

public CoroutineDtd(Coroutine coroutine,
                    Listener<T> listener,
                    String name,
                    String publicId,
                    String systemId)

Construct fully initialized instance, ready for immediate use.

Throws:
NullPointerException - if coroutine or listener is null
Method Detail

setListener

public void setListener(Listener<T> listener)

Set or reset the listener.

Throws:
NullPointerException - if listener is null

getListener

public Listener<T> getListener()

Get the listener.


setParams

public void setParams(String name,
                      String publicId,
                      String systemId)

Set or reset data to be sent to the DTD handler.


run

public void run()

Execute a callback from the parser thread to run the DTD handler in the application thread. This method is invoked just before the parser starts parsing the actual DTD, and runs until the parser reaches the end of the DTD. The parser is suspended until the DTD handler invokes the parseContent method.

Specified by:
run in interface Runnable
Throws:
CoroutineTransferException - if the DTD handler throws an exception.

parseContent

public final void parseContent()
                        throws ListenerException,
                               IOException
Description copied from interface: CurrentDtd

Parse the content of a Dtd.

This method causes the parser to continue operation, and does not return until the end of the DTD is reached. No part of the Dtd has been parsed before this method is invoked. After this method returns, the DTD is available from <>, until the end of the document is reached.

Specified by:
parseContent in interface CurrentDtd
Throws:
ListenerException
IOException

getDocTypeName

public String getDocTypeName()
Description copied from interface: Dtd

Get the document type name.

Specified by:
getDocTypeName in interface Dtd
Returns:
the document type name.

getPublicId

public String getPublicId()
Description copied from interface: Dtd

Get the public identifier for the external DTD subset.

Specified by:
getPublicId in interface Dtd
Returns:
the declared public identifier for the external DTD subset, or null if none was declared.

getSystemId

public String getSystemId()
Description copied from interface: Dtd

Get the system identifier for the external DTD subset.

Specified by:
getSystemId in interface Dtd
Returns:
the declared system identifier for the external DTD subset, or null if none was declared.

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License