You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Sean MacRoibeaird - Sun ireland - Solaris Software - Staff Engineer <Se...@ireland.sun.com> on 2000/05/05 13:03:11 UTC

CVS Diffs to Support Xerces-C Conformance

Please find below the CVS diffs to enable Xerces-C to 
pass various conformance tests.
The relevant parts of the XML spec. are :

Section 2.9 - Validity Constraint: Standalone Document Declaration
Clause [2] - Character Range
Clause [78] - Well-formed parsed entities.

The conformance tests which formerly failed, but which now pass are
as follows (from OASIS):

sun/invalid/not-sa01.xml 
sun/invalid/not-sa02.xml
sun/invalid/not-sa04.xml
sun/invalid/not-sa05.xml
sun/invalid/not-sa06.xml
sun/invalid/not-sa07.xml
sun/invalid/not-sa08.xml
sun/invalid/not-sa09.xml
sun/invalid/not-sa10.xml
sun/invalid/not-sa11.xml
sun/invalid/not-sa12.xml
sun/invalid/not-sa13.xml
sun/invalid/not-sa14.xml
sun/not-wf/dtd07.xml
oasis/p66fail6.xml
oasis/p11pass1.xml

As I am unable to generate new error messages I have re-used the
currently defined error message. In general Xerces-J has the correct 
correct error messages defined. Before a proper putback these messages
need to be defined.


Index: xml-xerces/c/src/framework/XMLElementDecl.cpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/framework/XMLElementDecl.cpp,v
retrieving revision 1.2
diff -r1.2 XMLElementDecl.cpp
130a131
>     , fExternalElement (false)
Index: xml-xerces/c/src/framework/XMLElementDecl.hpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/framework/XMLElementDecl.hpp,v
retrieving revision 1.5
diff -r1.5 XMLElementDecl.hpp
344a345,354
>     /** Indicate whether this element type has been declared externally
>       *
>       * This method returns a boolean that indicates whether this element
>       * has been declared externally.
>       *
>       * @return true if this element has been declared externally, else false.
>       */
> 
>     bool isExternal() const;
> 
387a398,403
> 
>     /** Set the element decl to indicate external declaration
>       *
>       */
>     void setExternalElemDeclaration();
> 
484a501,504
>     //
>     //  fExternalElement
>     //      This flag indicates whether or the element was declared 
externally.
>     //
489a510
>     bool                fExternalElement;
539a561,565
> inline bool XMLElementDecl::isExternal() const
> {
>     return fExternalElement;
> }
> 
559a586,592
> 
> 
> inline void XMLElementDecl::setExternalElemDeclaration()
> {
>     fExternalElement = true;
> }
> 
cvs.real server: Diffing xml-xerces/c/src/internal
Index: xml-xerces/c/src/internal/XMLReader.cpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/internal/XMLReader.cpp,v
retrieving revision 1.12
diff -r1.12 XMLReader.cpp
170a171,189
> //  Checks whether at least one of the chars in the passed buffer are 
whitespace or
> //  not. 
> //
> bool XMLReader::containsWhiteSpace(const   XMLCh* const    toCheck
>                             , const unsigned int    count)
> {
>     const XMLCh* curCh = toCheck;
>     const XMLCh* endPtr = toCheck + count;
>     while (curCh < endPtr)
>     {
>         if (fgCharCharsTable[*curCh++] & gWhitespaceCharMask)
>             return true;
>     }
>     return false;
> }
> 
> 
> 
> //
Index: xml-xerces/c/src/internal/XMLReader.hpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/internal/XMLReader.hpp,v
retrieving revision 1.8
diff -r1.8 XMLReader.hpp
164a165,172
> 
>     static bool containsWhiteSpace
>     (
>         const   XMLCh* const    toCheck
>         , const unsigned int    count
>     );
> 
> 
Index: xml-xerces/c/src/internal/XMLScanner.cpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/internal/XMLScanner.cpp,v
retrieving revision 1.16
diff -r1.16 XMLScanner.cpp
2443a2444,2455
> 		    else if (defType == XMLAttDef::Default)
>                     {
> 		      if (fStandalone)
> 		      {
> 			//
> 			// XML 1.0 Section 2.9
> 			// Document is standalone, so attributes must not be 
defaulted.
> 			//
> 			emitError(XMLErrs::BadStandalone, 
elemDecl->getFullName());
> 			
> 		      }
> 		    }
Index: xml-xerces/c/src/internal/XMLScanner2.cpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/internal/XMLScanner2.cpp,v
retrieving revision 1.12
diff -r1.12 XMLScanner2.cpp

1431a1432,1443
> 		      //
> 		      // Check Validity Constraint for Standalone document 
declaration
> 		      // XML 1.0, Section 2.9
> 		      //
> 		      if (fValidate && fStandalone)
> 		      {
> 			// 
> 			// Can't have a standalone document declaration of "yes" 
if  attribute
> 			// values are subject to normalisation
> 			//
> 			emitError(XMLErrs::BadStandalone);
> 		      }

1514a1527,1534
> 	if (fValidate && fStandalone && (XMLReader::isWhitespace(nextCh)))
> 	{
> 	  //
> 	  // This document is standalone; this ignorable CDATA whitespace is 
forbidden.
>           // XML 1.0, Section 2.9
> 	  //
> 	    emitError(XMLErrs::BadStandalone);
> 	}
>
1769a1790,1821
>     //
>     // Check the validity constraints as per XML 1.0 Section 2.9
>     //
> 
>     const XMLCh* rawBuf = toUse.getRawBuffer();
>     const unsigned int len = toUse.getLen();
> 
>     if (fValidate)
>     {
>       // See if the text contains whitespace
>       // Get the raw data we need for the callback
>       const bool isSpaces = XMLReader::containsWhiteSpace(rawBuf, len);
>       if (isSpaces)
>       {
>         // And see if the current element is a 'Children' style content model
>         const ElemStack::StackElem* topElem = fElemStack.topElement();
> 
>         // Get the character data opts for the current element
>         XMLElementDecl::CharDataOpts charOpts = 
topElem->fThisElement->getCharDataOpts();
> 
> 	if (charOpts == XMLElementDecl::SpacesOk)  // => Element Content
> 	{
> 	  if ((fStandalone) && (topElem->fThisElement->isExternal()))
> 	  {
> 	    // Error - standalone should have a value of "no" as whitespace 
detected in an
> 	    // element type with element content whose element declaration was 
external
> 	    //
> 	    emitError(XMLErrs::BadStandalone);
> 	  }
> 	}
>       }
>     }
1866a1919,1943
>     }
> 
>     //
>     //  [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF]        // any Unicode 
character, excluding the
>     //               | [#xE000-#xFFFD] | [#x10000-#x10FFFF] // surrogate 
blocks, FFFE, and FFFF.
>     //
>     bool validChar = false;
>     if (value < 0x20) 
>     {
>       if (value == 0x09 || value == 0x0A || value == 0x0D) 
>       {
> 	validChar = true;
>       }
>     } 
>     else if (value <= 0xD7FF || (value >= 0xE000 && (value <= 0xFFFD || (value 
>= 0x10000 && value <= 0x10FFFF)))) 
>     {
>       validChar = true;
>     }
> 
>     if (!validChar)
>     {
>       //
>       // Character reference was not in the valid range
>       emitError(XMLErrs::InvalidCharacterRef);
>       return false;
Index: xml-xerces/c/src/validators/DTD/DTDValidator2.cpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/validators/DTD/DTDValidator2.cpp,v
retrieving revision 1.15
diff -r1.15 DTDValidator2.cpp
3695a3696,3707
>     //
>     // [78] Encoding declarations are required in the external entity
>     // if there is a text declaration present
>     // 
>     if (!fInternalSubset && !gotEncoding)
>     {
>       getScanner()->emitError(XMLErrs::BadXMLEncoding);
>       getReaderMgr()->skipPastChar(chCloseAngle);
>       return;
> 
>     }
> 


----------------------------------------------------
Sean MacRoibeaird
XML Technology Centre
Sun Microsystems,
East Point Business Park,
Dublin 3,
Ireland

Phone: x19173/+353 1 8199173
e-mail: sean.macroibeaird@ireland.sun.com