dbertoni    00/05/12 11:21:45

  Modified:    c/src/XSLT Stylesheet.cpp StylesheetConstructionContext.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
                        StylesheetHandler.cpp StylesheetRoot.cpp
                        XSLTEngineImpl.cpp XSLTEngineImpl.hpp
                        XSLTInputSource.cpp
                        XSLTProcessorEnvSupportDefault.cpp
  Log:
  Moved all URI/URL support code into PlatformSupport.
  
  Revision  Changes    Path
  1.17      +7 -3      xml-xalan/c/src/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Stylesheet.cpp    2000/05/09 17:05:15     1.16
  +++ Stylesheet.cpp    2000/05/12 18:21:31     1.17
  @@ -147,11 +147,15 @@
   {
        if (length(m_baseIdent) != 0)
        {
  -             const XMLURL* const url = 
constructionContext.getURLFromString(m_baseIdent);
  +             typedef StylesheetConstructionContext::URLAutoPtrType   
URLAutoPtrType;
   
  -             if (url != 0)
  +             URLAutoPtrType  url = 
constructionContext.getURLFromString(m_baseIdent);
  +
  +             if (url.get() != 0)
                {
  -                     m_includeStack.push_back(url);
  +                     m_includeStack.push_back(url.get());
  +
  +                     url.release();
                }
        }
   }
  
  
  
  1.6       +10 -5     xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp
  
  Index: StylesheetConstructionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StylesheetConstructionContext.hpp 2000/05/01 15:13:10     1.5
  +++ StylesheetConstructionContext.hpp 2000/05/12 18:21:32     1.6
  @@ -71,13 +71,16 @@
   
   
   
  +#include <PlatformSupport/URISupport.hpp>
  +
  +
  +
   #include <XalanDOM/XalanDOMString.hpp>
   
   
   
   class PrefixResolver;
   class StylesheetRoot;
  -class XMLURL;
   class XPath;
   class XSLTInputSource;
   
  @@ -91,6 +94,8 @@
   {
   public:
   
  +     typedef URISupport::URLAutoPtrType      URLAutoPtrType;
  +
        explicit
        StylesheetConstructionContext();
   
  @@ -152,9 +157,9 @@
         * Determine the fully qualified URI for a string.
         *
         * @param urlString string to qualify
  -      * @return pointer to fully qualified URI
  +      * @return auto pointer to fully qualified URI
         */
  -     virtual XMLURL*
  +     virtual URLAutoPtrType
        getURLFromString(const XalanDOMString&  urlString) = 0;
   
        /**
  @@ -162,9 +167,9 @@
         *
         * @param urlString string to qualify
         * @param base base location for URI
  -      * @return pointer to fully qualified URI
  +      * @return auto pointer to fully qualified URI
         */
  -     virtual XMLURL*
  +     virtual URLAutoPtrType
        getURLFromString(
                        const XalanDOMString&   urlString,
                        const XalanDOMString&   base) = 0;
  
  
  
  1.5       +5 -4      
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
  
  Index: StylesheetConstructionContextDefault.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StylesheetConstructionContextDefault.cpp  2000/05/01 15:13:10     1.4
  +++ StylesheetConstructionContextDefault.cpp  2000/05/12 18:21:32     1.5
  @@ -66,6 +66,7 @@
   
   
   #include <PlatformSupport/STLHelper.hpp>
  +#include <PlatformSupport/URISupport.hpp>
   
   
   
  @@ -205,20 +206,20 @@
   
   
   
  -XMLURL*
  +StylesheetConstructionContextDefault::URLAutoPtrType
   StylesheetConstructionContextDefault::getURLFromString(const XalanDOMString& 
urlString)
   {
  -     return m_processor.getURLFromString(urlString);
  +     return URISupport::getURLFromString(urlString);
   }
   
   
   
  -XMLURL*
  +StylesheetConstructionContextDefault::URLAutoPtrType
   StylesheetConstructionContextDefault::getURLFromString(
                        const XalanDOMString&   urlString,
                        const XalanDOMString&   base)
   {
  -     return m_processor.getURLFromString(urlString, base);
  +     return URISupport::getURLFromString(urlString, base);
   }
   
   
  
  
  
  1.6       +2 -2      
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
  
  Index: StylesheetConstructionContextDefault.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StylesheetConstructionContextDefault.hpp  2000/05/01 15:13:10     1.5
  +++ StylesheetConstructionContextDefault.hpp  2000/05/12 18:21:33     1.6
  @@ -140,10 +140,10 @@
        virtual int
        getAttrTok(const XalanDOMString&        name) const;
   
  -     virtual XMLURL*
  +     virtual URLAutoPtrType
        getURLFromString(const XalanDOMString&  urlString);
   
  -     virtual XMLURL*
  +     virtual URLAutoPtrType
        getURLFromString(
                        const XalanDOMString&   urlString,
                        const XalanDOMString&   base);
  
  
  
  1.25      +13 -7     xml-xalan/c/src/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- StylesheetHandler.cpp     2000/05/11 19:07:29     1.24
  +++ StylesheetHandler.cpp     2000/05/12 18:21:33     1.25
  @@ -1116,19 +1116,22 @@
                        Stylesheet::URLStackType& includeStack = 
m_stylesheet.getIncludeStack();
                        assert(includeStack.size() > 0);
   
  -                     const XMLURL* const             hrefUrl = 
m_processor.getURLFromString(href, includeStack.back()->getURLText());
  -                     assert(hrefUrl != 0);
  +                     typedef StylesheetConstructionContext::URLAutoPtrType   
URLAutoPtrType;
   
  +                     URLAutoPtrType  hrefUrl = 
m_constructionContext.getURLFromString(href, includeStack.back()->getURLText());
  +                     assert(hrefUrl.get() != 0);
  +
                        Stylesheet::URLStackType& importStack = 
m_stylesheet.getStylesheetRoot().getImportStack();
   
  -                     if(stackContains(importStack, *hrefUrl))
  +                     if(stackContains(importStack, *hrefUrl.get()))
                        {
                                XalanDOMString 
msg(XalanDOMString(hrefUrl->getURLText()) + " is directly or indirectly 
importing itself!");
   
                                throw SAXException(toCharArray(msg));
                        }
   
  -                     importStack.push_back(hrefUrl);
  +                     importStack.push_back(hrefUrl.get());
  +                     hrefUrl.release();
   
                        const XalanDOMString    
theImportURI(hrefUrl->getURLText());
   
  @@ -1187,17 +1190,20 @@
   
                        const XalanDOMString    href = atts.getValue(i);
   
  +                     typedef StylesheetConstructionContext::URLAutoPtrType   
URLAutoPtrType;
  +
                        assert(m_stylesheet.getIncludeStack().back() != 0);
  -                     const XMLURL* const             hrefUrl = 
m_processor.getURLFromString(href, 
m_stylesheet.getIncludeStack().back()->getURLText());
  +                     URLAutoPtrType  hrefUrl = 
m_constructionContext.getURLFromString(href, 
m_stylesheet.getIncludeStack().back()->getURLText());
   
  -                     if(stackContains(m_stylesheet.getIncludeStack(), 
*hrefUrl))
  +                     if(stackContains(m_stylesheet.getIncludeStack(), 
*hrefUrl.get()))
                        {
                                XalanDOMString 
msg(XalanDOMString(hrefUrl->getURLText()) + " is directly or indirectly 
including itself!");
   
                                throw SAXException(toCharArray(msg));
                        }
   
  -                     m_stylesheet.getIncludeStack().push_back(hrefUrl);
  +                     m_stylesheet.getIncludeStack().push_back(hrefUrl.get());
  +                     hrefUrl.release();
   
                        m_processor.parseXML(*hrefUrl, this, &m_stylesheet);
   
  
  
  
  1.14      +4 -2      xml-xalan/c/src/XSLT/StylesheetRoot.cpp
  
  Index: StylesheetRoot.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StylesheetRoot.cpp        2000/05/11 19:08:35     1.13
  +++ StylesheetRoot.cpp        2000/05/12 18:21:33     1.14
  @@ -145,13 +145,15 @@
   
        if (length(baseIdentifier) != 0)
        {
  -             auto_ptr<XMLURL>        
url(constructionContext.getURLFromString(m_baseIdent));
  +             typedef StylesheetConstructionContext::URLAutoPtrType   
URLAutoPtrType;
   
  +             URLAutoPtrType  
url(constructionContext.getURLFromString(m_baseIdent));
  +
                if (url.get() != 0)
                {
                        m_baseIdent = url->getURLText();
   
  -                     auto_ptr<XMLURL>        
url2(constructionContext.getURLFromString(m_baseIdent));
  +                     URLAutoPtrType  
url2(constructionContext.getURLFromString(m_baseIdent));
   
                        if (url2.get() != 0)
                        {
  
  
  
  1.36      +3 -169    xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- XSLTEngineImpl.cpp        2000/05/11 21:39:49     1.35
  +++ XSLTEngineImpl.cpp        2000/05/12 18:21:33     1.36
  @@ -517,17 +517,8 @@
   {
        try
        {
  -#if !defined(XALAN_NO_NAMESPACES)
  -             using std::auto_ptr;
  -#endif
  -#if 0
  -             auto_ptr<XMLURL> url(getURLFromString(xsldocURLString));
  -             assert(url.get() != 0);
  -
  -             XSLTInputSource         input(url->getURLText(), 0);
  -#else
                XSLTInputSource         input(c_wstr(xsldocURLString));
  -#endif
  +
                return processStylesheet(input, constructionContext);
        }
        catch(SAXException& se)
  @@ -878,11 +869,9 @@
   
                StylesheetHandler stylesheetProcessor(*this, *stylesheet, 
constructionContext);
   
  -#if !defined(XALAN_NO_NAMESPACES)
  -             using std::auto_ptr;
  -#endif
  +             typedef StylesheetConstructionContext::URLAutoPtrType   
URLAutoPtrType;
   
  -             auto_ptr<XMLURL>        
xslURL(getURLFromString(localXSLURLString, xmlBaseIdent));
  +             URLAutoPtrType  
xslURL(constructionContext.getURLFromString(localXSLURLString, xmlBaseIdent));
   
                XSLTInputSource         inputSource(xslURL->getURLText());
   
  @@ -3571,161 +3560,6 @@
   
        return theFoundElement;
   }
  -
  -
  -
  -#if !defined(WIN32)
  -inline constXalanDOMString&
  -NormalizeURI(const XalanDOMString&   uriString)
  -{
  -     return uriString;
  -}
  -#else
  -XalanDOMString
  -NormalizeURI(const XalanDOMString&   uriString)
  -{
  -     using std::vector;
  -
  -     XalanDOMString  theResult;
  -
  -     // OK, look for a quick, cheap exit...
  -     const unsigned int      len = length(uriString);
  -     const unsigned int      index = indexOf(uriString, '\\');
  -
  -     if (index == len)
  -     {
  -             // Nothing to normalize, so we're done...
  -             theResult = uriString;
  -     }
  -     else
  -     {
  -             vector<XalanDOMChar>    theBuffer(c_wstr(uriString), 
c_wstr(uriString) + len);
  -
  -             std::replace(theBuffer.begin(), theBuffer.end(), '\\', '/');
  -
  -             theResult = XalanDOMString(&theBuffer[0], theBuffer.size());
  -     }
  -
  -     return theResult;
  -}
  -#endif
  -
  -
  -
  -XMLURL*
  -XSLTEngineImpl::getURLFromString(const XalanDOMString&       urlString) const
  -{
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::auto_ptr;
  -#endif
  -
  -     auto_ptr<XMLURL>        url(new XMLURL);
  -
  -     try 
  -     {
  -             XalanDOMString  theNormalizedURI;
  -
  -             // Let's see what sort of URI we have...
  -             const unsigned int      len = length(urlString);
  -             const unsigned int      index = indexOf(urlString, ':');
  -
  -#if !defined(WIN32)
  -             const bool                      protocolPresent = index != len;
  -#else
  -             // This test will fail if someone uses the form v:/foo/foo.xsl,
  -             // so I hope they don't do that...
  -             const bool                      protocolPresent = index != len 
&&
  -                                                                     !(index 
== 1 && charAt(urlString, index + 1) == '\\');
  -#endif
  -
  -             if (protocolPresent == true)
  -             {
  -                     theNormalizedURI = NormalizeURI(urlString);
  -             }
  -             else
  -             {
  -                     // Assume it's a file specification...
  -                     array_auto_ptr<XMLCh>   
theFullPath(XMLPlatformUtils::getFullPath(c_wstr(urlString)));
  -                     assert(theFullPath.get() != 0);
  -
  -                     theNormalizedURI =
  -#if defined(WIN32)
  -                             XALAN_STATIC_UCODE_STRING("file:///")
  -#else
  -                             XALAN_STATIC_UCODE_STRING("file://")
  -#endif
  -                                     + NormalizeURI(theFullPath.get());
  -             }
  -
  -             url->setURL(c_wstr(theNormalizedURI));
  -     }
  -     catch (...)
  -     {
  -             diag("Error! Cannot create url for: " + urlString);
  -
  -             throw;
  -     }
  -
  -     return url.release();
  -}
  -
  -
  -
  -XMLURL* XSLTEngineImpl::getURLFromString(const XalanDOMString&       
urlString, const XalanDOMString& base) const
  -{
  -     XalanDOMString  context(NormalizeURI(base));
  -
  -     if (isEmpty(context) == false)
  -     {
  -             const unsigned int      theLength = length(base);
  -
  -             const unsigned int      index = lastIndexOf(base,'/');
  -
  -             if (index < theLength)
  -             {
  -                     context = substring(context, 0, index + 1);
  -             }
  -     }
  -
  -     // OK, now let's look at the urlString...
  -
  -     // Is there a colon, indicating some sort of drive spec, or protocol?
  -     const unsigned int      theLength = length(urlString);
  -     const unsigned int      theColonIndex = indexOf(urlString, ':');
  -
  -     if (theColonIndex == theLength)
  -     {
  -             // No colon, so just use the urlString as is...
  -             context += urlString;
  -     }
  -#if defined(WIN32)
  -     else if (theColonIndex == 1 && charAt(urlString, theColonIndex + 1) == 
'\\')
  -     {
  -             // Ahh, it's a drive letter, so ignore the context...
  -             // $$$ ToDo: This is not quite right. Perhaps a
  -             // protocol can be one character?
  -             context = urlString;
  -     }
  -#endif
  -     else
  -     {
  -             // Assume it's a protocol...
  -             const XalanDOMString    theProtocol(substring(urlString, 0, 
theColonIndex));
  -
  -             if (startsWith(context, theProtocol) == true)
  -             {
  -                     // OK, everything looks good, so strip off the protocol 
and colon...
  -                     context += substring(urlString, theColonIndex + 1, 
theLength);
  -             }
  -             else
  -             {
  -                     // OK, not the same protocol, so what can we do???
  -                     context = urlString;
  -             }
  -     }
  -
  -     return getURLFromString(context);
  -}    
   
   
   
  
  
  
  1.29      +1 -20     xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
  
  Index: XSLTEngineImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XSLTEngineImpl.hpp        2000/05/01 15:13:11     1.28
  +++ XSLTEngineImpl.hpp        2000/05/12 18:21:34     1.29
  @@ -1329,26 +1329,7 @@
                        const XalanDOMString&   mimeType,
                        DispatcherFactory*              factory);
   
  -     /**
  -      * Determine the fully qualified URI for a string.
  -      *
  -      * @param urlString string to qualify
  -      * @return pointer to fully qualified URI
  -      */
  -     XMLURL*
  -     getURLFromString(const XalanDOMString&  urlString) const;
  -
  -     /**
  -      * Determine the fully qualified URI for a string.
  -      *
  -      * @param urlString string to qualify
  -      * @param base base location for URI
  -      * @return pointer to fully qualified URI
  -      */
  -     XMLURL*
  -     getURLFromString(
  -                     const XalanDOMString&   urlString,
  -                     const XalanDOMString&   base) const;
  +public:
   
        /**
         * Retrieve the XPath support object
  
  
  
  1.7       +7 -0      xml-xalan/c/src/XSLT/XSLTInputSource.cpp
  
  Index: XSLTInputSource.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTInputSource.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSLTInputSource.cpp       2000/05/08 17:29:36     1.6
  +++ XSLTInputSource.cpp       2000/05/12 18:21:34     1.7
  @@ -73,6 +73,7 @@
   
   #include <PlatformSupport/DOMStringHelper.hpp>
   #include <PlatformSupport/StdBinInputStream.hpp>
  +#include <PlatformSupport/URISupport.hpp>
   
   
   
  @@ -160,6 +161,11 @@
        }
        else if (m_node == 0)
        {
  +#if 1
  +             URISupport::URLAutoPtrType      theURL = 
URISupport::getURLFromString(getSystemId());
  +
  +             theResult = theURL->makeNewStream();
  +#else
                const XMLCh* const      theSystemID =
                        getSystemId();
   
  @@ -188,6 +194,7 @@
                                theResult = inputSource.makeStream();
                        }
                }
  +#endif
        }
   
        return theResult;
  
  
  
  1.10      +6 -19     xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp
  
  Index: XSLTProcessorEnvSupportDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XSLTProcessorEnvSupportDefault.cpp        2000/05/11 21:15:28     1.9
  +++ XSLTProcessorEnvSupportDefault.cpp        2000/05/12 18:21:34     1.10
  @@ -70,6 +70,7 @@
   
   #include <PlatformSupport/DOMStringHelper.hpp>
   #include <PlatformSupport/STLHelper.hpp>
  +#include <PlatformSupport/URISupport.hpp>
   
   
   
  @@ -280,28 +281,14 @@
                XMLParserLiaison&       parserLiaison =
                        m_processor->getXMLParserLiaison();
   
  +             typedef URISupport::URLAutoPtrType      URLAutoPtrType;
  +
                // $$$ ToDo: we should re-work this code to only use
                // XMLRUL when necessary.
  -             XMLURL  xslURL;
  -
  -             // This is a work-around for what I believe is a bug in the
  -             // Xerces URL code.  If a base identifier ends in a slash,
  -             // they chop of characters back to the _previous_ slash.
  -             // So, for instance, a base of "/foo/foo/foo/" and a
  -             // urlString of file.xml would become /foo/foo/file.xml,
  -             // instead of /foo/foo/foo/file.xml.
  -             const unsigned int      indexOfSlash = lastIndexOf(base, '/');
  -
  -             if (indexOfSlash == length(base) - 1)
  -             {
  -                     xslURL.setURL(c_wstr(base + urlString));
  -             }
  -             else
  -             {
  -                     xslURL.setURL(c_wstr(base), c_wstr(urlString));
  -             }
  +             URLAutoPtrType  xslURL =
  +                     URISupport::getURLFromString(urlString, base);
   
  -             const XMLCh* const      urlText = xslURL.getURLText();
  +             const XMLCh* const      urlText = xslURL->getURLText();
   
                XSLTInputSource         inputSource(urlText);
   
  
  
  

Reply via email to