You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2001/07/09 18:47:48 UTC

cvs commit: xml-xerces/perl/Xerces_headers/parsers DOMParser.hpp

jasons      01/07/09 09:47:48

  Modified:    perl/Xerces_headers/parsers DOMParser.hpp
  Log:
  	* Xerces_headers/parsers/DOMParser.hpp (Repository):
  	Added new schema methods
  	Added overloaded parse(), and parseFirst() methods
  
  Revision  Changes    Path
  1.3       +123 -59   xml-xerces/perl/Xerces_headers/parsers/DOMParser.hpp
  
  Index: DOMParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/Xerces_headers/parsers/DOMParser.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMParser.hpp	2001/05/05 23:04:42	1.2
  +++ DOMParser.hpp	2001/07/09 16:47:42	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DOMParser.hpp,v 1.2 2001/05/05 23:04:42 jasons Exp $
  + * $Id: DOMParser.hpp,v 1.3 2001/07/09 16:47:42 jasons Exp $
    *
    */
   
  @@ -91,13 +91,7 @@
     * <p>It can be used to instantiate a validating or non-validating
     * parser, by setting a member flag.</p>
     */
  -class /*PARSERS_EXPORT*/ DOMParser //:
  -
  -//    public XMLDocumentHandler,
  -//    public XMLErrorReporter,
  -//    public XMLEntityHandler,
  -//    public DocTypeHandler
  -{
  +class /*PARSERS_EXPORT*/ DOMParser :   public XMLDocumentHandler,   public XMLErrorReporter,   public XMLEntityHandler,   public DocTypeHandler {
   public :
       // -----------------------------------------------------------------------
       //  Class types
  @@ -120,7 +114,7 @@
         *
         * Constructor with an instance of validator class to use for
         * validation. If you don't provide a validator, a default one will
  -      * be created for you.
  +      * be created for you in the scanner.
         *
         * @param valToAdopt Pointer to the validator instance to use. The
         *                   parser is responsible for freeing the memory.
  @@ -219,9 +213,35 @@
         * validation scheme set on this parser.
         *
         * @return The ValSchemes value current set on this parser.
  +      * @see #setValidationScheme
         */
       ValSchemes getValidationScheme() const;
   
  +    /** Get the 'do schema' flag
  +      *
  +      * This method returns the state of the parser's schema processing
  +      * flag.
  +      *
  +      * @return true, if the parser is currently configured to
  +      *         understand schema, false otherwise.
  +      *
  +      * @see #setDoSchema
  +      */
  +    bool getDoSchema() const;
  +
  +    /** Get error count from the last parse operation.
  +      *
  +      * This method returns the error count from the last parse
  +      * operation. Note that this count is actually stored in the
  +      * scanner, so this method simply returns what the
  +      * scanner reports.
  +      *
  +      * @return number of errors encountered during the latest
  +      *			parse operation.
  +      *
  +      */
  +    int getErrorCount() const;
  +
       /** Get the 'do namespaces' flag
         *
         * This method returns the state of the parser's namespace processing
  @@ -248,6 +268,18 @@
         */
       bool getExitOnFirstFatalError() const;
   
  +    /**
  +      * This method returns the state of the parser's
  +      * validation-constraint-fatal flag.
  +      *
  +      * @return true, if the parser is currently configured to
  +      *         set validation constraint errors as fatal, false
  +      *         otherwise.
  +      *
  +      * @see #setValidationContraintFatal
  +      */
  +    bool getValidationConstraintFatal() const;
  +
       /** Get the 'expand entity references' flag.
         * DEPRECATED Use getCreateEntityReferenceNodes() instead.
         *
  @@ -303,7 +335,6 @@
         */
       bool getToCreateXMLDeclTypeNode() const;
   
  -
       //@}
   
   
  @@ -384,6 +415,23 @@
         */
       void setExitOnFirstFatalError(const bool newState);
   
  +    /**
  +      * This method allows users to set the parser's behaviour when it
  +      * encounters a validtion constraint error. If set to true, and the
  +      * the parser is set to exit when it encounter the first fatal error,
  +      * the parser will exit at the first encounter. If false, then it will
  +      * report the error and continue processing.
  +      *
  +      * <p>The default value is 'false'.</p>
  +      *
  +      * @param newState The value specifying whether the parser should
  +      *                 continue or exit when it encounters a validation
  +      *                 constraint error.
  +      *
  +      * @see #getValidationConstraintFatal
  +      */
  +    void setValidationConstraintFatal(const bool newState);
  +
       /** Set the 'expand entity references' flag
         *
         * DEPRECATED.  USE setCreateEntityReferenceNodes instead.
  @@ -430,6 +478,9 @@
         * <p>When set to false, all ignorable whitespace will be discarded and
         * no text node is added to the DOM tree.  Note: applications intended
         * to process the "xml:space" attribute should not set this flag to false.
  +      * And this flag also overrides any schema datateye whitespace facets,
  +      * that is, all ignorable whitespace will be discarded even though
  +      * 'preserve' is set in schema datatype whitespace facets.
         *
         * @param include The new state of the include ignorable whitespace
         *                flag.
  @@ -441,16 +492,36 @@
       /**
         * This method allows users to set the validation scheme to be used
         * by this parser. The value is one of the ValSchemes enumerated values
  -      * defined by this class.
  +      * defined by this class:
  +      *
  +      * <br>  Val_Never  - turn off validation
  +      * <br>  Val_Always - turn on validation
  +      * <br>  Val_Auto   - turn on validation if any internal/external
  +      *                  DTD subset have been seen
         *
         * <p>The parser's default state is: Val_Auto.</p>
         *
  -      * @param newState The new validation scheme to use.
  +      * @param newScheme The new validation scheme to use.
         *
         * @see #getValidationScheme
         */
       void setValidationScheme(const ValSchemes newScheme);
   
  +    /** Set the 'do schema' flag
  +      *
  +      * This method allows users to enable or disable the parser's
  +      * schema processing. When set to false, parser will not process
  +      * any schema found.
  +      *
  +      * The parser's default state is: true.
  +      *
  +      * @param newState The value specifying whether schema support should
  +      *                 be enforced or not.
  +      *
  +      * @see #getDoSchema
  +      */
  +    void setDoSchema(const bool newState);
  +
       /**
         * This method allows users to set the toCreateXMLDeclTypeNode flag
         * by this parser. By setting it to 'true' user can have XMLDecl type
  @@ -481,12 +552,12 @@
         *
         * @param source A const reference to the InputSource object which
         *               points to the XML file to be parsed.
  -      * @param reuseValidator The flag indicating whether the existing
  -      *                       validator should be reused or not for this
  -      *                       parsing run.
  +      * @param reuseGrammar The flag indicating whether the existing Grammar
  +      *                     should be reused or not for this parsing run.
  +      *                     If true, there cannot be any internal subset.
         * @see Parser#parse(InputSource)
         */
  -    void parse(const InputSource& source, const bool reuseValidator = false);
  +    void parse(const InputSource& source, const bool reuseGrammar = false);
   
       /** Parse via a file path or URL
         *
  @@ -496,13 +567,13 @@
         *
         * @param systemId A const XMLCh pointer to the Unicode string which
         *                 contains the path to the XML file to be parsed.
  -      * @param reuseValidator The flag indicating whether the existing
  -      *                       validator should be reused or not for this
  -      *                       parsing run.
  +      * @param reuseGrammar The flag indicating whether the existing Grammar
  +      *                     should be reused or not for this parsing run.
  +      *                     If true, there cannot be any internal subset.
         *
         * @see Parser#parse(XMLCh*)
         */
  -//    void parse(const XMLCh* const systemId, const bool reuseValidator = false);
  +//    void parse__overload__1(const XMLCh* /*const*/ systemId, const bool reuseGrammar = false);
   
       /** Parse via a file path or URL (in the local code page)
         *
  @@ -511,11 +582,11 @@
         *
         * @param systemId A const char pointer to a native string which
         *                 contains the path to the XML file to be parsed.
  -      * @param reuseValidator The flag indicating whether the existing
  -      *                       validator should be reused or not for this
  -      *                       parsing run.
  +      * @param reuseGrammar The flag indicating whether the existing Grammar
  +      *                     should be reused or not for this parsing run.
  +      *                     If true, there cannot be any internal subset.
         */
  -//    void parse(const char* const systemId, const bool reuseValidator = false);
  +    void parse__overload__1(const char* /*const*/ systemId, const bool reuseGrammar = false);
   
       /** Begin a progressive parse operation
         *
  @@ -534,9 +605,9 @@
         * @param toFill   A token maintaing state information to maintain
         *                 internal consistency between invocation of 'parseNext'
         *                 calls.
  -      * @param reuseValidator The flag indicating whether the existing
  -      *                 validator should be reused or not for this parsing
  -      *                 process.
  +      * @param reuseGrammar The flag indicating whether the existing Grammar
  +      *                     should be reused or not for this parsing process.
  +      *                     If true, there cannot be any internal subset.
         * @return 'true', if successful in parsing the prolog. It indicates the
         *         user can go ahead with parsing the rest of the file. It
         *         returns 'false' to indicate that the parser could not parse
  @@ -546,12 +617,12 @@
         * @see #parseFirst(char*,...)
         * @see #parseFirst(InputSource&,...)
         */
  -//    bool parseFirst
  -//    (
  -//        const   XMLCh* const    systemId
  -//        ,       XMLPScanToken&  toFill
  -//        , const bool            reuseValidator = false
  -//    );
  +    bool parseFirst
  +    (
  +        const   XMLCh* /*const*/    systemId
  +        ,       XMLPScanToken&  toFill
  +        , const bool            reuseGrammar = false
  +    );
   
       /** Begin a progressive parse operation
         *
  @@ -570,9 +641,9 @@
         * @param toFill   A token maintaing state information to maintain
         *                 internal consistency between invocation of 'parseNext'
         *                 calls.
  -      * @param reuseValidator The flag indicating whether the existing
  -      *                 validator should be reused or not for this parsing
  -      *                 run.
  +      * @param reuseGrammar The flag indicating whether the existing Grammar
  +      *                     should be reused or not for this parsing run.
  +      *                     If true, there cannot be any internal subset.
         *
         * @return 'true', if successful in parsing the prolog. It indicates the
         *         user can go ahead with parsing the rest of the file. It
  @@ -583,12 +654,12 @@
         * @see #parseFirst(XMLCh*,...)
         * @see #parseFirst(InputSource&,...)
         */
  -//    bool parseFirst
  -//    (
  -//        const   char* const     systemId
  -//        ,       XMLPScanToken&  toFill
  -//        , const bool            reuseValidator = false
  -//    );
  +    bool parseFirst__overload__1
  +    (
  +        const   char* /*const*/     systemId
  +        ,       XMLPScanToken&  toFill
  +        , const bool            reuseGrammar = false
  +    );
   
       /** Begin a progressive parse operation
         *
  @@ -607,9 +678,9 @@
         * @param toFill   A token maintaing state information to maintain
         *                 internal consistency between invocation of 'parseNext'
         *                 calls.
  -      * @param reuseValidator The flag indicating whether the existing
  -      *                 validator should be reused or not for this parsing
  -      *                 process.
  +      * @param reuseGrammar The flag indicating whether the existing Grammar
  +      *                     should be reused or not for this parsing process.
  +      *                     If true, there cannot be any internal subset.
         *
         * @return 'true', if successful in parsing the prolog. It indicates the
         *         user can go ahead with parsing the rest of the file. It
  @@ -620,11 +691,11 @@
         * @see #parseFirst(XMLCh*,...)
         * @see #parseFirst(char*,...)
         */
  -    bool parseFirst
  +    bool parseFirst__overload__2
       (
           const   InputSource&    source
           ,       XMLPScanToken&  toFill
  -        , const bool            reuseValidator = false
  +        , const bool            reuseGrammar = false
       );
   
       /** Continue a progressive parse operation
  @@ -1071,7 +1142,10 @@
         * @see #getDoValidation
         */
       void setDoValidation(const bool newState);
  -    //doctypehandler interfaces
  +
  +    /**
  +      * Deprecated doctypehandler interfaces
  +      */
   	virtual void attDef
       (
           const   DTDElementDecl&     elemDecl
  @@ -1236,12 +1310,6 @@
       //      The scanner used for this parser. This is created during the
       //      constructor.
       //
  -    //  fValidator
  -    //      The validator that is installed. If none is provided, we will
  -    //      create and install a DTD validator. We install this on the
  -    //      scanner we create, which it will use to do validation. We set
  -    //      ourself on it as the error reporter for validity errors.
  -    //
       //  fWithinElement
       //      A flag to indicate that the parser is within at least one level
       //      of element processing.
  @@ -1249,10 +1317,6 @@
       //  fDocumentType
       //      Used to store and update the documentType variable information
       //      in fDocument
  -    //
  -    //  fOldDocTypeHandler
  -    //      Used to chain the old documentType node if the user has set it
  -    //      from outside
       //
       //  fToCreateXMLDecTypeNode
       //      A flag to create a DOM_XMLDecl node in the ODM tree if it exists
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org