|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.griphyn.vdl.euryale.DAXParser
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.
| Field Summary | |
private Callback |
m_callback
Maintains the callback class to provide the information to. |
private String |
m_child
maintains the currently viewed section 3 child element. |
private int |
m_depth
maintain the hierarchy for some debug printing |
private Map |
m_forward
A Hashmap to forward resolve namespaces that were encountered during parsing. |
private Job |
m_job
collects the information for a section 2 job element. |
private Locator |
m_location
Keep the location within the document |
private Logging |
m_log
Obtain our logger once for multiple uses. |
private List |
m_parent
collects the parents associated with a particular child. |
private XMLReader |
m_parser
our own instance of the SAX parser. |
private Profile |
m_profile
collects the leaves for a profile that is part of a job. |
private Map |
m_reverse
A Hashmap to reverse resolve namespaces that were encountered during parsing. |
private int |
m_tag
maintains the indications which parent element to be used whenever a filename tag is being encountered. |
(package private) static int |
TAG_ADAG
|
(package private) static int |
TAG_ARGUMENT
|
(package private) static int |
TAG_OTHER
|
(package private) static int |
TAG_PROFILE
|
private static String |
vendorParserClass
class name of the SAX parser. |
| Constructor Summary | |
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 | |
void |
characters(char[] ch,
int start,
int length)
This method is the callback function for characters in an element. |
private void |
complain(String subject,
String name,
String value)
Small helper method to bundle repetitive complaints in a template for reporting progress. |
void |
createElementObject(String e,
List names,
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. |
void |
elementCharacters(String elementChars)
This method sets the content of the java object corresponding to the element "text", which has mixed content. |
void |
endDocument()
The parser comes to the end of the document. |
void |
endElement(String namespaceURI,
String localName,
String qName)
The parser is at the end of an element. |
void |
endPrefixMapping(String prefix)
Out of the reach of the prefix, remove it from the HashMap. |
Callback |
getCallback()
Obtains the current instance to be used for callbacks. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Currently, ignorable whitespace will be ignored. |
private void |
log(String subject,
String name,
String value)
Small helper method to bundle repetitive parameters in a template for reporting progress. |
private String |
map(String uri)
Helper function to map prefixes correctly onto the elements. |
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. |
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. |
void |
processingInstruction(String target,
String data)
Receive a processing instruction. |
private boolean |
set(String uri,
boolean flag)
Sets a feature while capturing failed features right here. |
void |
setCallback(Callback callback)
Sets a new callback object to use for future callbacks. |
void |
setDocumentLocator(Locator locator)
Obtains the document locator from the parser. |
void |
setElementRelation(String elementName)
This method sets the relations between the current java object and its parent object according to the element hierarchy. |
void |
setSchemaLocations(String list)
Set the list of external real locations where the XML schema may be found. |
void |
skippedEntity(String name)
Receive a notification that an entity was skipped. |
void |
startDocument()
This method specifies what to do when the parser is at the beginning of the document. |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
This method defines the action to take when the parser begins to parse an element. |
void |
startPrefixMapping(String prefix,
String uri)
There is a prefix or namespace defined, put the prefix and its URI in the HashMap. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static String vendorParserClass
private XMLReader m_parser
private int m_depth
private Job m_job
private Profile m_profile
private String m_child
private List m_parent
private int m_tag
static final int TAG_ADAG
static final int TAG_ARGUMENT
static final int TAG_PROFILE
static final int TAG_OTHER
private Locator m_location
private Map m_forward
private Map m_reverse
private Logging m_log
private Callback m_callback
| Constructor Detail |
public DAXParser(String schemaLocation)
schemaLocation - is any URI pointing to the XML schema definition.| Method Detail |
private boolean set(String uri,
boolean flag)
uri - is the feature's URI to modifyflag - is the new value to set.
public Callback getCallback()
setCallback( Callback )public void setCallback(Callback callback)
callback - is the new callback object.getCallback()public void setSchemaLocations(String list)
list - is a list of strings representing schema locations. The content
exists in pairs, one of the namespace URI, one of the location URL.public boolean parse(String daxURI)
daxURI - is the URI for the DAX source.
public boolean parse(InputStream stream)
stream - is an input stream for the DAX source.
public void setDocumentLocator(Locator locator)
locator - is the externally set current positionpublic void startDocument()
public void endDocument()
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
prefix - the Namespace prefix being declared.uri - the Namespace URI the prefix is mapped to.
SAXException
public void endPrefixMapping(String prefix)
throws SAXException
prefix - is the prefix that was being mapped previously.
SAXExceptionprivate String map(String uri)
uri - is the parser-returned URI that needs translation.
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException
namespaceURI - is the URI of the namespace for the elementlocalName - is the element name without namespaceqName - is the element name as it appears in the docmentatts - has the names and values of all the attributes
SAXException
public void endElement(String namespaceURI,
String localName,
String qName)
throws SAXException
namespaceURI - is the URI of the namespace for the elementlocalName - is the element name without namespaceqName - is the element name as it appears in the docment
SAXException
public void characters(char[] ch,
int start,
int length)
throws SAXException
ch - are the characters from the XML documentstart - is the start position into the arraylength - is the amount of valid data in the array
SAXException
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ch - are the characters from the XML documentstart - is the start position into the arraylength - is the amount of valid data in the array
SAXException
public void processingInstruction(String target,
String data)
throws SAXException
target - the processing instruction targetdata - the processing instruction data, or null if none was supplied.
The data does not include any whitespace separating it from the target.
SAXException
public void skippedEntity(String name)
throws SAXException
name - The name of the skipped entity. If it is a parameter
entity, the name will begin with '%', and if it is the external DTD
subset, it will be the string "[dtd]".
SAXException
private void log(String subject,
String name,
String value)
subject - is the name of the XML element that is being scrutinized.name - is then name of the element we are working with.value - is the attribute value.
private void complain(String subject,
String name,
String value)
subject - is the name of the XML element that is being scrutinized.name - is then name of the element we are working with.value - is the attribute value.
public void createElementObject(String e,
List names,
List values)
throws IllegalArgumentException
e - is the name of the elementnames - is a list of attribute names, as strings.values - is a list of attribute values, to match the key list.
IllegalArgumentExceptionpublic void setElementRelation(String elementName)
public void elementCharacters(String elementChars)
Text
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||