| java.lang.Object org.xml.sax.helpers.DefaultHandler org.griphyn.vdl.euryale.DAXParser
DAXParser | public class DAXParser extends DefaultHandler (Code) | | This class uses the xerces SAX2 parser to validate and parse an DAX
document. This class extends the xerces DefaultHandler so that we
only need to override callbacks of interest.
author: Kavitha Ranganathan author: Jens-S. Vöckler author: Yong Zhao version: $Revision: 460 $ |
Constructor Summary | |
public | DAXParser(String schemaLocation) The class constructor initializes the Xerces parser, sets the
classes that hold the callback functions, and the features that
enable schema validation. |
Method Summary | |
public void | characters(char[] ch, int start, int length) This method is the callback function for characters in an element. | public void | createElementObject(String e, java.util.List names, java.util.List values) This method finds out what is the current element, creates the
java object that corresponds to the element, and sets the member
variables with the values of the attributes of the element. | public void | elementCharacters(String elementChars) This method sets the content of the java object corresponding to
the element "text", which has mixed content. | public void | endDocument() The parser comes to the end of the document. | public void | endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) The parser is at the end of an element. | public void | endPrefixMapping(java.lang.String prefix) Out of the reach of the prefix, remove it from the HashMap. | public Callback | getCallback() Obtains the current instance to be used for callbacks. | public void | ignorableWhitespace(char[] ch, int start, int length) Currently, ignorable whitespace will be ignored. | public boolean | parse(String daxURI) This function parses a DAX source (could be a document, a stream,
etc.), and creates java class instances that correspond to the DAX.
These will provided to the callback functions instead of being
collected here in memory.
Parameters: daxURI - is the URI for the DAX source. | public boolean | parse(InputStream stream) This function parses a DAX source (could be a document, a stream,
etc.), and creates java class instances that correspond to the DAX.
These will provided to the callback functions instead of being
collected here in memory.
Parameters: stream - is an input stream for the DAX source. | public void | processingInstruction(java.lang.String target, java.lang.String data) Receive a processing instruction. | public void | setCallback(Callback callback) Sets a new callback object to use for future callbacks. | public void | setDocumentLocator(Locator locator) Obtains the document locator from the parser. | public void | setElementRelation(String elementName) This method sets the relations between the current java object
and its parent object according to the element hierarchy. | public void | setSchemaLocations(String list) Set the list of external real locations where the XML schema may be found.
Since this list can be determined at run-time through properties etc., we
expect this function to be called between instantiating the parser, and
using the parser.
Parameters: list - is a list of strings representing schema locations. | public void | skippedEntity(java.lang.String name) Receive a notification that an entity was skipped. | public void | startDocument() This method specifies what to do when the parser is at the beginning
of the document. | public void | startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) This method defines the action to take when the parser begins to parse
an element. | public void | startPrefixMapping(java.lang.String prefix, java.lang.String uri) There is a prefix or namespace defined, put the prefix and its URI
in the HashMap. |
TAG_ADAG | final static int TAG_ADAG(Code) | | |
TAG_ARGUMENT | final static int TAG_ARGUMENT(Code) | | |
TAG_OTHER | final static int TAG_OTHER(Code) | | |
TAG_PROFILE | final static int TAG_PROFILE(Code) | | |
DAXParser | public DAXParser(String schemaLocation)(Code) | | The class constructor initializes the Xerces parser, sets the
classes that hold the callback functions, and the features that
enable schema validation.
Parameters: schemaLocation - is any URI pointing to the XML schema definition. |
characters | public void characters(char[] ch, int start, int length) throws SAXException(Code) | | This method is the callback function for characters in an element.
The element should be mixed-content.
Parameters: ch - are the characters from the XML document Parameters: start - is the start position into the array Parameters: length - is the amount of valid data in the array |
createElementObject | public void createElementObject(String e, java.util.List names, java.util.List values) throws IllegalArgumentException(Code) | | This method finds out what is the current element, creates the
java object that corresponds to the element, and sets the member
variables with the values of the attributes of the element.
Parameters: e - is the name of the element Parameters: names - is a list of attribute names, as strings. Parameters: values - is a list of attribute values, to match the key list. |
elementCharacters | public void elementCharacters(String elementChars)(Code) | | This method sets the content of the java object corresponding to
the element "text", which has mixed content.
See Also: org.griphyn.vdl.classes.Text |
endDocument | public void endDocument()(Code) | | The parser comes to the end of the document.
|
endElement | public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws SAXException(Code) | | The parser is at the end of an element. Each successfully and
completely parsed Definition will trigger a callback to the
registered DefinitionHandler.
Parameters: namespaceURI - is the URI of the namespace for the element Parameters: localName - is the element name without namespace Parameters: qName - is the element name as it appears in the docment |
endPrefixMapping | public void endPrefixMapping(java.lang.String prefix) throws SAXException(Code) | | Out of the reach of the prefix, remove it from the HashMap.
Parameters: prefix - is the prefix that was being mapped previously. |
ignorableWhitespace | public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException(Code) | | Currently, ignorable whitespace will be ignored.
Parameters: ch - are the characters from the XML document Parameters: start - is the start position into the array Parameters: length - is the amount of valid data in the array |
parse | public boolean parse(String daxURI)(Code) | | This function parses a DAX source (could be a document, a stream,
etc.), and creates java class instances that correspond to the DAX.
These will provided to the callback functions instead of being
collected here in memory.
Parameters: daxURI - is the URI for the DAX source. true for valid parsing, false if an error occurred. |
parse | public boolean parse(InputStream stream)(Code) | | This function parses a DAX source (could be a document, a stream,
etc.), and creates java class instances that correspond to the DAX.
These will provided to the callback functions instead of being
collected here in memory.
Parameters: stream - is an input stream for the DAX source. true for valid parsing, false if an error occurred. |
processingInstruction | public void processingInstruction(java.lang.String target, java.lang.String data) throws SAXException(Code) | | Receive a processing instruction. Currently, we are just printing
a debug message that we received a PI.
Parameters: target - the processing instruction target Parameters: data - the processing instruction data, or null if none was supplied.The data does not include any whitespace separating it from the target. |
setCallback | public void setCallback(Callback callback)(Code) | | Sets a new callback object to use for future callbacks.
Parameters: callback - is the new callback object. See Also: DAXParser.getCallback() |
setDocumentLocator | public void setDocumentLocator(Locator locator)(Code) | | Obtains the document locator from the parser. The document location
can be used to print debug information, i.e the current location
(line, column) in the document.
Parameters: locator - is the externally set current position |
setElementRelation | public void setElementRelation(String elementName)(Code) | | This method sets the relations between the current java object
and its parent object according to the element hierarchy.
Usually it involves adding the object to the parent's child object
list.
|
setSchemaLocations | public void setSchemaLocations(String list)(Code) | | Set the list of external real locations where the XML schema may be found.
Since this list can be determined at run-time through properties etc., we
expect this function to be called between instantiating the parser, and
using the parser.
Parameters: list - is a list of strings representing schema locations. The contentexists in pairs, one of the namespace URI, one of the location URL. |
skippedEntity | public void skippedEntity(java.lang.String name) throws SAXException(Code) | | Receive a notification that an entity was skipped. Currently, we
are just printing a debug message to this fact.
Parameters: name - The name of the skipped entity. If it is a parameterentity, the name will begin with '%', and if it is the external DTDsubset, it will be the string "[dtd]". |
startDocument | public void startDocument()(Code) | | This method specifies what to do when the parser is at the beginning
of the document. In this case, we simply print a message for debugging.
|
startElement | public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) throws SAXException(Code) | | This method defines the action to take when the parser begins to parse
an element.
Parameters: namespaceURI - is the URI of the namespace for the element Parameters: localName - is the element name without namespace Parameters: qName - is the element name as it appears in the docment Parameters: atts - has the names and values of all the attributes |
startPrefixMapping | public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws SAXException(Code) | | There is a prefix or namespace defined, put the prefix and its URI
in the HashMap. We can get the URI when the prefix is used here after.
Parameters: prefix - the Namespace prefix being declared. Parameters: uri - the Namespace URI the prefix is mapped to. |
Methods inherited from org.xml.sax.helpers.DefaultHandler | public void characters(char ch, int start, int length) throws SAXException(Code)(Java Doc) public void endDocument() throws SAXException(Code)(Java Doc) public void endElement(String uri, String localName, String qName) throws SAXException(Code)(Java Doc) public void endPrefixMapping(String prefix) throws SAXException(Code)(Java Doc) public void error(SAXParseException e) throws SAXException(Code)(Java Doc) public void fatalError(SAXParseException e) throws SAXException(Code)(Java Doc) public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code)(Java Doc) public void notationDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc) public void processingInstruction(String target, String data) throws SAXException(Code)(Java Doc) public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException(Code)(Java Doc) public void setDocumentLocator(Locator locator)(Code)(Java Doc) public void skippedEntity(String name) throws SAXException(Code)(Java Doc) public void startDocument() throws SAXException(Code)(Java Doc) public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException(Code)(Java Doc) public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)(Java Doc) public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException(Code)(Java Doc) public void warning(SAXParseException e) throws SAXException(Code)(Java Doc)
|
|
|