|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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:
XMLParser
Method Summary | |
java.io.InputStream |
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.InputStream |
resolveDTDEntity(java.lang.String name,
java.lang.String pubID,
java.lang.String sysID)
This method is called to obtain an external DTD. |
java.io.InputStream |
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 |
public void recordNotationDeclaration(java.lang.String name, java.lang.String pubID, java.lang.String sysID) throws ParseException
name
- the name of the notationpubID
- the public ID of the notation if it was specified or null otherwisesysID
- the system ID (typically filename) of the notation (or null if unspecified)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
name
- the name assigned to this entityvalue
- the replacement text of this entitypubID
- the public ID of the entities replacement text (or null if unspecified)sysID
- the system ID of the entities replacement text (or null if unspecified)notation
- specifies the notation associated with this entity (null if entity to be parsed as XML)public void recordElementDeclaration(java.lang.String name, java.lang.String content) throws ParseException
name
- the tag name given to this elementcontent
- a regexp-like expression which specifies which elements and character data may appear within this elementpublic 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
element
- the element to which this attribute appliesattr
- the name of the attribute being described by this declarationnotation
- the notation (if any) which applies to this attributetype
- the type of value defined by this attributedefmod
- describes the nature of this attributes default value (one of 'FIXED', 'REQUIRED', 'IMPLIED' - as per XML spec - or 'DEFAULT' indicating a 'basic' default value)def
- the default value of this attribute (may be null, indicating no default specified)public void recordDoctypeDeclaration(java.lang.String name, java.lang.String pubID, java.lang.String sysID) throws ParseException
name
- the name of the document typepubID
- the public ID of the document type (may be null)sysID
- the system ID of the document type (null if no external DTD is specified)public void recordDocStart()
public void recordDocEnd()
public void recordElementStart(java.lang.String name, java.util.Hashtable attr) throws ParseException
name
- the name of the element (tag name)attr
- a hashtable containing the explicitly supplied attributes (as strings)public void recordElementEnd(java.lang.String name) throws ParseException
name
- the name of the element (tag) being closedpublic void recordPI(java.lang.String name, java.lang.String value) throws ParseException
name
- the name of the program instructionvalue
- the data associated with this program instructionpublic void recordCharData(java.lang.String charData)
charData
- character data from the document.public void recordComment(java.lang.String comment)
public java.io.InputStream getDocumentStream() throws ParseException
public java.io.InputStream resolveExternalEntity(java.lang.String name, java.lang.String pubID, java.lang.String sysID) throws ParseException
name
- the name of the entity to be retrieved.pubID
- the public ID of the entity (may be null)sysID
- the system ID of the entitypublic java.io.InputStream resolveDTDEntity(java.lang.String name, java.lang.String pubID, java.lang.String sysID) throws ParseException
name
- the name of the DTDpubID
- its public ID (may be null)sysID
- its system ID
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |