| java.lang.Object org.xml.sax.helpers.DefaultHandler org.griphyn.cPlanner.parser.Parser
All known Subclasses: org.griphyn.cPlanner.parser.PDAXParser, org.griphyn.cPlanner.parser.ConfigXmlParser, org.griphyn.cPlanner.parser.DaxParser,
Parser | abstract public class Parser extends DefaultHandler (Code) | | This is the base class which all the xml parsing classes extend.
It initializes the xml parser namely Xerces, sets it's various features
like turning on validation against schema etc, plus the namespace resolution.
author: Karan Vahi author: Gaurang Mehta version: $Revision: 50 $ |
Field Summary | |
final protected String | DEFAULT_PARSER_NAME Default parser name. | protected boolean | mAdjFName Boolean flag to ensure that two adjacent filenames are separated by a
whitespace. | protected Locator | mLocator Locator object to determine on which line in the xml has the error
occured. | protected String | mLogMsg The String which contains the messages to be logged. | protected LogManager | mLogger The LogManager object which logs the Pegasus messages. | protected XMLReader | mParser The object which is used to parse the dax. | protected PegasusProperties | mProps The object holding all the properties pertaining to Pegasus. | protected StringBuffer | mTextContent Holds the text in an element (text between start and final tags if any). | protected String | mTextString A String that holds the contents of data passed as text. |
Method Summary | |
public void | characters(char[] chars, int start, int length) This is used to store the character data that is in xml. | abstract public void | endDocument() This is called automatically when the end of the XML file is reached. | abstract public void | endElement(String uri, String localName, String qName) An empty implementation is provided by DefaultHandler class. | abstract public String | getSchemaLocation() Helps the load database to locate the VDLx XML schema, if available.
Please note that the schema location URL in the instance document
is only a hint, and may be overriden by the findings of this method.
a location pointing to a definition document of the XMLschema that can read VDLx. | public String | ignoreWhitespace(String str) Our own implementation for ignorable whitespace. | public void | setDocumentLocator(Locator loc) Overrides the empty implementation provided by Default Handler and sets
the locator variable for the locator. | public boolean | setParserFeature(String uri, boolean flag) Sets a parser feature, and fails here enabling us to set all the following
features.
Parameters: uri - is the feature's URI to modify Parameters: flag - is the new value to set. | public void | setSchemaLocations(String list) 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. | abstract public void | startElement(String uri, String local, String raw, Attributes attrs) An empty implementation is provided by DefaultHandler of ContentHandler.
This method receives the notification from the sacks parser when start
tag of an element comes. | abstract public void | startParser(String file) Start the parser. | public void | testForFile(String file) Tests whether the file exists or not. |
DEFAULT_PARSER_NAME | final protected String DEFAULT_PARSER_NAME(Code) | | Default parser name. Using Xerces at present.
|
mAdjFName | protected boolean mAdjFName(Code) | | Boolean flag to ensure that two adjacent filenames are separated by a
whitespace.
|
mLocator | protected Locator mLocator(Code) | | Locator object to determine on which line in the xml has the error
occured.
|
mLogMsg | protected String mLogMsg(Code) | | The String which contains the messages to be logged.
|
mLogger | protected LogManager mLogger(Code) | | The LogManager object which logs the Pegasus messages.
|
mParser | protected XMLReader mParser(Code) | | The object which is used to parse the dax. This reads the XML document
and sends it to the event handlers.
|
mTextContent | protected StringBuffer mTextContent(Code) | | Holds the text in an element (text between start and final tags if any).
Used in case of elements of mixed type.
|
mTextString | protected String mTextString(Code) | | A String that holds the contents of data passed as text. The string
should only be trimmed when the appropriate end tag of the element is
invoked. At this point, a whitespace is added if there are whitespaces in
at the ends.
|
Parser | public Parser(PegasusProperties properties)(Code) | | Intialises the parser. Sets the various features. However the parsing is
done in the implementing class, by call mParser.parse(filename).
Parameters: properties - the PegasusProperties to be used. |
characters | public void characters(char[] chars, int start, int length)(Code) | | This is used to store the character data that is in xml. An implementation
of the interface for the Sacks parser.
|
endDocument | abstract public void endDocument()(Code) | | This is called automatically when the end of the XML file is reached.
|
endElement | abstract public void endElement(String uri, String localName, String qName)(Code) | | An empty implementation is provided by DefaultHandler class. This method
is called automatically by the Sax parser when the end tag of an element
comes in the xml file. Any parser class should implement this method
|
getSchemaLocation | abstract public String getSchemaLocation()(Code) | | Helps the load database to locate the VDLx XML schema, if available.
Please note that the schema location URL in the instance document
is only a hint, and may be overriden by the findings of this method.
a location pointing to a definition document of the XMLschema that can read VDLx. Result may be null, if such a documentis unknown or unspecified. |
ignoreWhitespace | public String ignoreWhitespace(String str)(Code) | | Our own implementation for ignorable whitespace. A String that holds the
contents of data passed as text by the underlying parser. The whitespaces
at the end are replaced by one whitespace.
Parameters: str - The string that contains whitespaces. String corresponding to the trimmed version. |
setDocumentLocator | public void setDocumentLocator(Locator loc)(Code) | | Overrides the empty implementation provided by Default Handler and sets
the locator variable for the locator.
Parameters: loc - the Locator object which keeps the track as to the linenumbers of the line being parsed. |
setParserFeature | public boolean setParserFeature(String uri, boolean flag)(Code) | | Sets a parser feature, and fails here enabling us to set all the following
features.
Parameters: uri - is the feature's URI to modify Parameters: flag - is the new value to set. true if the feature could be set, else false foran exception. |
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. The contentexists in pairs, one of the namespace URI, one of the location URL. |
startElement | abstract public void startElement(String uri, String local, String raw, Attributes attrs) throws SAXException(Code) | | An empty implementation is provided by DefaultHandler of ContentHandler.
This method receives the notification from the sacks parser when start
tag of an element comes. Any parser class must implement this method.
|
startParser | abstract public void startParser(String file)(Code) | | Start the parser. This starts the parsing of the file by the parser.
Parameters: file - the path to the XML file you want to parse. |
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)
|
|
|