You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2007/12/17 17:52:04 UTC

svn commit: r604927 - in /xerces/c/trunk: doc/ src/xercesc/dom/impl/ src/xercesc/internal/ src/xercesc/util/regx/ src/xercesc/validators/schema/

Author: cargilld
Date: Mon Dec 17 08:52:03 2007
New Revision: 604927

URL: http://svn.apache.org/viewvc?rev=604927&view=rev
Log:
Various fixes

Modified:
    xerces/c/trunk/doc/program-dom.xml
    xerces/c/trunk/doc/program-sax.xml
    xerces/c/trunk/doc/program-sax2.xml
    xerces/c/trunk/src/xercesc/dom/impl/DOMImplementationRegistry.cpp
    xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
    xerces/c/trunk/src/xercesc/util/regx/ParserForXMLSchema.cpp
    xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp

Modified: xerces/c/trunk/doc/program-dom.xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/program-dom.xml?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/doc/program-dom.xml (original)
+++ xerces/c/trunk/doc/program-dom.xml Mon Dec 17 08:52:03 2007
@@ -625,6 +625,17 @@
                 <tr><th><em>see:</em></th><td>
                 <link anchor="use-cached">useCachedGrammarInParse</link></td></tr>
             </table>
+            <p/>
+            
+            <anchor name="XercesHandleMultipleImports"/>
+            <table>            
+                <tr><th colspan="2"><em>setHandleMultipleImports</em></th></tr>
+                <tr><th><em>true:</em></th><td> During schema validation allow multiple schemas with the same namespace
+                                                to be imported.</td></tr>            
+                <tr><th><em>false:</em></th><td> Don't import multiple schemas with the same namespace. </td></tr>
+                <tr><th><em>default:</em></th><td> false </td></tr>                                
+            </table>            
+            <p/>
                         
             <anchor name="CreateSchemaInfo"/>
             <table>
@@ -1385,6 +1396,17 @@
             </table>
             <p/>              
             
+            <anchor name="builder-HandleMultipleImports"/>
+            <table>            
+                <tr><th colspan="2"><em>http://apache.org/xml/features/validation/schema/handle-multiple-imports</em></th></tr>
+                <tr><th><em>true:</em></th><td> During schema validation allow multiple schemas with the same namespace
+                                                to be imported.</td></tr>            
+                <tr><th><em>false:</em></th><td> Don't import multiple schemas with the same namespace. </td></tr>
+                <tr><th><em>default:</em></th><td> false </td></tr>  
+                <tr><th><em>XMLUni Predefined Constant:</em></th><td> fgXercesHandleMultipleImports </td></tr>                              
+            </table>   
+            <p/>           
+                        
             <anchor name="builder-DOMHasPsviInfo"/>
             <table>
                 <tr><th colspan="2"><em>http://apache.org/xml/features/dom-has-psvi-info</em></th></tr>

Modified: xerces/c/trunk/doc/program-sax.xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/program-sax.xml?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/doc/program-sax.xml (original)
+++ xerces/c/trunk/doc/program-sax.xml Mon Dec 17 08:52:03 2007
@@ -418,7 +418,17 @@
                 <link anchor="use-cached">useCachedGrammarInParse</link></td></tr>
             </table>
             <p/>
-                        
+            
+            <anchor name="XercesHandleMultipleImports"/>
+            <table>            
+                <tr><th colspan="2"><em>setHandleMultipleImports</em></th></tr>
+                <tr><th><em>true:</em></th><td> During schema validation allow multiple schemas with the same namespace
+                                                to be imported.</td></tr>            
+                <tr><th><em>false:</em></th><td> Don't import multiple schemas with the same namespace. </td></tr>
+                <tr><th><em>default:</em></th><td> false </td></tr>                                
+            </table>   
+            <p/>         
+                                    
             <table>
                 <tr><th colspan="2"><em>void setExternalSchemaLocation(const XMLCh* const)</em></th></tr>
                 <tr><th><em>Description</em></th><td> The XML Schema Recommendation explicitly states that

Modified: xerces/c/trunk/doc/program-sax2.xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/program-sax2.xml?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/doc/program-sax2.xml (original)
+++ xerces/c/trunk/doc/program-sax2.xml Mon Dec 17 08:52:03 2007
@@ -471,6 +471,17 @@
                 </td></tr>
             </table>
             <p/>              
+            
+            <anchor name="builder-HandleMultipleImports"/>
+            <table>            
+                <tr><th colspan="2"><em>http://apache.org/xml/features/validation/schema/handle-multiple-imports</em></th></tr>
+                <tr><th><em>true:</em></th><td> During schema validation allow multiple schemas with the same namespace
+                                                to be imported.</td></tr>            
+                <tr><th><em>false:</em></th><td> Don't import multiple schemas with the same namespace. </td></tr>
+                <tr><th><em>default:</em></th><td> false </td></tr>  
+                <tr><th><em>XMLUni Predefined Constant:</em></th><td> fgXercesHandleMultipleImports </td></tr>                              
+            </table>   
+            <p/>                       
             </s4>
         </s3>
 

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMImplementationRegistry.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMImplementationRegistry.cpp?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMImplementationRegistry.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMImplementationRegistry.cpp Mon Dec 17 08:52:03 2007
@@ -126,10 +126,11 @@
     unsigned int len = getDOMImplSrcVector()->size();
 
     // Put our defined source there
-    if (len == 0)
+    if (len == 0) {
         getDOMImplSrcVector()->addElement((DOMImplementationSource*)DOMImplementationImpl::getDOMImplementationImpl());
 
-    len = getDOMImplSrcVector()->size();
+        len = getDOMImplSrcVector()->size();
+    }
 
     for (unsigned int i = len; i > 0; i--) {
         DOMImplementationSource* source = getDOMImplSrcVector()->elementAt(i-1);

Modified: xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp Mon Dec 17 08:52:03 2007
@@ -345,7 +345,10 @@
                     break;
 
                 case Token_StartTag :
-                    scanStartTag(gotData);
+                    if (fDoNamespaces)
+                        scanStartTagNS(gotData);
+                    else
+                        scanStartTag(gotData);
                     break;
 
                 default :
@@ -541,7 +544,10 @@
                         break;
 
                     case Token_StartTag :
-                        scanStartTag(gotData);
+                        if (fDoNamespaces)
+                            scanStartTagNS(gotData);
+                        else
+                            scanStartTag(gotData);
                         break;
 
                     default :
@@ -1068,10 +1074,458 @@
 
     //  Get the QName. In this case, we are not doing namespaces, so we just
     //  use it as is and don't have to break it into parts.
+    
+    bool validName = fReaderMgr.getName(fQNameBuf);
+    if (!validName)
+    {
+        if (fQNameBuf.isEmpty())
+            emitError(XMLErrs::ExpectedElementName);
+        else
+            emitError(XMLErrs::InvalidElementName, fQNameBuf.getRawBuffer());        
+        fReaderMgr.skipToChar(chOpenAngle);
+        return false;
+    }
+
+    // Assume it won't be an empty tag
+    bool isEmpty = false;
+
+    // See if its the root element
+    const bool isRoot = fElemStack.isEmpty();
+
+    //  Lets try to look up the element in the validator's element decl pool
+    //  We can pass bogus values for the URI id and the base name. We know that
+    //  this can only be called if we are doing a DTD style validator and that
+    //  he will only look at the QName.
+    //
+    //  We *do not* tell him to fault in a decl if he does not find one - NG.
+    bool wasAdded = false;
+    const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); 
+
+    XMLElementDecl* elemDecl = fGrammar->getElemDecl
+    (
+        fEmptyNamespaceId
+        , 0
+        , qnameRawBuf
+        , Grammar::TOP_LEVEL_SCOPE
+    );
+    // look in the undeclared pool:
+    if(!elemDecl) 
+    {
+        elemDecl = fDTDElemNonDeclPool->getByKey(qnameRawBuf);
+    }
+    if(!elemDecl) 
+    {
+        wasAdded = true;
+        elemDecl = new (fMemoryManager) DTDElementDecl 
+        (
+            qnameRawBuf
+            , fEmptyNamespaceId
+            , DTDElementDecl::Any
+            , fMemoryManager
+        );
+        elemDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)elemDecl));
+    }
+
+    if (fValidate) {
+
+        if (wasAdded)
+        {
+            // This is to tell the reuse Validator that this element was
+            // faulted-in, was not an element in the validator pool originally
+            elemDecl->setCreateReason(XMLElementDecl::JustFaultIn);
+
+            fValidator->emitError
+            (
+                XMLValid::ElementNotDefined
+                , qnameRawBuf
+            );
+        }
+        // If its not marked declared, then emit an error
+        else if (!elemDecl->isDeclared())
+        {
+            fValidator->emitError
+            (
+                XMLValid::ElementNotDefined
+                , qnameRawBuf
+            );
+        }
+
+
+        fValidator->validateElement(elemDecl);
+    }
+
+    // Expand the element stack and add the new element
+    fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum());
+
+    //  If this is the first element and we are validating, check the root
+    //  element.
+    if (isRoot)
+    {
+        fRootGrammar = fGrammar;
+
+        if (fValidate)
+        {
+            //  If a DocType exists, then check if it matches the root name there.
+            if (fRootElemName && !XMLString::equals(qnameRawBuf, fRootElemName))
+                fValidator->emitError(XMLValid::RootElemNotLikeDocType);
+        }
+    }
+    else if (fValidate)
+    {
+        //  If the element stack is not empty, then add this element as a
+        //  child of the previous top element. If its empty, this is the root
+        //  elem and is not the child of anything.
+        fElemStack.addChild(elemDecl->getElementName(), true);
+    }
+
+    // Skip any whitespace after the name
+    fReaderMgr.skipPastSpaces();
+
+    //  We loop until we either see a /> or >, handling attribute/value
+    //  pairs until we get there.
+    unsigned int    attCount = 0;
+    unsigned int    curAttListSize = fAttrList->size();
+    wasAdded = false;
+
+    fElemCount++;
+
+    while (true)
+    {
+        // And get the next non-space character
+        XMLCh nextCh = fReaderMgr.peekNextChar();
+
+        //  If the next character is not a slash or closed angle bracket,
+        //  then it must be whitespace, since whitespace is required
+        //  between the end of the last attribute and the name of the next
+        //  one.
+        if (attCount)
+        {
+            if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle))
+            {
+                if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh))
+                {
+                    // Ok, skip by them and peek another char
+                    fReaderMgr.skipPastSpaces();
+                    nextCh = fReaderMgr.peekNextChar();
+                }
+                 else
+                {
+                    // Emit the error but keep on going
+                    emitError(XMLErrs::ExpectedWhitespace);
+                }
+            }
+        }
+
+        //  Ok, here we first check for any of the special case characters.
+        //  If its not one, then we do the normal case processing, which
+        //  assumes that we've hit an attribute value, Otherwise, we do all
+        //  the special case checks.
+        if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh))
+        {
+            //  Assume its going to be an attribute, so get a name from
+            //  the input.
+    
+            validName = fReaderMgr.getName(fAttNameBuf);                
+            if (!validName)            
+            {
+                if (fAttNameBuf.isEmpty())
+                    emitError(XMLErrs::ExpectedAttrName);
+                else
+                    emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer());                 
+                fReaderMgr.skipPastChar(chCloseAngle);
+                return false;
+            }
+
+            // And next must be an equal sign
+            if (!scanEq())
+            {
+                static const XMLCh tmpList[] =
+                {
+                    chSingleQuote, chDoubleQuote, chCloseAngle
+                    , chOpenAngle, chForwardSlash, chNull
+                };
+
+                emitError(XMLErrs::ExpectedEqSign);
+
+                //  Try to sync back up by skipping forward until we either
+                //  hit something meaningful.
+                const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList);
+
+                if ((chFound == chCloseAngle) || (chFound == chForwardSlash))
+                {
+                    // Jump back to top for normal processing of these
+                    continue;
+                }
+                else if ((chFound == chSingleQuote)
+                      ||  (chFound == chDoubleQuote)
+                      ||  fReaderMgr.getCurrentReader()->isWhitespace(chFound))
+                {
+                    // Just fall through assuming that the value is to follow
+                }
+                else if (chFound == chOpenAngle)
+                {
+                    // Assume a malformed tag and that new one is starting
+                    emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName());
+                    return false;
+                }
+                else
+                {
+                    // Something went really wrong
+                    return false;
+                }
+            }
+
+            //  See if this attribute is declared for this element. If we are
+            //  not validating of course it will not be at first, but we will
+            //  fault it into the pool (to avoid lots of redundant errors.)
+            XMLCh * namePtr = fAttNameBuf.getRawBuffer();
+            XMLAttDef* attDef = ((DTDElementDecl *)elemDecl)->getAttDef(namePtr);
+
+            //  Skip any whitespace before the value and then scan the att
+            //  value. This will come back normalized with entity refs and
+            //  char refs expanded.
+            fReaderMgr.skipPastSpaces();
+            if (!scanAttValue(attDef, namePtr, fAttValueBuf))
+            {
+                static const XMLCh tmpList[] =
+                {
+                    chCloseAngle, chOpenAngle, chForwardSlash, chNull
+                };
+
+                emitError(XMLErrs::ExpectedAttrValue);
+
+                //  It failed, so lets try to get synced back up. We skip
+                //  forward until we find some whitespace or one of the
+                //  chars in our list.
+                const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList);
+
+                if ((chFound == chCloseAngle)
+                ||  (chFound == chForwardSlash)
+                ||  fReaderMgr.getCurrentReader()->isWhitespace(chFound))
+                {
+                    //  Just fall through and process this attribute, though
+                    //  the value will be "".
+                }
+                else if (chFound == chOpenAngle)
+                {
+                    // Assume a malformed tag and that new one is starting
+                    emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName());
+                    return false;
+                }
+                else
+                {
+                    // Something went really wrong
+                    return false;
+                }
+            }
+
+            //  Add this attribute to the attribute list that we use to
+            //  pass them to the handler. We reuse its existing elements
+            //  but expand it as required.
+            // Note that we want to this first since this will
+            // make a copy of the namePtr; we can then make use of
+            // that copy in the hashtable lookup that checks
+            // for duplicates.  This will mean we may have to update
+            // the type of the XMLAttr later.
+            XMLAttr* curAtt;
+            const XMLCh* attrValue = fAttValueBuf.getRawBuffer();
+
+            if (attCount >= curAttListSize) {
+                curAtt = new (fMemoryManager) XMLAttr(fMemoryManager);
+                fAttrList->addElement(curAtt);
+            }
+            else {
+                curAtt = fAttrList->elementAt(attCount);
+            }
+
+            curAtt->setSpecified(true);
+
+            // NO NAMESPACE CODE
+            {
+                curAtt->set(
+                    0, namePtr, XMLUni::fgZeroLenString, XMLUni::fgZeroLenString
+                    , (attDef)?attDef->getType():XMLAttDef::CData
+                );
+
+                // now need to prepare for duplicate detection
+                if (attDef) {
+                    unsigned int *curCountPtr = fAttDefRegistry->get(attDef);
+                    if (!curCountPtr) {
+                        curCountPtr = getNewUIntPtr();
+                        *curCountPtr = fElemCount;
+                        fAttDefRegistry->put(attDef, curCountPtr);
+                    }
+                    else if (*curCountPtr < fElemCount) {
+                        *curCountPtr = fElemCount;
+                    }
+                    else {
+                        emitError( 
+                            XMLErrs::AttrAlreadyUsedInSTag
+                            , attDef->getFullName(), elemDecl->getFullName()
+                        );
+                    }
+                }
+                else
+                {
+                    // reset namePtr so it refers to newly-allocated memory
+                    namePtr = (XMLCh *)curAtt->getQName();
+                    if (!fUndeclaredAttrRegistry->containsKey(namePtr)) {
+                        fUndeclaredAttrRegistry->put((void *)namePtr, 0);
+                    }
+                    else
+                    {
+                        emitError( 
+                            XMLErrs::AttrAlreadyUsedInSTag
+                            , namePtr, elemDecl->getFullName()
+                        );
+                    }
+                }
+            }
+
+            if (fValidate)
+            {
+                if (attDef) {
+                    // Let the validator pass judgement on the attribute value
+                    fValidator->validateAttrValue(
+                        attDef, fAttValueBuf.getRawBuffer(), false, elemDecl
+                    );
+                }
+                else
+                {
+                    fValidator->emitError
+                    (
+                        XMLValid::AttNotDefinedForElement
+                        , fAttNameBuf.getRawBuffer(), qnameRawBuf
+                    );
+                }
+            }
+
+            // must set the newly-minted value on the XMLAttr:
+            curAtt->setValue(attrValue);
+            attCount++;
+
+            // And jump back to the top of the loop
+            continue;
+        }
+
+        //  It was some special case character so do all of the checks and
+        //  deal with it.
+        if (!nextCh)
+            ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager);
+
+        if (nextCh == chForwardSlash)
+        {
+            fReaderMgr.getNextChar();
+            isEmpty = true;
+            if (!fReaderMgr.skippedChar(chCloseAngle))
+                emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName());
+            break;
+        }
+        else if (nextCh == chCloseAngle)
+        {
+            fReaderMgr.getNextChar();
+            break;
+        }
+        else if (nextCh == chOpenAngle)
+        {
+            //  Check for this one specially, since its going to be common
+            //  and it is kind of auto-recovering since we've already hit the
+            //  next open bracket, which is what we would have seeked to (and
+            //  skipped this whole tag.)
+            emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName());
+            break;
+        }
+        else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote))
+        {
+            //  Check for this one specially, which is probably a missing
+            //  attribute name, e.g. ="value". Just issue expected name
+            //  error and eat the quoted string, then jump back to the
+            //  top again.
+            emitError(XMLErrs::ExpectedAttrName);
+            fReaderMgr.getNextChar();
+            fReaderMgr.skipQuotedString(nextCh);
+            fReaderMgr.skipPastSpaces();
+            continue;
+        }
+    }
+
+    if(attCount)
+    {
+        // clean up after ourselves:
+        // clear the map used to detect duplicate attributes
+        fUndeclaredAttrRegistry->removeAll();
+    }
+
+    //  Now lets get the fAttrList filled in. This involves faulting in any
+    //  defaulted and fixed attributes and normalizing the values of any that
+    //  we got explicitly.
+    //
+    //  We update the attCount value with the total number of attributes, but
+    //  it goes in with the number of values we got during the raw scan of
+    //  explictly provided attrs above.
+    attCount = buildAttList(attCount, elemDecl, *fAttrList);
+
+    //  If we have a document handler, then tell it about this start tag. We
+    //  don't have any URI id to send along, so send fEmptyNamespaceId. We also do not send
+    //  any prefix since its just one big name if we are not doing namespaces.
+    unsigned int uriId = fEmptyNamespaceId;
+    if (fDocHandler)
+    {
+        fDocHandler->startElement
+        (
+            *elemDecl
+            , uriId
+            , 0
+            , *fAttrList
+            , attCount
+            , isEmpty
+            , isRoot
+        );
+    }
+
+    //  If empty, validate content right now if we are validating and then
+    //  pop the element stack top. Else, we have to update the current stack
+    //  top's namespace mapping elements.
+    if (isEmpty)
+    {
+        // If validating, then insure that its legal to have no content
+        if (fValidate)
+        {
+            const int res = fValidator->checkContent(elemDecl, 0, 0);
+            if (res >= 0)
+            {
+                fValidator->emitError
+                (
+                    XMLValid::ElementNotValidForContent
+                    , qnameRawBuf
+                    , elemDecl->getFormattedContentModel()
+                );
+            }
+        }
+
+        // Pop the element stack back off since it'll never be used now
+        fElemStack.popTop();
+
+        // If the elem stack is empty, then it was an empty root
+        if (isRoot)
+            gotData = false;
+    }
+
+    return true;
+}
+
+
+bool DGXMLScanner::scanStartTagNS(bool& gotData)
+{
+    //  Assume we will still have data until proven otherwise. It will only
+    //  ever be false if this is the root and its empty.
+    gotData = true;
+
+    //  Get the QName. In this case, we are not doing namespaces, so we just
+    //  use it as is and don't have to break it into parts.
 
     int  colonPosition;
-    bool validName = fDoNamespaces ? fReaderMgr.getQName(fQNameBuf, &colonPosition) :
-                                     fReaderMgr.getName(fQNameBuf);
+    bool validName = fReaderMgr.getQName(fQNameBuf, &colonPosition);
     if (!validName)
     {
         if (fQNameBuf.isEmpty())
@@ -1221,8 +1675,7 @@
             //  Assume its going to be an attribute, so get a name from
             //  the input.
     
-            validName = fDoNamespaces ? fReaderMgr.getQName(fAttNameBuf, &colonPosition) :
-                                        fReaderMgr.getName(fAttNameBuf);                
+            validName = fReaderMgr.getQName(fAttNameBuf, &colonPosition);                
             if (!validName)            
             {
                 if (fAttNameBuf.isEmpty())
@@ -1336,7 +1789,8 @@
             }
 
             curAtt->setSpecified(true);
-            if (fDoNamespaces) {
+            // DO NAMESPACES
+            {
                 curAtt->set(
                     fEmptyNamespaceId, namePtr, XMLUni::fgZeroLenString
                     , (attDef)? attDef->getType() : XMLAttDef::CData
@@ -1377,46 +1831,6 @@
                     }
                 }
             }
-            else {
-                curAtt->set(
-                    0, namePtr, XMLUni::fgZeroLenString, XMLUni::fgZeroLenString
-                    , (attDef)?attDef->getType():XMLAttDef::CData
-                );
-
-                // now need to prepare for duplicate detection
-                if (attDef) {
-                    unsigned int *curCountPtr = fAttDefRegistry->get(attDef);
-                    if (!curCountPtr) {
-                        curCountPtr = getNewUIntPtr();
-                        *curCountPtr = fElemCount;
-                        fAttDefRegistry->put(attDef, curCountPtr);
-                    }
-                    else if (*curCountPtr < fElemCount) {
-                        *curCountPtr = fElemCount;
-                    }
-                    else {
-                        emitError( 
-                            XMLErrs::AttrAlreadyUsedInSTag
-                            , attDef->getFullName(), elemDecl->getFullName()
-                        );
-                    }
-                }
-                else
-                {
-                    // reset namePtr so it refers to newly-allocated memory
-                    namePtr = (XMLCh *)curAtt->getQName();
-                    if (!fUndeclaredAttrRegistry->containsKey(namePtr)) {
-                        fUndeclaredAttrRegistry->put((void *)namePtr, 0);
-                    }
-                    else
-                    {
-                        emitError( 
-                            XMLErrs::AttrAlreadyUsedInSTag
-                            , namePtr, elemDecl->getFullName()
-                        );
-                    }
-                }
-            }
 
             if (fValidate)
             {
@@ -1486,7 +1900,7 @@
     }
 
     //  Make an initial pass through the list and find any xmlns attributes.
-    if (fDoNamespaces && attCount)
+    if (attCount)
       scanAttrListforNameSpaces(fAttrList, attCount, elemDecl);
 
     if(attCount)
@@ -1511,20 +1925,17 @@
     unsigned int uriId = fEmptyNamespaceId;
     if (fDocHandler)
     {
-        if (fDoNamespaces)
-        {
             uriId = resolvePrefix
             (
                 elemDecl->getElementName()->getPrefix()
                 , ElemStack::Mode_Element
-            );
-        }
+            );        
 
         fDocHandler->startElement
         (
             *elemDecl
             , uriId
-            , (fDoNamespaces) ? elemDecl->getElementName()->getPrefix() : 0
+            , elemDecl->getElementName()->getPrefix()
             , *fAttrList
             , attCount
             , isEmpty
@@ -1968,8 +2379,7 @@
                             curAtt = new (fMemoryManager) XMLAttr
                             (
                                 fEmptyNamespaceId
-                                , curDef.getFullName()
-                                , XMLUni::fgZeroLenString
+                                , curDef.getFullName()                               
                                 , curDef.getValue()
                                 , curDef.getType()
                                 , false

Modified: xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLReader.cpp?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLReader.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLReader.cpp Mon Dec 17 08:52:03 2007
@@ -588,9 +588,15 @@
     //  Calculate fCharOfsBuf using the elements from fCharBufSize
     if (fCalculateSrcOfs)
     {
+        unsigned int last = 0;
         fCharOfsBuf[0] = 0;
         for (XMLSize_t index = 1; index < fCharsAvail; ++index) {
-            fCharOfsBuf[index] = fCharOfsBuf[index-1]+fCharSizeBuf[index-1];
+            fCharOfsBuf[index] = last+fCharSizeBuf[index-1];
+            last = fCharOfsBuf[index];
+            // code was:
+            // fCharOfsBuf[index] = fCharOfsBuf[index-1]+fCharSizeBuf[index-1];
+            // but on Solaris 64 bit with sun studio 11 this didn't work as
+            // every value of fCharOfsBuf[] was 1.
         }
     }
 

Modified: xerces/c/trunk/src/xercesc/util/regx/ParserForXMLSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/ParserForXMLSchema.cpp?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/ParserForXMLSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/ParserForXMLSchema.cpp Mon Dec 17 08:52:03 2007
@@ -415,9 +415,11 @@
 
     switch(ch) {
     case chLatin_d:
-        return getTokenFactory()->getRange(fgXMLDigit);
+        return getTokenFactory()->getRange(fgUniDecimalDigit);
+        //return getTokenFactory()->getRange(fgXMLDigit);
     case chLatin_D:
-        return getTokenFactory()->getRange(fgXMLDigit, true);
+        return getTokenFactory()->getRange(fgUniDecimalDigit, true);
+        //return getTokenFactory()->getRange(fgXMLDigit, true);
     case chLatin_w:
         return getTokenFactory()->getRange(fgXMLWord);
     case chLatin_W:

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Mon Dec 17 08:52:03 2007
@@ -102,7 +102,7 @@
     const SchemaElementDecl::ModelTypes modelType = (currType)
             ? (SchemaElementDecl::ModelTypes)(currType->getContentType())
             : ((SchemaElementDecl*)elemDecl)->getModelType();
-   
+
     if (modelType == SchemaElementDecl::Empty  ||
         modelType == SchemaElementDecl::ElementOnlyEmpty)
     {
@@ -143,7 +143,7 @@
                                                       , emptyNS
                                                       , fGrammarResolver
                                                       , fGrammarResolver->getStringPool()
-                                                      , getScanner()->getMemoryManager());
+													  , getScanner()->getMemoryManager());
             }
 
             if(result != -1) {
@@ -194,18 +194,15 @@
                         //  the notation pool (after the Grammar is parsed), then obviously
                         //  this value will be legal since it matches one of them.
                         int colonPos = -1;
-                        unsigned int uriId = getScanner()->resolveQName(value, *fNotationBuf, ElemStack::Mode_Element, colonPos);
+                        unsigned int uriId = getScanner()->resolveQName(value, *fNotationBuf, ElemStack::Mode_Element, colonPos);                        
+
                         const XMLCh* uriText = getScanner()->getURIText(uriId);
                         if (uriText && *uriText) {
-                            fNotationBuf->set(getScanner()->getURIText(uriId));
-                            fNotationBuf->append(chColon);
+                            fNotationBuf->set(uriText);
+                            fNotationBuf->append(chColon);                                
                             fNotationBuf->append(&value[colonPos + 1]);
-                        }
-                        else {
-                            fNotationBuf->set(value);
-                        }
-                        
-                        value = fNotationBuf->getRawBuffer();
+                            value = fNotationBuf->getRawBuffer();
+                        }                        
                     }
 
                     if (elemDefaultValue)
@@ -430,7 +427,7 @@
                 }
                 else {
                     notationBuf.set(attrValue);
-                }                
+                }
 
                 attDefDV->validate(notationBuf.getRawBuffer()
                                  , context
@@ -1716,9 +1713,7 @@
 
     // Now, see if there are some elements in the base we didn't match up
     // in case of Sequence or All
-    if (!toLax && codeToThrow == XMLExcepts::NoError &&
-        (baseType & 0x0f) == ContentSpecNode::All || derivedSpecNodeIn->getElement()->getURI() != XMLElementDecl::fgPCDataElemId) 
-    {
+    if (!toLax && codeToThrow == XMLExcepts::NoError) {
         for (unsigned int j = current; j < count2; j++) {
             if (baseNodes->elementAt(j)->getMinTotalRange() * baseSpecNode->getMinOccurs()) { //!emptiable
                 codeToThrow =  XMLExcepts::PD_Recurse2;                

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=604927&r1=604926&r2=604927&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Dec 17 08:52:03 2007
@@ -3245,6 +3245,8 @@
 
             if (content->getNodeType() == DOMNode::ELEMENT_NODE) {
 
+                NamespaceScopeManager nsMgr(content, fSchemaInfo, this);
+
                 const XMLCh* facetName = content->getLocalName();
 
                 bool bContinue=false;   // workaround for Borland bug with 'continue' in 'catch'



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