peiyongz    2004/05/25 11:10:33

  Modified:    c/src/xercesc/validators/schema TraverseSchema.cpp
                        TraverseSchema.hpp
  Log:
  XML1.0 3rd: 4.2.2 ...Since escaping is not always a fully reversible process,
  it must be performed only when absolutely necessary and as late as possible
  in a processing chain...
  
  Revision  Changes    Path
  1.114     +10 -3     xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.cpp
  
  Index: TraverseSchema.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.cpp,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- TraverseSchema.cpp        22 Apr 2004 10:47:21 -0000      1.113
  +++ TraverseSchema.cpp        25 May 2004 18:10:32 -0000      1.114
  @@ -94,6 +94,7 @@
   #include <xercesc/dom/impl/XSDElementNSImpl.hpp>
   #include <xercesc/util/OutOfMemoryException.hpp>
   #include <xercesc/util/XMLEntityResolver.hpp>
  +#include <xercesc/util/XMLUri.hpp>
   #include <xercesc/framework/psvi/XSAnnotation.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -6495,7 +6496,7 @@
       InputSource* srcToFill = 0;
       XMLCh* normalizedURI = 0;
       if (loc) {
  -        normalizeURI(loc, fBuffer);
  +        XMLString::removeChar(loc, 0xFFFF, fBuffer);
           normalizedURI = fBuffer.getRawBuffer();
       }
   
  @@ -6515,11 +6516,17 @@
               (urlTmp.isRelative()))
           {
              if (!fScanner->getStandardUriConformant())
  +           {
  +               XMLCh* tempURI = XMLString::replicate(normalizedURI, fMemoryManager);
  +               ArrayJanitor<XMLCh> tempURIName(tempURI, fMemoryManager);
  +               XMLUri::normalizeURI(tempURI, fBuffer);
  +
                   srcToFill = new (fMemoryManager) LocalFileInputSource
                   (   fSchemaInfo->getCurrentSchemaURL()
  -                    , normalizedURI                    
  +                    , fBuffer.getRawBuffer()
                       , fMemoryManager
                   );
  +           }
               else
                   ThrowXMLwithMemMgr(MalformedURLException, 
XMLExcepts::URL_MalformedURL, fMemoryManager);            
           }
  
  
  
  1.34      +1 -31     xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.hpp
  
  Index: TraverseSchema.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.hpp,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- TraverseSchema.hpp        29 Jan 2004 11:52:31 -0000      1.33
  +++ TraverseSchema.hpp        25 May 2004 18:10:32 -0000      1.34
  @@ -723,10 +723,6 @@
   
       void processAttValue(const XMLCh* const attVal, XMLBuffer& aBuf);
   
  -    // Spaces are not allowed in URI, so %20 is used instead.
  -    // Convert %20 to spaces before resolving the URI
  -    void normalizeURI(const XMLCh* const systemURI, XMLBuffer& normalizedURI);
  -
       // -----------------------------------------------------------------------
       //  Private constants
       // -----------------------------------------------------------------------
  @@ -947,32 +943,6 @@
   
       for (int i=0; i < redefineCounter; i++) {
           newTypeName.append(SchemaSymbols::fgRedefIdentifier);
  -    }
  -}
  -
  -inline void TraverseSchema::normalizeURI(const XMLCh* const systemURI,
  -                                         XMLBuffer& normalizedURI)
  -{
  -    const XMLCh* pszSrc = systemURI;
  -
  -    normalizedURI.reset();
  -
  -    while (*pszSrc) {
  -
  -        if ((*(pszSrc) == chPercent)
  -        &&  (*(pszSrc+1) == chDigit_2)
  -        &&  (*(pszSrc+2) == chDigit_0))
  -        {
  -            pszSrc += 3;
  -            normalizedURI.append(chSpace);
  -        }
  -        else if (*pszSrc == 0xFFFF) { //escaped character
  -            pszSrc++;
  -        }
  -        else {
  -            normalizedURI.append(*pszSrc);
  -            pszSrc++;
  -        }
       }
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to