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

Quick Search    Search Deep

pbn.xmlparse.xml
Interface XMLResponder  view XMLResponder download XMLResponder.java


public interface XMLResponder

Interface which must be implemented by any XML application which wishes to use the XMLParser class. It consists of a set of call back methods which are called by the XML parser when specific XML entities are encountered.

Very few of the methods return a value. Of those that do, only the DocumentStream method actually needs to return a non-null value. This makes the interface very easy to implement.

For developers unfamiliar with the concepts or terminology of XML, an introductory document on XML may help to explain some of the terms used in this documentation.

This paragraph describes the order in which the methods may be called. The getDocumentStream is always the first method called, followed by the recordDocStart method, after which comments and PI's may be received at any time until recordDocEnd method is called. All 'declaration' method calls are guaranteed to occur before any call to recordDocTypeDeclaration which is called after both the internal and external DTD's (if they existed) have been sucessfully parsed. no DTD related methods are called after the first call to recordElementStart. Each such method call is matched with a call to recordElementEnd. Character data will only be received within some element (ie. after the first element start and before the last element end). Contiguous character data may be reported in repeated calls to recordCharData.

All callbacks are made on the single thread used to start the parsing.

All character data supplied to the parser by this interface must be supplied in one of the following encodings:

Version:
0.7

Method Summary
 java.io.StringReader getDocumentStream()
          This method is always called exactly once, before all other callbacks.
 void recordAttlistDeclaration(java.lang.String element, java.lang.String attr, boolean notation, java.lang.String type, java.lang.String defmod, java.lang.String def)
          This method is called when an attribute definition is parsed from an attlist tag in a DTD.
 void recordCharData(java.lang.String charData)
          This method is called to return character data to the application.
 void recordComment(java.lang.String comment)
          This method is called to return comments to the application.
 void recordDocEnd()
          This method is called to indicate that the document stream has been successfully closed.
 void recordDocStart()
          This method is called to indicate that the document stream has been opened successfully.
 void recordDoctypeDeclaration(java.lang.String name, java.lang.String pubID, java.lang.String sysID)
          This method is called after all the DTD related information is has been passed back.
 void recordElementDeclaration(java.lang.String name, java.lang.String content)
          This method is called when an element declaration is met in a DTD.
 void recordElementEnd(java.lang.String name)
          This method is called to indicate the closure of an element (tag).
 void recordElementStart(java.lang.String name, java.util.Hashtable attr)
          This method is called to indicate the start of an element (tag).
 void recordEntityDeclaration(java.lang.String name, java.lang.String value, java.lang.String pubID, java.lang.String sysID, java.lang.String notation)
          This method is called whenever an general entity declaration is parsed from a DTD.
 void recordNotationDeclaration(java.lang.String name, java.lang.String pubID, java.lang.String sysID)
          This method is called whenever a notation is parsed from a DTD.
 void recordPI(java.lang.String name, java.lang.String value)
          This method is called to passback program instructions to the application.
 java.io.StringReader resolveDTDEntity(java.lang.String name, java.lang.String pubID, java.lang.String sysID)
          This method is called to obtain an external DTD.
 java.io.StringReader resolveExternalEntity(java.lang.String name, java.lang.String pubID, java.lang.String sysID)
          This method is called when an external entity must be resolved for insertion into the document its DTD.
 

Method Detail

recordNotationDeclaration

public void recordNotationDeclaration(java.lang.String name,
                                      java.lang.String pubID,
                                      java.lang.String sysID)
                               throws ParseException
This method is called whenever a notation is parsed from a DTD.


recordEntityDeclaration

public void recordEntityDeclaration(java.lang.String name,
                                    java.lang.String value,
                                    java.lang.String pubID,
                                    java.lang.String sysID,
                                    java.lang.String notation)
                             throws ParseException
This method is called whenever an general entity declaration is parsed from a DTD. Most applications will have no use for this information.


recordElementDeclaration

public void recordElementDeclaration(java.lang.String name,
                                     java.lang.String content)
                              throws ParseException
This method is called when an element declaration is met in a DTD. Most applications will have no use for this information.


recordAttlistDeclaration

public void recordAttlistDeclaration(java.lang.String element,
                                     java.lang.String attr,
                                     boolean notation,
                                     java.lang.String type,
                                     java.lang.String defmod,
                                     java.lang.String def)
                              throws ParseException
This method is called when an attribute definition is parsed from an attlist tag in a DTD. Applications may wish to record these definitions to apply default values to element tags.


recordDoctypeDeclaration

public void recordDoctypeDeclaration(java.lang.String name,
                                     java.lang.String pubID,
                                     java.lang.String sysID)
                              throws ParseException
This method is called after all the DTD related information is has been passed back. It supplies information about the document type applied to the document.


recordDocStart

public void recordDocStart()
This method is called to indicate that the document stream has been opened successfully.


recordDocEnd

public void recordDocEnd()
This method is called to indicate that the document stream has been successfully closed.


recordElementStart

public void recordElementStart(java.lang.String name,
                               java.util.Hashtable attr)
                        throws ParseException
This method is called to indicate the start of an element (tag).


recordElementEnd

public void recordElementEnd(java.lang.String name)
                      throws ParseException
This method is called to indicate the closure of an element (tag).


recordPI

public void recordPI(java.lang.String name,
                     java.lang.String value)
              throws ParseException
This method is called to passback program instructions to the application.


recordCharData

public void recordCharData(java.lang.String charData)
This method is called to return character data to the application. As per the XML specification, newlines on all platforms are converted to single 0x0A's. Contiguous character data may be returned with successive calls to this method.


recordComment

public void recordComment(java.lang.String comment)
This method is called to return comments to the application. Most applications will have no use for this information. param comment the contents of the comment tag


getDocumentStream

public java.io.StringReader getDocumentStream()
                                       throws ParseException
This method is always called exactly once, before all other callbacks. It is used to retrieve an StringReader from which the XML document will be parsed. This method may not return null.


resolveExternalEntity

public java.io.StringReader resolveExternalEntity(java.lang.String name,
                                                  java.lang.String pubID,
                                                  java.lang.String sysID)
                                           throws ParseException
This method is called when an external entity must be resolved for insertion into the document its DTD. This method may return null as an indication that the application declines to retrieve the entity.


resolveDTDEntity

public java.io.StringReader resolveDTDEntity(java.lang.String name,
                                             java.lang.String pubID,
                                             java.lang.String sysID)
                                      throws ParseException
This method is called to obtain an external DTD. Most applications will simply refer this call to the resolveExternalEntity method. This separate callback method is made available, should the application need to resolve the ID's differently.