| java.lang.Object org.griphyn.vdl.parser.VDLxParser
VDLxParser | public class VDLxParser (Code) | | This class uses the Xerces SAX2 parser to validate and parse an XML
document. The content handler VDLContentHandler and
error handler VDLErrorHandler are necessary to handle
various callbacks.
author: Jens-S. Vöckler author: Yong Zhao version: $Revision: 50 $ See Also: VDLContentHandler See Also: VDLErrorHandler |
Constructor Summary | |
public | VDLxParser(String schemaLocation) The class constructor. |
Method Summary | |
public java.util.List | parse(java.io.InputStream reader, Definitions definitions, boolean overwrite, boolean dontcare) 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. Parameters: definitions - is a reference to the already known definitions inthe system. | public boolean | parse(InputSource reader, DefinitionHandler callback) This function parses an XML source (could be a document, a stream,
etc.), and creates java class instances that correspond to
different elements in the XML source. | public boolean | parse(InputSource reader, FinalizerHandler callback) This function parses an XML source (could be a document, a stream,
etc.), and invokes a callback for the top-level element with the
corresponding Java class. | public void | setDefaultSchemaLocation(String location) Sets the list of external real locations where the XML schema may
be found when no namespace is active. | public void | setSchemaLocations(String list) Sets the list of external real locations where the XML schema may
be found. |
vendorParserClass | final protected static String vendorParserClass(Code) | | Default parser is the Xerces parser.
|
VDLxParser | public VDLxParser(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. |
parse | public java.util.List parse(java.io.InputStream reader, Definitions definitions, boolean overwrite, boolean dontcare)(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. Parameters: definitions - is a reference to the already known definitions inthe system. The definitions may be empty, but must not be null. Parameters: overwrite - is a flag to indicate the insertion mode. If set to false , an insert mode is assumed. Violations will bereturned as clashes. With value true , an update mode is assumed. Old definitions of updates will be returned. Parameters: dontcare - is a flag to minimize memory consumption. Clashes ininsert mode will be signalled with an Exception. Old values in updatemode will be ignored. Effectively, the resulting list is always emptyin dontcare mode. usually an empty list. If not empty, it contains clashes ininsert, or old definitions in update mode. Please note that eachelement is a single Definition, either Transformation orDerivation. It is not a Definitions object, since multiple oldversions may appear in update mode. Returns null on error! See Also: org.griphyn.vdl.classes.Definitions See Also: |
parse | public boolean parse(InputSource reader, DefinitionHandler callback)(Code) | | This function parses an XML source (could be a document, a stream,
etc.), and creates java class instances that correspond to
different elements in the XML source.
Parameters: reader - is an XML input source, which may be a character stream,byte stream, or even an URI. Parameters: callback - is a handler for store callbacks that will takeone complete definition each time one is ready to be processed. true for successful parsing, false in case of error. See Also: org.griphyn.vdl.classes.Definitions See Also: |
parse | public boolean parse(InputSource reader, FinalizerHandler callback)(Code) | | This function parses an XML source (could be a document, a stream,
etc.), and invokes a callback for the top-level element with the
corresponding Java class. Note: The finalizer cannot be called for
Definitions elements. This method should be used for "partial VDLx",
which contains XML for a Transformation or Derivation.
Parameters: reader - is an XML input source, which may be a character stream,byte stream, or even an URI. Parameters: callback - is a handler for store callbacks that will takeone complete definition. true for successful parsing, false in case of error. See Also: org.griphyn.vdl.classes.Definitions See Also: |
setDefaultSchemaLocation | public void setDefaultSchemaLocation(String location)(Code) | | Sets the list of external real locations where the XML schema may
be found when no namespace is active. Only one location can be
specified. We expect this function to be called between
instantiating the parser, and using the parser.
Parameters: location - is the location of the schema file (location URL). |
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. |
|
|