You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/02/15 16:56:32 UTC

cvs commit: xml-xerces/c/src/sax2 SAX2XMLReader.hpp

tng         01/02/15 07:56:31

  Modified:    c/src/internal XMLScanner.cpp XMLScanner.hpp
               c/src/parsers DOMParser.cpp DOMParser.hpp
                        SAX2XMLReaderImpl.cpp SAX2XMLReaderImpl.hpp
                        SAXParser.cpp SAXParser.hpp
               c/src/sax2 SAX2XMLReader.hpp
  Log:
  Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  New data field  fSchemaValidation in XMLScanner as the flag.
  
  Revision  Changes    Path
  1.25      +3 -1      xml-xerces/c/src/internal/XMLScanner.cpp
  
  Index: XMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- XMLScanner.cpp	2000/11/30 18:22:41	1.24
  +++ XMLScanner.cpp	2001/02/15 15:56:26	1.25
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner.cpp,v 1.24 2000/11/30 18:22:41 andyh Exp $
  + * $Id: XMLScanner.cpp,v 1.25 2001/02/15 15:56:26 tng Exp $
    */
   
   
  @@ -157,6 +157,7 @@
       , fValidate(false)
       , fValidator(validator)
       , fValScheme(Val_Never)
  +    , fSchemaValidation(false)
   {
       commonInit();
   }
  @@ -183,6 +184,7 @@
       , fValidate(false)
       , fValidator(validator)
       , fValScheme(Val_Never)
  +    , fSchemaValidation(false)
   {
       commonInit();
   }
  
  
  
  1.10      +33 -14    xml-xerces/c/src/internal/XMLScanner.hpp
  
  Index: XMLScanner.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLScanner.hpp	2000/04/12 22:58:28	1.9
  +++ XMLScanner.hpp	2001/02/15 15:56:27	1.10
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: XMLScanner.hpp,v $
  + * Revision 1.10  2001/02/15 15:56:27  tng
  + * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  + * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  + * New data field  fSchemaValidation in XMLScanner as the flag.
  + *
    * Revision 1.9  2000/04/12 22:58:28  roddey
    * Added support for 'auto validate' mode.
    *
  @@ -169,7 +174,7 @@
           , EntityExp_Failed
       };
   
  -    enum XMLTokens 
  +    enum XMLTokens
       {
           Token_CData
           , Token_CharData
  @@ -235,6 +240,7 @@
       XMLDocumentHandler* getDocHandler();
       bool getDoNamespaces() const;
       ValSchemes getValidationScheme() const;
  +    bool getSchemaValidation() const;
       const XMLEntityHandler* getEntityHandler() const;
       XMLEntityHandler* getEntityHandler();
       const XMLErrorReporter* getErrorReporter() const;
  @@ -269,7 +275,7 @@
       void setExitOnFirstFatal(const bool newValue);
       void setValidationScheme(const ValSchemes newScheme);
       void setValidator(XMLValidator* const validator);
  -
  +    void setSchemaValidation(const bool doSchema);
   
       // -----------------------------------------------------------------------
       //  Deprecated methods as of 3.2.0. Use getValidationScheme() and
  @@ -580,6 +586,10 @@
       //      This is the currently set validation scheme. It defaults to
       //      'never', but can be set by the client.
       //
  +    //  fSchemaValidation
  +    //      This flag indicates whether the client code wants Schema
  +    //      support or not.
  +    //
       //  fAttName
       //  fAttValue
       //  fCDataBuf
  @@ -613,6 +623,7 @@
       bool                        fValidate;
       XMLValidator*               fValidator;
       ValSchemes                  fValScheme;
  +    bool                        fSchemaValidation;
   
       XMLBuffer                   fAttNameBuf;
       XMLBuffer                   fAttValueBuf;
  @@ -713,7 +724,12 @@
       return fValidator;
   }
   
  +inline bool XMLScanner::getSchemaValidation() const
  +{
  +    return fSchemaValidation;
  +}
   
  +
   // ---------------------------------------------------------------------------
   //  XMLScanner: Setter methods
   // ---------------------------------------------------------------------------
  @@ -751,6 +767,11 @@
   inline void XMLScanner::setValidator(XMLValidator* const validator)
   {
       fValidator = validator;
  +}
  +
  +inline void XMLScanner::setSchemaValidation(const bool doSchema)
  +{
  +    fSchemaValidation = doSchema;
   }
   
   
  
  
  
  1.38      +70 -61    xml-xerces/c/src/parsers/DOMParser.cpp
  
  Index: DOMParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/DOMParser.cpp,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- DOMParser.cpp	2001/01/25 23:59:15	1.37
  +++ DOMParser.cpp	2001/02/15 15:56:28	1.38
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -59,8 +59,8 @@
   *  handler with the scanner. In these handler methods, appropriate DOM nodes
   *  are created and added to the DOM tree.
   *
  -* $Id: DOMParser.cpp,v 1.37 2001/01/25 23:59:15 lehors Exp $
  -* 
  +* $Id: DOMParser.cpp,v 1.38 2001/02/15 15:56:28 tng Exp $
  +*
   */
   
   
  @@ -107,15 +107,15 @@
   , fOldDocTypeHandler(0)
   , fValidator(valToAdopt)
   {
  -    
  +
       // Create the validator if one was not provided
       if (!fValidator)
           fValidator = new DTDValidator;
  -    
  +
       //If the user already registered the doctypehandler then chain it
   	fOldDocTypeHandler =  ((DTDValidator*)fValidator)->getDocTypeHandler();
   	
  -	//register the new doctypehandler 
  +	//register the new doctypehandler
   	((DTDValidator*)fValidator)->setDocTypeHandler(this);
       //
       //  Create a scanner and tell it what validator to use. Then set us
  @@ -123,11 +123,11 @@
       //
       fScanner = new XMLScanner(fValidator);
       fScanner->setDocHandler(this);
  -    
  +
       fNodeStack = new ValueStackOf<DOM_Node>(64);
       this->reset();
  +
   
  - 
   }
   
   
  @@ -188,6 +188,10 @@
       return Val_Auto;
   }
   
  +bool DOMParser::getSchemaValidation() const
  +{
  +    return fScanner->getSchemaValidation();
  +}
   
   
   // ---------------------------------------------------------------------------
  @@ -237,8 +241,13 @@
           fScanner->setValidationScheme(XMLScanner::Val_Auto);
   }
   
  +void DOMParser::setSchemaValidation(const bool newState)
  +{
  +    fScanner->setSchemaValidation(newState);
  +}
   
   
  +
   // ---------------------------------------------------------------------------
   //  DOMParser: Parsing methods
   // ---------------------------------------------------------------------------
  @@ -247,9 +256,9 @@
       // Avoid multiple entrance
       if (fParseInProgress)
           ThrowXML(IOException, XMLExcepts::Gen_ParseInProgress);
  -    
  +
       try
  -    { 
  +    {
           fParseInProgress = true;
           fScanner->scanDocument(source, reuseValidator);
           fParseInProgress = false;
  @@ -267,14 +276,14 @@
       // Avoid multiple entrance
       if (fParseInProgress)
           ThrowXML(IOException, XMLExcepts::Gen_ParseInProgress);
  -    
  +
       try
  -    { 
  +    {
           fParseInProgress = true;
           fScanner->scanDocument(systemId, reuseValidator);
           fParseInProgress = false;
       }
  -    
  +
       catch(...)
       {
           fParseInProgress = false;
  @@ -287,14 +296,14 @@
       // Avoid multiple entrance
       if (fParseInProgress)
           ThrowXML(IOException, XMLExcepts::Gen_ParseInProgress);
  -    
  +
       try
  -    { 
  +    {
           fParseInProgress = true;
           fScanner->scanDocument(systemId, reuseValidator);
           fParseInProgress = false;
       }
  -    
  +
       catch(...)
       {
           fParseInProgress = false;
  @@ -317,7 +326,7 @@
       //
       if (fParseInProgress)
           ThrowXML(IOException, XMLExcepts::Gen_ParseInProgress);
  -    
  +
       return fScanner->scanFirst(systemId, toFill, reuseValidator);
   }
   
  @@ -331,7 +340,7 @@
       //
       if (fParseInProgress)
           ThrowXML(IOException, XMLExcepts::Gen_ParseInProgress);
  -    
  +
       return fScanner->scanFirst(systemId, toFill, reuseValidator);
   }
   
  @@ -345,7 +354,7 @@
       //
       if (fParseInProgress)
           ThrowXML(IOException, XMLExcepts::Gen_ParseInProgress);
  -    
  +
       return fScanner->scanFirst(source, toFill, reuseValidator);
   }
   
  @@ -382,7 +391,7 @@
           , lineNum
           , colNum
           );
  -    
  +
       //
       //  If there is an error handler registered, call it, otherwise ignore
       //  all but the fatal errors.
  @@ -393,7 +402,7 @@
               throw toThrow;
           return;
       }
  -    
  +
       if (errType == XMLErrorReporter::ErrType_Warning)
           fErrorHandler->warning(toThrow);
       else if (errType >= XMLErrorReporter::ErrType_Fatal)
  @@ -434,7 +443,7 @@
       // Ignore chars outside of content
       if (!fWithinElement)
           return;
  -    
  +
       if (cdataSection == true)
       {
           DOM_CDATASection node = fDocument.createCDATASection
  @@ -508,7 +517,7 @@
   {
       fCurrentNode   = fCurrentParent;
       fCurrentParent = fNodeStack->pop();
  -    
  +
       // If we've hit the end of content, clear the flag
       if (fNodeStack->empty())
           fWithinElement = false;
  @@ -522,7 +531,7 @@
       // Ignore chars before the root element
       if (!fWithinElement || !fIncludeIgnorableWhitespace)
           return;
  -    
  +
       if (fCurrentNode.getNodeType() == DOM_Node::TEXT_NODE)
       {
           DOM_Text node = (DOM_Text&)fCurrentNode;
  @@ -544,7 +553,7 @@
   		if (fCurrentParent.getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE) {
   			fCurrentParent.fImpl->isReadOnly(oldReadFlag);
   		}
  -        
  +
           fCurrentNode = node;
       }
   }
  @@ -553,7 +562,7 @@
   void DOMParser::resetDocument()
   {
       //
  -    //  The reset methods are called before a new parse event occurs. 
  +    //  The reset methods are called before a new parse event occurs.
       //  Reset this parsers state to clear out anything that may be left
       //  from a previous use, in particular the DOM document itself.
       //
  @@ -628,7 +637,7 @@
   
               attr->setSpecified(oneAttrib->getSpecified());
           }
  -    } 
  +    }
   	else {    //DOM Level 1
   			elem = fDocument.createElement(elemDecl.getFullName());
   			ElementImpl *elemImpl = (ElementImpl *) elem.fImpl;
  @@ -650,7 +659,7 @@
   
   		}
       }
  -    
  +
       //If the node type is entityRef then set the readOnly flag to false before appending node
   	bool oldReadFlag;
   	if (fCurrentParent.getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE) {
  @@ -667,7 +676,7 @@
       fCurrentParent = elem;
       fCurrentNode = elem;
       fWithinElement = true;
  -    
  +
       // If an empty element, do end right now (no endElement() will be called)
       if (isEmpty)
           endElement(elemDecl, urlId, isRoot);
  @@ -686,8 +695,8 @@
           fCurrentNode = er;
   
   		// this entityRef needs to be stored in Entity map too.
  -        // We'd decide later whether the entity nodes should be created by a 
  -        // separated method in parser or not. For now just stick it in if 
  +        // We'd decide later whether the entity nodes should be created by a
  +        // separated method in parser or not. For now just stick it in if
           // the ref nodes are created
   		EntityImpl* entity = (EntityImpl*)fDocumentType->entities->getNamedItem(entName);
   		entity->setEntityRef((EntityReferenceImpl*)er.fImpl);
  @@ -701,17 +710,17 @@
                           , const XMLCh* const standalone
                           , const XMLCh* const actualEncStr)
   {
  -    //This is a non-standard extension to creating XMLDecl type nodes and attching to DOM Tree 
  +    //This is a non-standard extension to creating XMLDecl type nodes and attching to DOM Tree
       // currently this flag it set to false unless user explicitly asks for it
       // Needs to be revisited after W3C specs are laid out on this issue.
   
       if (fToCreateXMLDeclTypeNode) {
  -        
  +
           DOMString ver(version);
           DOMString enc(encoding);
           DOMString std(standalone);
           DOM_XMLDecl xmlDecl = fDocument.createXMLDecl(ver, enc, std);
  -        
  +
           fCurrentParent.appendChild(xmlDecl);
       }
   }
  @@ -755,21 +764,21 @@
       {
           fOldDocTypeHandler->attDef(elemDecl,attDef, ignoring );
       }
  - 
  +
       if (fDocumentType->isIntSubsetReading())
       {
           DOMString attString;
  -        if (elemDecl.hasAttDefs()) 
  +        if (elemDecl.hasAttDefs())
           {
               attString.appendData(chOpenAngle);
               attString.appendData(chBang);
               attString.appendData(XMLUni::fgAttListString);
               attString.appendData(chSpace);
               attString.appendData(elemDecl.getFullName());
  -            
  +
               attString.appendData(chSpace);
               attString.appendData(attDef.getFullName());
  -            
  +
               // Get the type and display it
               const XMLAttDef::AttTypes type = attDef.getType();
               switch(type)
  @@ -806,21 +815,21 @@
                   attString.appendData(chSpace);
                   attString.appendData(XMLUni::fgNmTokensString);
                   break;
  -                
  +
               case XMLAttDef::Notation :
                   attString.appendData(chSpace);
                   attString.appendData(XMLUni::fgNotationString);
                   break;
  -                
  +
               case XMLAttDef::Enumeration :
                   attString.appendData(chSpace);
                   //  attString.appendData(XMLUni::fgEnumerationString);
                   const XMLCh* enumString = attDef.getEnumeration();
                   int length = XMLString::stringLen(enumString);
                   if (length > 0) {
  -                    
  +
                       DOMString anotherEnumString;
  -                    
  +
                       anotherEnumString.appendData(chOpenParen );
                       for(int i=0; i<length; i++) {
                           if (enumString[i] == chSpace)
  @@ -968,7 +977,7 @@
       if (fDocumentType->isIntSubsetReading())
   	{
           DOMString elemDecl;
  -        
  +
           elemDecl.appendData(chOpenAngle);
           elemDecl.appendData(chBang);
           elemDecl.appendData(XMLUni::fgElemString);
  @@ -981,7 +990,7 @@
               elemDecl.appendData(chSpace);
               elemDecl.appendData(contentModel);
           }
  -        
  +
           elemDecl.appendData(chCloseAngle);
   		fDocumentType->internalSubset.appendData(elemDecl);
   	}
  @@ -1072,7 +1081,7 @@
   	entity->setNotationName(entityDecl.getNotationName());
   
       EntityImpl *previousDef = (EntityImpl *)
  -	    fDocumentType->entities->setNamedItem( entity ); 
  +	    fDocumentType->entities->setNamedItem( entity );
   
       //
       //  If this new entity node is replacing an entity node that was already
  @@ -1092,7 +1101,7 @@
           entityName.appendData(chBang);
   		entityName.appendData(XMLUni::fgEntityString);
           entityName.appendData(chSpace);
  -        
  +
           entityName.appendData(entityDecl.getName());
           DOMString id = entity->getPublicId();
           if (id != 0) {
  @@ -1111,7 +1120,7 @@
               entityName.appendData(chDoubleQuote);
               entityName.appendData(id);
               entityName.appendData(chDoubleQuote);
  -            
  +
           }
           id = entity->getNotationName();
           if (id != 0) {
  @@ -1129,7 +1138,7 @@
               entityName.appendData(id);
               entityName.appendData(chDoubleQuote);
           }
  -        
  +
           entityName.appendData(chCloseAngle);
           fDocumentType->internalSubset.appendData(entityName);
       }
  @@ -1207,7 +1216,7 @@
   // to populate the entities in the documentType
   void DOMParser::populateDocumentType()
   {
  -	if (fDocumentType == null) 
  +	if (fDocumentType == null)
   		return;
   	
   
  @@ -1223,7 +1232,7 @@
   		entity->setSystemId(entityDecl->getSystemId());
   		entity->setNotationName(entityDecl->getNotationName());
   
  -		fDocumentType->entities->setNamedItem( entity ); 
  +		fDocumentType->entities->setNamedItem( entity );
   	}
   
   	NameIdPoolEnumerator<XMLNotationDecl> notationPoolEnum = ((DTDValidator*)fValidator)->getNotationEnumerator();
  
  
  
  1.16      +33 -3     xml-xerces/c/src/parsers/DOMParser.hpp
  
  Index: DOMParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/DOMParser.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DOMParser.hpp	2001/01/25 23:59:15	1.15
  +++ DOMParser.hpp	2001/02/15 15:56:28	1.16
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DOMParser.hpp,v 1.15 2001/01/25 23:59:15 lehors Exp $
  + * $Id: DOMParser.hpp,v 1.16 2001/02/15 15:56:28 tng Exp $
    *
    */
   
  @@ -223,6 +223,18 @@
         */
       ValSchemes getValidationScheme() const;
   
  +    /** Get the 'schema validation' flag
  +      *
  +      * This method returns the state of the parser's schema support
  +      * flag.
  +      *
  +      * @return true, if the parser is currently configured to
  +      *         support schema, false otherwise.
  +      *
  +      * @see #setSchemaValidation
  +      */
  +    bool getSchemaValidation() const;
  +
       /** Get the 'do namespaces' flag
         *
         * This method returns the state of the parser's namespace processing
  @@ -267,7 +279,7 @@
         * This flag  specifies whether the parser is
         * creating entity reference nodes in the DOM tree being produced.
         * When the 'create' flag is
  -      * true, the DOM tree will contain entity reference nodes. 
  +      * true, the DOM tree will contain entity reference nodes.
         * When the 'create' flag is false, no entity reference nodes
         * are included in the DOM tree.
         * <p>The replacement text
  @@ -406,7 +418,7 @@
         * This method allows the user to specify whether the parser should
         * create entity reference nodes in the DOM tree being produced.
         * When the 'create' flag is
  -      * true, the DOM tree constains entity reference nodes. 
  +      * true, the DOM tree constains entity reference nodes.
         * When the 'create' flag is false, no entity reference nodes
         * are included in the DOM tree.
         * <p>The replacement text
  @@ -456,6 +468,24 @@
         * @see #getValidationScheme
         */
       void setValidationScheme(const ValSchemes newScheme);
  +
  +    /** Set the 'schema support' flag
  +      *
  +      * This method allows users to enable or disable the parser's
  +      * schema support.
  +      *
  +      * The parser's default state is: true.
  +      *
  +      * This flag is ignored by the underlying scanner if the validation
  +      * is disable.
  +      *
  +      * @param newState The value specifying whether schema support should
  +      *                 be enforced or not.
  +      *
  +      * @see #getSchemaValidation
  +      * @see #getValidationScheme
  +      */
  +    void setSchemaValidation(const bool newState);
   
       /**
         * This method allows users to set the toCreateXMLDeclTypeNode flag
  
  
  
  1.8       +106 -35   xml-xerces/c/src/parsers/SAX2XMLReaderImpl.cpp
  
  Index: SAX2XMLReaderImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/SAX2XMLReaderImpl.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SAX2XMLReaderImpl.cpp	2001/01/15 21:26:33	1.7
  +++ SAX2XMLReaderImpl.cpp	2001/02/15 15:56:29	1.8
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: SAX2XMLReaderImpl.cpp,v $
  + * Revision 1.8  2001/02/15 15:56:29  tng
  + * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  + * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  + * New data field  fSchemaValidation in XMLScanner as the flag.
  + *
    * Revision 1.7  2001/01/15 21:26:33  tng
    * Performance Patches by David Bertoni.
    *
  @@ -137,6 +142,7 @@
   #include <validators/DTD/DTDValidator.hpp>
   #include <string.h>
   
  +// SAX2 Core: http://xml.org/sax/features/validation
   const XMLCh SAX2XMLReaderImpl::SAX_CORE_VALIDATION[] = {
   		chLatin_h, chLatin_t, chLatin_t, chLatin_p,
   		chColon, chForwardSlash, chForwardSlash,
  @@ -151,6 +157,7 @@
   		chLatin_i, chLatin_o, chLatin_n, chNull
   };
   
  +// SAX2 Core: http://xml.org/sax/features/namespaces
   const XMLCh SAX2XMLReaderImpl::SAX_CORE_NAMESPACES[] = {
   		chLatin_h, chLatin_t, chLatin_t, chLatin_p,
   		chColon, chForwardSlash, chForwardSlash,
  @@ -165,6 +172,7 @@
   		chLatin_c, chLatin_e, chLatin_s, chNull
   };
   
  +//SAX2 Core: http://xml.org/sax/features/namespace-prefixes
   const XMLCh SAX2XMLReaderImpl::SAX_CORE_NAMESPACES_PREFIXES[] = {
   		chLatin_h, chLatin_t, chLatin_t, chLatin_p,
   		chColon, chForwardSlash, chForwardSlash,
  @@ -176,12 +184,13 @@
   		chLatin_e, chLatin_s, chForwardSlash,
   		chLatin_n, chLatin_a, chLatin_m,
   		chLatin_e, chLatin_s, chLatin_p, chLatin_a,
  -		chLatin_c, chLatin_e, 
  +		chLatin_c, chLatin_e,
   		chDash, chLatin_p, chLatin_r, chLatin_e,
   		chLatin_f, chLatin_i, chLatin_x,
   		chLatin_e, chLatin_s, chNull
   };
   
  +//Xerces: http://apache.org/xml/features/validation/dynamic
   const XMLCh SAX2XMLReaderImpl::SAX_XERCES_DYNAMIC[] = {
   		chLatin_h, chLatin_t, chLatin_t, chLatin_p,
   		chColon, chForwardSlash, chForwardSlash,
  @@ -198,6 +207,7 @@
   		chLatin_m, chLatin_i, chLatin_c, chNull
   };
   
  +//Xerces: http://apache.org/xml/features/validation/reuse-validator
   const XMLCh SAX2XMLReaderImpl::SAX_XERCES_REUSEVALIDATOR[] = {
   		chLatin_h, chLatin_t, chLatin_t, chLatin_p,
   		chColon, chForwardSlash, chForwardSlash,
  @@ -211,12 +221,28 @@
   		chLatin_i, chLatin_d, chLatin_a, chLatin_t,
   		chLatin_i, chLatin_o, chLatin_n, chForwardSlash,
   		chLatin_r, chLatin_e, chLatin_u, chLatin_s,
  -		chLatin_e, chDash, chLatin_v, 
  +		chLatin_e, chDash, chLatin_v,
   		chLatin_a, chLatin_l,
   		chLatin_i, chLatin_d, chLatin_a, chLatin_t,
   		chLatin_o, chLatin_r, chNull
   };
   
  +//Xerces: http://apache.org/xml/features/validation/schema
  +const XMLCh SAX2XMLReaderImpl::SAX_XERCES_SCHEMA[] = {
  +		chLatin_h, chLatin_t, chLatin_t, chLatin_p,
  +		chColon, chForwardSlash, chForwardSlash,
  +		chLatin_a, chLatin_p, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chPeriod,
  +		chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
  +		chLatin_x, chLatin_m, chLatin_l, chForwardSlash,
  +		chLatin_f, chLatin_e, chLatin_a,
  +		chLatin_t, chLatin_u, chLatin_r,
  +		chLatin_e, chLatin_s, chForwardSlash,
  +		chLatin_v, chLatin_a, chLatin_l,
  +		chLatin_i, chLatin_d, chLatin_a, chLatin_t,
  +		chLatin_i, chLatin_o, chLatin_n, chForwardSlash,
  +		chLatin_s, chLatin_c, chLatin_h, chLatin_e,
  +		chLatin_m, chLatin_a, chNull
  +};
   
   SAX2XMLReaderImpl::SAX2XMLReaderImpl() :
       fDocHandler(0)
  @@ -255,6 +281,9 @@
   
   	// default: reuseValidator is off
   	freuseValidator = false;
  +
  +	// default: schema is on
  +	setSchemaValidation(true);
   	
   	fPrefixes    = new RefStackOf<XMLBuffer> (10, false) ;
   	tempAttrVec  = new RefVectorOf<XMLAttr>  (10, false) ;
  @@ -286,7 +315,7 @@
   //  SAX2XMLReader Interface
   // ---------------------------------------------------------------------------
   void SAX2XMLReaderImpl::setContentHandler(ContentHandler* const handler)
  -{    
  +{
   	fDocHandler = handler;
       if (fDocHandler)
       {
  @@ -475,7 +504,7 @@
   }
   
   
  -void SAX2XMLReaderImpl::XMLDecl(const   XMLCh* const 
  +void SAX2XMLReaderImpl::XMLDecl(const   XMLCh* const
                           , const XMLCh* const
                           , const XMLCh* const
                           , const XMLCh* const)
  @@ -591,7 +620,7 @@
                   , const bool                    isEmpty
                   , const bool                    isRoot)
   {
  - 
  +
   	// Bump the element depth counter if not empty
       if (!isEmpty)
           fElemDepth++;
  @@ -654,18 +683,18 @@
   
   			fScanner->getValidator()->getURIText(elemURLId, (XMLBuffer &)URIBuffer);
   			
  -			fDocHandler->startElement(URIBuffer.getRawBuffer(), 
  -										elemDecl.getBaseName(), 
  -										elemDecl.getFullName(), 
  -										fAttrList); 
  +			fDocHandler->startElement(URIBuffer.getRawBuffer(),
  +										elemDecl.getBaseName(),
  +										elemDecl.getFullName(),
  +										fAttrList);
   		}
   		else
   		{
   			fAttrList.setVector(&attrList, attrCount, fScanner->getValidator());
   			fDocHandler->startElement(XMLUni::fgZeroLenString,
  -										elemDecl.getBaseName(), 
  -										elemDecl.getFullName(), 
  -										fAttrList); 
  +										elemDecl.getBaseName(),
  +										elemDecl.getFullName(),
  +										fAttrList);
   		}
   
   
  @@ -681,9 +710,9 @@
   
   				fScanner->getValidator()->getURIText(elemURLId, (XMLBuffer &)URIBuffer);
   			
  -				fDocHandler->endElement(	URIBuffer.getRawBuffer(), 
  -											elemDecl.getBaseName(), 
  -											elemDecl.getFullName() ); 
  +				fDocHandler->endElement(	URIBuffer.getRawBuffer(),
  +											elemDecl.getBaseName(),
  +											elemDecl.getFullName() );
   				unsigned int numPrefix = prefixCounts->pop();
   				for (unsigned int i = 0; i < numPrefix; ++i)
   				{
  @@ -695,8 +724,8 @@
   			else
   			{
   				fDocHandler->endElement(XMLUni::fgZeroLenString,
  -							elemDecl.getBaseName(), 
  -							elemDecl.getFullName() ); 
  +							elemDecl.getBaseName(),
  +							elemDecl.getFullName() );
   
   			}
   
  @@ -737,9 +766,9 @@
   			XMLBuffer &URIBuffer = URIBufferBid.getBuffer() ;
   
   			fScanner->getValidator()->getURIText(uriId, URIBuffer ) ;
  -			fDocHandler->endElement(	URIBuffer.getRawBuffer(), 
  -										elemDecl.getBaseName(), 
  -										elemDecl.getFullName() ); 
  +			fDocHandler->endElement(	URIBuffer.getRawBuffer(),
  +										elemDecl.getBaseName(),
  +										elemDecl.getFullName() );
   
   			unsigned int numPrefix = prefixCounts->pop();
   			for (unsigned int i = 0; i < numPrefix; i++)
  @@ -752,8 +781,8 @@
   		else
   		{
   			fDocHandler->endElement(XMLUni::fgZeroLenString,
  -										elemDecl.getBaseName(), 
  -										elemDecl.getFullName() ); 
  +										elemDecl.getBaseName(),
  +										elemDecl.getFullName() );
   		}
   	
   	}
  @@ -1065,6 +1094,12 @@
   		return;
   	}
   
  +	if (XMLString::compareIString(name, SAX2XMLReaderImpl::SAX_XERCES_SCHEMA) == 0)
  +	{
  +		setSchemaValidation(value);
  +		return;
  +	}
  +
   	throw SAXNotRecognizedException("Unknown Feature");
   }
   
  @@ -1080,6 +1115,8 @@
   		return fautoValidation;
   	if (XMLString::compareIString(name, SAX2XMLReaderImpl::SAX_XERCES_REUSEVALIDATOR) == 0)
           return freuseValidator;
  +	if (XMLString::compareIString(name, SAX2XMLReaderImpl::SAX_XERCES_SCHEMA) == 0)
  +        return getSchemaValidation();
   
   	throw SAXNotRecognizedException("Unknown Feature");
   	return false;
  @@ -1098,7 +1135,7 @@
   void* SAX2XMLReaderImpl::getProperty(const XMLCh* const name) const
   {
   	throw SAXNotRecognizedException("Unknown Property");
  -	// unimplemented 
  +	// unimplemented
   	return 0;
   }
   
  @@ -1125,4 +1162,14 @@
   bool SAX2XMLReaderImpl::getDoNamespaces() const
   {
       return fScanner->getDoNamespaces();
  +}
  +
  +void SAX2XMLReaderImpl::setSchemaValidation(const bool newState)
  +{
  +    fScanner->setSchemaValidation(newState);
  +}
  +
  +bool SAX2XMLReaderImpl::getSchemaValidation() const
  +{
  +    return fScanner->getSchemaValidation();
   }
  
  
  
  1.5       +71 -48    xml-xerces/c/src/parsers/SAX2XMLReaderImpl.hpp
  
  Index: SAX2XMLReaderImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/SAX2XMLReaderImpl.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SAX2XMLReaderImpl.hpp	2000/12/22 15:16:53	1.4
  +++ SAX2XMLReaderImpl.hpp	2001/02/15 15:56:29	1.5
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: SAX2XMLReaderImpl.hpp,v $
  + * Revision 1.5  2001/02/15 15:56:29  tng
  + * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  + * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  + * New data field  fSchemaValidation in XMLScanner as the flag.
  + *
    * Revision 1.4  2000/12/22 15:16:53  tng
    * SAX2-ext's LexicalHandler support added by David Bertoni.
    *
  @@ -107,7 +112,7 @@
     * <p>It can be used to instantiate a validating or non-validating
     * parser, by setting a member flag.</p>
     *
  -  * we basically re-use the existing SAX1 parser code, but provide a 
  +  * we basically re-use the existing SAX1 parser code, but provide a
     * new implementation of XMLContentHandler that raises the new
     * SAX2 style events
     *
  @@ -128,6 +133,7 @@
   	static const XMLCh SAX_CORE_NAMESPACES_PREFIXES[];
   	static const XMLCh SAX_XERCES_DYNAMIC[];
   	static const XMLCh SAX_XERCES_REUSEVALIDATOR[];
  +	static const XMLCh SAX_XERCES_SCHEMA[];
   	
   	SAX2XMLReaderImpl() ;
   	~SAX2XMLReaderImpl() ;
  @@ -286,7 +292,7 @@
         * This method is used to report the start of the parsing process.
         * The corresponding user installed SAX Document Handler's method
         * 'startDocument' is invoked.
  -      * 
  +      *
         * <p>If any advanced callback handlers are installed, then the
         * corresponding 'startDocument' method is also called.</p>
         *
  @@ -299,7 +305,7 @@
         * called at the end of the element, by which time all attributes
         * specified are also parsed. The corresponding user installed
         * SAX Document Handler's method 'startElement' is invoked.
  -      * 
  +      *
         * <p>If any advanced callback handlers are installed, then the
         * corresponding 'startElement' method is also called.</p>
         *
  @@ -379,28 +385,28 @@
       //@{
   
       /**
  -      * This method returns the installed content handler. 
  +      * This method returns the installed content handler.
         *
         * @return A pointer to the installed content handler object.
         */
       virtual ContentHandler* getContentHandler() const;
   
       /**
  -      * This method returns the installed DTD handler. 
  +      * This method returns the installed DTD handler.
         *
         * @return A pointer to the installed DTD handler object.
         */
       virtual DTDHandler* getDTDHandler() const ;
   
       /**
  -      * This method returns the installed entity resolver. 
  +      * This method returns the installed entity resolver.
         *
         * @return A pointer to the installed entity resolver object.
         */
       virtual EntityResolver* getEntityResolver() const  ;
   
       /**
  -      * This method returns the installed error handler. 
  +      * This method returns the installed error handler.
         *
         * @return A pointer to the installed error handler object.
         */
  @@ -486,7 +492,7 @@
       * @see DefaultHandler#DefaultHandler
       */
       virtual void setEntityResolver(EntityResolver* const resolver) ;
  -    
  +
     /**
       * Allow an application to register an error event handler.
       *
  @@ -524,37 +530,54 @@
       */
       virtual void setLexicalHandler(LexicalHandler* const handler) ;
   
  -   /**
  -	  * This method sets a Feature as per the SAX2 spec (such as
  -	  * do validation)
  -	  *
  -	  * @param name The name of the feature to be set
  -	  * @param value true if the feature should be enabled.
  -	  */
  +  /**
  +    * Set the state of any feature in a SAX2 XMLReader.
  +    * Supported features in SAX2 for xerces-c are:
  +    *
  +    * <br>http://xml.org/sax/features/validation (default: true)
  +    * <br>http://xml.org/sax/features/namespaces (default: true)
  +    * <br>http://xml.org/sax/features/namespace-prefixes (default: true)
  +    * <br>http://apache.org/xml/features/validation/dynamic (default: false)
  +    * <br>http://apache.org/xml/features/validation/reuse-validator (default: false)
  +    * <br>http://apache.org/xml/features/validation/schema (default: true)
  +    *
  +    * @param name The unique identifier (URI) of the feature.
  +    * @param value The requested state of the feature (true or false).
  +    * @exception SAXNotRecognizedException If the requested feature is not known.
  +    * @exception SAXNotSupportedException Property modification is not supported during parse
  +    *
  +    */
   	virtual void setFeature(const XMLCh* const name, const bool value);
   
   	/**
  -	  * This method gets a Feature as per the SAX2 spec (such as
  -	  * do validation)
  +     * Query the current state of any feature in a SAX2 XMLReader.
   	  *
  -	  * @param name The name of the feature to be set
  -	  * @param value true if the feature should be enabled.
  +	  * @param name The unique identifier (URI) of the feature being set.
  +	  * @return The current state of the feature.
  +     * @exception SAXNotRecognizedException If the requested feature is not known.
   	  */
   	virtual bool getFeature(const XMLCh* const name) const;
   
  -	/**
  -	  * Set the value of a property.
  -	  *
  -	  * @param name The property name, which is any fully-qualified URI.
  -	  * @param value The requested value for the property.
  -	  */
  +  /**
  +    * Set the value of any property in a SAX2 XMLReader.
  +    * Supported property in SAX2 for xerces-c are:
  +    *
  +    * <br>none
  +    *
  +    * @param name The unique identifier (URI) of the property being set.
  +    * @param value The requested value for the property.
  +    * @exception SAXNotRecognizedException If the requested property is not known.
  +    * @exception SAXNotSupportedException Property modification is not supported during parse
  +    */
   	virtual void setProperty(const XMLCh* const name, void* value);
   
   	/**
  -	  * Gets the value of a property.
  -	  *
  -	  * @param name The property name, which is any fully-qualified URI.
  -	  */
  +     * Query the current value of a property in a SAX2 XMLReader.
  +     *
  +     * @param name The unique identifier (URI) of the property being set.
  +     * @return The current value of the property.
  +     * @exception SAXNotRecognizedException If the requested property is not known.
  +     */
   	virtual void* getProperty(const XMLCh* const name) const;
   	//@}
   
  @@ -642,7 +665,7 @@
         *                  the system id scanned by the parser.
         * @param toFill    A pointer to a buffer in which the application
         *                  processed system id is stored.
  -      * @return 'true', if any processing is done, 'false' otherwise. 
  +      * @return 'true', if any processing is done, 'false' otherwise.
         */
       virtual bool expandSystemId
       (
  @@ -687,7 +710,7 @@
         * implementation.</font></b>
         *
         * @param inputSource A const reference to the InputSource object
  -      *                    which points to the external entity 
  +      *                    which points to the external entity
         *                    being parsed.
         */
       virtual void startInputSource(const InputSource& inputSource);
  @@ -987,7 +1010,7 @@
       //
   	//  fnamespacePrefix
   	//      Indicates whether the namespace-prefix feature is on or off.
  -	//  
  +	//
   	//  fautoValidation
   	//      Indicates whether automatic validation is on or off
   	//
  @@ -1000,7 +1023,7 @@
   	//	fStringBuffers
   	//		Any temporary strings we need are pulled out of this pool
   	//
  -	//	fPrefixes 
  +	//	fPrefixes
   	//		A Stack of the current namespace prefixes that need calls to
   	//		endPrefixMapping
   	//
  @@ -1037,6 +1060,8 @@
   	void setValidationScheme(const ValSchemes newScheme);
       void setDoNamespaces(const bool newState);
       bool getDoNamespaces() const;
  +    void setSchemaValidation(const bool newState);
  +    bool getSchemaValidation() const;
   
   };
   
  @@ -1049,12 +1074,12 @@
       return fDocHandler;
   }
   
  -inline DTDHandler* SAX2XMLReaderImpl::getDTDHandler() const 
  +inline DTDHandler* SAX2XMLReaderImpl::getDTDHandler() const
   {
   	return fDTDHandler ;
   }
   
  -inline EntityResolver* SAX2XMLReaderImpl::getEntityResolver() const  
  +inline EntityResolver* SAX2XMLReaderImpl::getEntityResolver() const
   {
   	return fEntityResolver;
   }
  @@ -1074,4 +1099,4 @@
   	return fValidator;
   }
   
  -#endif 
  +#endif
  
  
  
  1.15      +25 -13    xml-xerces/c/src/parsers/SAXParser.cpp
  
  Index: SAXParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/SAXParser.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SAXParser.cpp	2000/09/05 23:38:26	1.14
  +++ SAXParser.cpp	2001/02/15 15:56:29	1.15
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: SAXParser.cpp,v $
  + * Revision 1.15  2001/02/15 15:56:29  tng
  + * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  + * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  + * New data field  fSchemaValidation in XMLScanner as the flag.
  + *
    * Revision 1.14  2000/09/05 23:38:26  andyh
    * Added advanced callback support for XMLDecl()
    *
  @@ -163,7 +168,7 @@
   }
   
   
  -SAXParser::~SAXParser() 
  +SAXParser::~SAXParser()
   {
       delete [] fAdvDHList;
       delete fScanner;
  @@ -294,7 +299,12 @@
       return Val_Auto;
   }
   
  +bool SAXParser::getSchemaValidation() const
  +{
  +    return fScanner->getSchemaValidation();
  +}
   
  +
   // ---------------------------------------------------------------------------
   //  SAXParser: Setter methods
   // ---------------------------------------------------------------------------
  @@ -320,6 +330,10 @@
           fScanner->setValidationScheme(XMLScanner::Val_Auto);
   }
   
  +void SAXParser::setSchemaValidation(const bool newState)
  +{
  +    fScanner->setSchemaValidation(newState);
  +}
   
   
   // ---------------------------------------------------------------------------
  
  
  
  1.11      +52 -18    xml-xerces/c/src/parsers/SAXParser.hpp
  
  Index: SAXParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/SAXParser.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SAXParser.hpp	2001/01/12 21:23:41	1.10
  +++ SAXParser.hpp	2001/02/15 15:56:29	1.11
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: SAXParser.hpp,v $
  + * Revision 1.11  2001/02/15 15:56:29  tng
  + * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  + * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  + * New data field  fSchemaValidation in XMLScanner as the flag.
  + *
    * Revision 1.10  2001/01/12 21:23:41  tng
    * Documentation Enhancement: explain values of Val_Scheme
    *
  @@ -225,7 +230,7 @@
   
       /**
         * This method returns a reference to the parser's installed
  -      * validator.  
  +      * validator.
         *
         * @return A const reference to the installed validator object.
         */
  @@ -240,6 +245,18 @@
         */
       ValSchemes getValidationScheme() const;
   
  +    /** Get the 'schema validation' flag
  +      *
  +      * This method returns the state of the parser's schema support
  +      * flag.
  +      *
  +      * @return true, if the parser is currently configured to
  +      *         support schema, false otherwise.
  +      *
  +      * @see #setSchemaValidation
  +      */
  +    bool getSchemaValidation() const;
  +
       /**
         * This method returns the state of the parser's namespace
         * handling capability.
  @@ -307,6 +324,25 @@
         */
       void setValidationScheme(const ValSchemes newScheme);
   
  +    /** Set the 'schema support' flag
  +      *
  +      * This method allows users to enable or disable the parser's
  +      * schema support.
  +      *
  +      * The parser's default state is: true.
  +      *
  +      * This flag is ignored by the underlying scanner if the validation
  +      * is disable.
  +      *
  +      * @param newState The value specifying whether schema support should
  +      *                 be enforced or not.
  +      *
  +      * @see #getSchemaValidation
  +      * @see #getValidationScheme
  +      */
  +    void setSchemaValidation(const bool newState);
  +
  +
       /**
         * This method allows users to set the parser's behaviour when it
         * encounters the first fatal error. If set to true, the parser
  @@ -340,7 +376,7 @@
         *
         * <p>The methods in the advanced callback interface represent
         * Xerces-C extensions. There is no specification for this interface.</p>
  -      * 
  +      *
         * @param toInstall A pointer to the users advanced callback handler.
         *
         * @see #removeAdvDocHandler
  @@ -1028,7 +1064,7 @@
         * This method is used to report the start of the parsing process.
         * The corresponding user installed SAX Document Handler's method
         * 'startDocument' is invoked.
  -      * 
  +      *
         * <p>If any advanced callback handlers are installed, then the
         * corresponding 'startDocument' method is also called.</p>
         *
  @@ -1041,7 +1077,7 @@
         * called at the end of the element, by which time all attributes
         * specified are also parsed. The corresponding user installed
         * SAX Document Handler's method 'startElement' is invoked.
  -      * 
  +      *
         * <p>If any advanced callback handlers are installed, then the
         * corresponding 'startElement' method is also called.</p>
         *
  @@ -1198,7 +1234,7 @@
         *                  the system id scanned by the parser.
         * @param toFill    A pointer to a buffer in which the application
         *                  processed system id is stored.
  -      * @return 'true', if any processing is done, 'false' otherwise. 
  +      * @return 'true', if any processing is done, 'false' otherwise.
         */
       virtual bool expandSystemId
       (
  @@ -1243,7 +1279,7 @@
         * implementation.</font></b>
         *
         * @param inputSource A const reference to the InputSource object
  -      *                    which points to the external entity 
  +      *                    which points to the external entity
         *                    being parsed.
         */
       virtual void startInputSource(const InputSource& inputSource);
  
  
  
  1.6       +28 -24    xml-xerces/c/src/sax2/SAX2XMLReader.hpp
  
  Index: SAX2XMLReader.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/sax2/SAX2XMLReader.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SAX2XMLReader.hpp	2001/01/12 21:22:00	1.5
  +++ SAX2XMLReader.hpp	2001/02/15 15:56:31	1.6
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: SAX2XMLReader.hpp,v $
  + * Revision 1.6  2001/02/15 15:56:31  tng
  + * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  + * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  + * New data field  fSchemaValidation in XMLScanner as the flag.
  + *
    * Revision 1.5  2001/01/12 21:22:00  tng
    * Documentation Enhancement: Add list of SAX2 feature strings that are supported.
    *
  @@ -117,11 +122,11 @@
       // -----------------------------------------------------------------------
       //@{
       /** The default constructor */
  -    SAX2XMLReader() 
  +    SAX2XMLReader()
       {
       }
       /** The destructor */
  -    virtual ~SAX2XMLReader() 
  +    virtual ~SAX2XMLReader()
       {
       }
       //@}
  @@ -147,14 +152,14 @@
       virtual DTDHandler* getDTDHandler() const = 0;
   
       /**
  -      * This method returns the installed entity resolver. 
  +      * This method returns the installed entity resolver.
         *
         * @return A pointer to the installed entity resolver object.
         */
       virtual EntityResolver* getEntityResolver() const = 0 ;
   
       /**
  -      * This method returns the installed error handler. 
  +      * This method returns the installed error handler.
         *
         * @return A pointer to the installed error handler object.
         */
  @@ -178,11 +183,11 @@
   
   	/**
        * Query the current value of a property in a SAX2 XMLReader.
  -      *
  +     *
        * @param name The unique identifier (URI) of the property being set.
        * @return The current value of the property.
        * @exception SAXNotRecognizedException If the requested property is not known.
  -      */
  +     */
   	virtual void* getProperty(const XMLCh* const name) const = 0 ;
   
   
  @@ -316,7 +321,7 @@
       * @see DefaultHandler#DefaultHandler
       */
       virtual void setEntityResolver(EntityResolver* const resolver) = 0;
  -    
  +
     /**
       * Allow an application to register an error event handler.
       *
  @@ -363,13 +368,14 @@
       * <br>http://xml.org/sax/features/namespace-prefixes (default: true)
       * <br>http://apache.org/xml/features/validation/dynamic (default: false)
       * <br>http://apache.org/xml/features/validation/reuse-validator (default: false)
  +    * <br>http://apache.org/xml/features/validation/schema (default: true)
       *
       * @param name The unique identifier (URI) of the feature.
       * @param value The requested state of the feature (true or false).
       * @exception SAXNotRecognizedException If the requested feature is not known.
       * @exception SAXNotSupportedException Property modification is not supported during parse
  -	*
  -	*/
  +    *
  +    */
   	virtual void setFeature(const XMLCh* const name, const bool value) = 0;
   
     /**
  @@ -377,12 +383,12 @@
       * Supported property in SAX2 for xerces-c are:
       *
       * <br>none
  -	*
  +    *
       * @param name The unique identifier (URI) of the property being set.
  -	* @param value The requested value for the property.
  +    * @param value The requested value for the property.
       * @exception SAXNotRecognizedException If the requested property is not known.
       * @exception SAXNotSupportedException Property modification is not supported during parse
  -	*/
  +    */
   	virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
   
       //@}