| java.lang.Object org.xml.sax.helpers.DefaultHandler org.griphyn.vdl.parser.InvocationParser
InvocationParser | public class InvocationParser extends DefaultHandler (Code) | | This class uses the Xerces SAX2 parser to validate and parse an XML
document which contains information from kickstart generated
invocation record.
author: Jens-S. Vöckler author: Yong Zhao version: $Revision: 50 $ |
Method Summary | |
public void | characters(char[] ch, int start, int length) This method is the callback function for characters in an element. | protected Invocation | createObject(String e, java.util.List names, java.util.List values) This method determines the actively parsed 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. | 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 void | ignorableWhitespace(char[] ch, int start, int length) Currently, ignorable whitespace will be ignored. | public InvocationRecord | parse(java.io.InputStream reader) This function parses a XML source from an InputStream source, and
creates java class instances that correspond to different elements
in the XML source.
Parameters: reader - is a bytestream opened for reading. | public InvocationRecord | parse(java.io.Reader reader) This function parses a XML source from the new Reader source, and
creates java class instances that correspond to different elements
in the XML source.
Parameters: reader - is a character stream opened for reading. | public void | processingInstruction(java.lang.String target, java.lang.String data) Receive a processing instruction. | public void | setDocumentLocator(Locator locator) Obtains the document locator from the parser. | protected boolean | setElementRelation(char initial, Invocation parent, Invocation child) This method sets the relations between the currently finished XML
element and its containing element in terms of Java objects. | public void | setSchemaLocations(String list) Sets the list of external real locations where the XML schema may
be found. | 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. |
vendorParserClass | final protected static String vendorParserClass(Code) | | Default parser is the Xerces parser.
|
InvocationParser | public InvocationParser(String schemaLocation)(Code) | | The class constructor. This function initializes the Xerces parser
and the features that enable schema validation.
Parameters: schemaLocation - is the default location of the XML Schemawhich this parser is capable of parsing. It may be null to usethe defaults provided in the document. |
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 is expected to be of 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 |
createObject | protected Invocation createObject(String e, java.util.List names, java.util.List values) throws IllegalArgumentException(Code) | | This method determines the actively parsed 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. A new VDL Java object, which may only be partly constructed. exception: IllegalArgumentException - if the element name is too short. |
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 InvocationRecord parse(java.io.InputStream reader)(Code) | | This function parses a XML source from an InputStream source, and
creates java class instances that correspond to different elements
in the XML source.
Parameters: reader - is a bytestream opened for reading. the records with the invocation information, or null on failure. |
parse | public InvocationRecord parse(java.io.Reader reader)(Code) | | This function parses a XML source from the new Reader source, and
creates java class instances that correspond to different elements
in the XML source.
Parameters: reader - is a character stream opened for reading. the records with the invocation information, or null on failure. |
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. |
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 | protected boolean setElementRelation(char initial, Invocation parent, Invocation child)(Code) | | This method sets the relations between the currently finished XML
element and its containing element in terms of Java objects.
Usually it involves adding the object to the parent's child object
list.
Parameters: initial - is the first charactor of the parent element name Parameters: parent - is a reference to the parent's Java object Parameters: child - is the completed child object to connect to the parent true if the element was added successfully, false, if thechild does not match into the parent. |
setSchemaLocations | public void setSchemaLocations(String list)(Code) | | Sets 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. Thecontent exists in pairs, one of the namespace URI, one of thelocation 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)
|
|
|