dbertoni    01/06/06 14:41:18

  Modified:    c/src/XalanTransformer XalanCAPI.cpp XalanCAPI.h
                        XalanDefaultDocumentBuilder.cpp
                        XalanDefaultDocumentBuilder.hpp
                        XalanDefaultParsedSource.cpp
                        XalanDefaultParsedSource.hpp
                        XalanDocumentBuilder.hpp XalanParsedSource.hpp
                        XalanTransformer.cpp XalanTransformer.hpp
                        XercesDOMParsedSource.cpp XercesDOMParsedSource.hpp
  Log:
  Re-vamp of interfaces.
  
  Revision  Changes    Path
  1.14      +118 -100  xml-xalan/c/src/XalanTransformer/XalanCAPI.cpp
  
  Index: XalanCAPI.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanCAPI.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XalanCAPI.cpp     2001/05/14 16:09:14     1.13
  +++ XalanCAPI.cpp     2001/06/06 21:41:08     1.14
  @@ -58,11 +58,7 @@
   
   
   
  -#include <XalanTransformer/XalanCAPI.h>
  -#include <XalanTransformer/XalanTransformer.hpp>
  -
  -
  -
  +#include <cassert>
   #if defined(XALAN_OLD_STREAM_HEADERS)
   #include <strstream.h>
   #else
  @@ -71,6 +67,11 @@
   
   
   
  +#include "XalanCAPI.h"
  +#include "XalanTransformer.hpp"
  +
  +
  +
   XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
   XalanInitialize()
   {
  @@ -104,15 +105,53 @@
   
   
   
  +inline XalanTransformer*
  +getTransformer(XalanHandle   theHandle)
  +{
  +     assert(theHandle != 0);
  +
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +     return (XalanTransformer*)theHandle;
  +#else
  +     return static_cast<XalanTransformer*>(theHandle);
  +#endif
  +}
  +
  +
  +
  +inline const XalanCompiledStylesheet*
  +getStylesheet(XalanCSSHandle theHandle)
  +{
  +     assert(theHandle != 0);
  +
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +     return (const XalanCompiledStylesheet*)theHandle;
  +#else
  +     return static_cast<const XalanCompiledStylesheet*>(theHandle);
  +#endif
  +}
  +
  +
  +
  +inline const XalanParsedSource*
  +getParsedSource(XalanPSHandle        theHandle)
  +{
  +     assert(theHandle != 0);
  +
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +     return (const XalanParsedSource*)theHandle;
  +#else
  +     return static_cast<const XalanParsedSource*>(theHandle);
  +#endif
  +}
  +
  +
  +
   XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
   DeleteXalanTransformer(XalanHandle theXalanHandle)
   {
        // Delete a XalanTransformer object.
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     delete  (XalanTransformer*)theXalanHandle;
  -#else
  -     delete  static_cast<XalanTransformer*>(theXalanHandle);
  -#endif       
  +     delete getTransformer(theXalanHandle);
   }
   
   
  @@ -124,23 +163,18 @@
                        const char*             theOutFileName,
                        XalanHandle             theXalanHandle)
   {
  -     if(0 == theXSLFileName)
  +     if(theXSLFileName == 0)
        {
  -     // Do the transformation...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, 
theOutFileName);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
theOutFileName);
  -#endif
  +             return getTransformer(theXalanHandle)->transform(
  +                     theXMLFileName,
  +                     theOutFileName);
        }
        else
        {
  -     // Do the transformation...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, 
theXSLFileName, theOutFileName);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
theXSLFileName, theOutFileName);
  -#endif
  +             return getTransformer(theXalanHandle)->transform(
  +                     theXMLFileName,
  +                     theXSLFileName,
  +                     theOutFileName);
        }
   }
   
  @@ -154,11 +188,10 @@
                        XalanHandle             theXalanHandle)
   {
        // Do the transformation...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, 
(XalanCompiledStylesheet*)theCSSHandle, theOutFileName);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
static_cast<XalanCompiledStylesheet*>(theCSSHandle), theOutFileName);
  -#endif       
  +     return getTransformer(theXalanHandle)->transform(
  +                             theXMLFileName,
  +                             getStylesheet(theCSSHandle),
  +                             theOutFileName);
   }
   
   
  @@ -174,31 +207,32 @@
        using std::ostrstream;
   #endif
   
  -     int status = true;              
  +     int     status = 0;             
   
        ostrstream      theOutputStream;        
  -     if(0 == theXSLFileName)
  +
  +     if(theXSLFileName == 0)
        {
  -     // Do the transformation...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -             status = 
((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, theOutputStream);
  -#else
  -             status = 
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
theOutputStream);
  -#endif
  +             status = getTransformer(theXalanHandle)->transform(
  +                     theXMLFileName,
  +                     theOutputStream);
        }
        else
        {
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -             status = 
((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, theXSLFileName, 
theOutputStream);
  -#else
  -             status = 
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
theXSLFileName, theOutputStream);
  -#endif
  +             status = getTransformer(theXalanHandle)->transform(
  +                     theXMLFileName,
  +                     theXSLFileName,
  +                     theOutputStream);
  +     }
  +
  +     if (status == 0)
  +     {
  +             // Null-terminate the data.
  +             theOutputStream << '\0';
  +
  +             *theOutput = theOutputStream.str();
        }
  -     // Null-terminate the data.
  -     theOutputStream << '\0';
   
  -     *theOutput = theOutputStream.str();
  -     
        return status;
   }
   
  @@ -215,21 +249,23 @@
        using std::ostrstream;
   #endif
   
  -     int status = true;              
  -
        ostrstream      theOutputStream;        
   
        // Do the transformation...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     status = ((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, 
(XalanCompiledStylesheet*)theCSSHandle, theOutputStream);
  -#else
  -     status = 
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
static_cast<XalanCompiledStylesheet*>(theCSSHandle), theOutputStream);
  -#endif
  -     // Null-terminate the data.
  -     theOutputStream << '\0';
  +     const int       status =
  +             getTransformer(theXalanHandle)->transform(
  +                     theXMLFileName,
  +                     getStylesheet(theCSSHandle),
  +                     theOutputStream);
   
  -     *theOutput = theOutputStream.str();
  -     
  +     if (status == 0)
  +     {
  +             // Null-terminate the data.
  +             theOutputStream << '\0';
  +
  +             *theOutput = theOutputStream.str();
  +     }
  +
        return status;
   }
   
  @@ -254,11 +290,12 @@
                        XalanFlushHandlerType   theFlushHandler)
   {
        // Do the transformation...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, 
theXSLFileName, theOutputHandle, theOutputHandler, theFlushHandler);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
theXSLFileName, theOutputHandle, theOutputHandler, theFlushHandler);
  -#endif       
  +     return getTransformer(theXalanHandle)->transform(
  +                     theXMLFileName,
  +                     theXSLFileName,
  +                     theOutputHandle,
  +                     theOutputHandler,
  +                     theFlushHandler);
   }
   
   
  @@ -273,68 +310,53 @@
                        XalanFlushHandlerType   theFlushHandler)
   {
        // Do the transformation...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->transform(theXMLFileName, 
(XalanCompiledStylesheet*)theCSSHandle, theOutputHandle, theOutputHandler, 
theFlushHandler);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->transform(theXMLFileName, 
static_cast<XalanCompiledStylesheet*>(theCSSHandle), theOutputHandle, 
theOutputHandler, theFlushHandler);
  -#endif       
  +     return getTransformer(theXalanHandle)->transform(
  +                     theXMLFileName,
  +                     getStylesheet(theCSSHandle),
  +                     theOutputHandle,
  +                     theOutputHandler,
  +                     theFlushHandler);
   }
   
   
   
   XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanCSSHandle)
   XalanCompileStylesheet(
  -                     const char*                             theXSLFileName,
  -                     XalanHandle                             theXalanHandle)
  +                     const char*             theXSLFileName,
  +                     XalanHandle             theXalanHandle)
   {
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->compileStylesheet(theXSLFileName);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->compileStylesheet(theXSLFileName);
  -#endif       
  +     return getTransformer(theXalanHandle)->compileStylesheet(theXSLFileName);
   }
   
   
   
   XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanPSHandle)
   XalanParseSource(
  -                     const char*                             theXMLFileName,
  -                     XalanHandle                             theXalanHandle)
  +                     const char*             theXMLFileName,
  +                     XalanHandle             theXalanHandle)
   {
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->parseSource(theXMLFileName);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->parseSource(theXMLFileName);
  -#endif
  +     return getTransformer(theXalanHandle)->parseSource(theXMLFileName);
   }
   
   
   
   XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanPSHandle)
   XalanParseSourceUseXerceDOM(
  -                     const char*                             theXMLFileName,
  -                     XalanHandle                             theXalanHandle)
  +                     const char*             theXMLFileName,
  +                     XalanHandle             theXalanHandle)
   {
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->parseSource(theXMLFileName, 1);
  -#else
  -     return  
static_cast<XalanTransformer*>(theXalanHandle)->parseSource(theXMLFileName, 1);
  -#endif
  +     return getTransformer(theXalanHandle)->parseSource(theXMLFileName, true);
   }
   
   
   
   XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
   XalanSetStylesheetParam(
  -                     const char*                             key,
  -                     const char*                             expression,
  -                     XalanHandle                             theXalanHandle)
  +                     const char*             key,
  +                     const char*             expression,
  +                     XalanHandle             theXalanHandle)
   {
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     ((XalanTransformer*)theXalanHandle)->setStylesheetParam(key, expression);
  -#else
  -     static_cast<XalanTransformer*>(theXalanHandle)->setStylesheetParam(key, 
expression);
  -#endif       
  +     getTransformer(theXalanHandle)->setStylesheetParam(key, expression);
   }
   
   
  @@ -343,9 +365,5 @@
   XalanGetLastError(XalanHandle theXalanHandle)
   {
        // Get the last error.
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -     return ((XalanTransformer*)theXalanHandle)->getLastError();
  -#else
  -     return  static_cast<XalanTransformer*>(theXalanHandle)->getLastError();
  -#endif       
  +     return getTransformer(theXalanHandle)->getLastError();
   }
  
  
  
  1.11      +3 -3      xml-xalan/c/src/XalanTransformer/XalanCAPI.h
  
  Index: XalanCAPI.h
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanCAPI.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XalanCAPI.h       2001/03/30 21:35:19     1.10
  +++ XalanCAPI.h       2001/06/06 21:41:08     1.11
  @@ -79,17 +79,17 @@
        /**
         * Handle used to store the address of XalanTransformer instance.
         */
  -     typedef void* XalanHandle;
  +     typedef void*                   XalanHandle;
   
        /**
         * Handle used to store the address of Compiled Stylesheet instance.
         */
  -     typedef void* XalanCSSHandle;
  +     typedef const void*             XalanCSSHandle;
   
        /**
         * Handle used to store the address of Parsed Source instance.
         */
  -     typedef void* XalanPSHandle;
  +     typedef const void*             XalanPSHandle;
   
        /**
         * Callback function passed to XalanTransformToHandler. 
  
  
  
  1.3       +9 -14     xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.cpp
  
  Index: XalanDefaultDocumentBuilder.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanDefaultDocumentBuilder.cpp   2001/04/27 20:56:51     1.2
  +++ XalanDefaultDocumentBuilder.cpp   2001/06/06 21:41:09     1.3
  @@ -63,9 +63,13 @@
   
   
   
  +#include "XalanDefaultParsedSource.hpp"
  +
  +
  +
   XalanDefaultDocumentBuilder::XalanDefaultDocumentBuilder() :
        m_domSupport(),
  -     m_parserLiaison(m_domSupport),
  +     m_parserLiaison(),
        m_contentHandler(m_parserLiaison.mapDocument(m_parserLiaison.createDocument()))
   {
        m_domSupport.setParserLiaison(&m_parserLiaison);
  @@ -80,27 +84,18 @@
   
   
   XalanDocument*
  -XalanDefaultDocumentBuilder::getDocument()
  +XalanDefaultDocumentBuilder::getDocument() const
   {
        return m_contentHandler.getDocument();
   }
   
   
   
  -XMLParserLiaison*
  -XalanDefaultDocumentBuilder::getParserLiaison()
  +XalanParsedSourceHelper*
  +XalanDefaultDocumentBuilder::createHelper() const
   {
  -     return &m_parserLiaison;
  +     return new XalanDefaultParsedSourceHelper(m_domSupport);
   }
  -
  -
  -
  -DOMSupport*
  -XalanDefaultDocumentBuilder::getDOMSupport()
  -{
  -     return &m_domSupport;
  -}
  -
   
   
   ContentHandler*
  
  
  
  1.3       +3 -6      xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.hpp
  
  Index: XalanDefaultDocumentBuilder.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanDefaultDocumentBuilder.hpp   2001/04/27 20:56:51     1.2
  +++ XalanDefaultDocumentBuilder.hpp   2001/06/06 21:41:09     1.3
  @@ -88,13 +88,10 @@
        ~XalanDefaultDocumentBuilder();
   
        virtual XalanDocument*
  -     getDocument();
  +     getDocument() const;
   
  -     virtual XMLParserLiaison*
  -     getParserLiaison();
  -
  -     virtual DOMSupport*
  -     getDOMSupport();
  +     virtual XalanParsedSourceHelper*
  +     createHelper() const;
   
        virtual ContentHandler*
        getContentHandler();
  
  
  
  1.3       +106 -14   xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.cpp
  
  Index: XalanDefaultParsedSource.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanDefaultParsedSource.cpp      2001/04/27 20:56:51     1.2
  +++ XalanDefaultParsedSource.cpp      2001/06/06 21:41:10     1.3
  @@ -62,12 +62,113 @@
   
   
   
  +#include <XalanSourceTree/XalanSourceTreeDocument.hpp>
  +#include <XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
  +
  +
  +
  +XalanDefaultParsedSourceDOMSupport::XalanDefaultParsedSourceDOMSupport(const 
XalanSourceTreeDOMSupport&              theDOMSupport) :
  +     XalanSourceTreeDOMSupport(),
  +     m_domSupport(theDOMSupport)
  +{
  +}
  +
  +
  +
  +XalanDefaultParsedSourceDOMSupport::~XalanDefaultParsedSourceDOMSupport()
  +{
  +}
  +
  +
  +
  +void
  +XalanDefaultParsedSourceDOMSupport::reset()
  +{
  +}
  +
  +
  +
  +const XalanDOMString*
  +XalanDefaultParsedSourceDOMSupport::getNamespaceForPrefix(
  +                     const XalanDOMString&   prefix, 
  +                     const XalanElement&             namespaceContext) const
  +{
  +     return m_domSupport.getNamespaceForPrefix(
  +                                     prefix, 
  +                                     namespaceContext);
  +}
  +
  +
  +
  +const XalanDOMString&
  +XalanDefaultParsedSourceDOMSupport::getUnparsedEntityURI(
  +                     const XalanDOMString&   theName,
  +                     const XalanDocument&    theDocument) const
  +{
  +     const XalanDOMString&   theURI =
  +                     m_domSupport.getUnparsedEntityURI(
  +                                     theName,
  +                                     theDocument);
  +
  +     if (length(theURI) != 0)
  +     {
  +             return theURI;
  +     }
  +     else
  +     {
  +             return XalanSourceTreeDOMSupport::getUnparsedEntityURI(
  +                                     theName,
  +                                     theDocument);
  +     }
  +}
  +
  +
  +
  +bool
  +XalanDefaultParsedSourceDOMSupport::isNodeAfter(
  +                     const XalanNode&        node1,
  +                     const XalanNode&        node2) const
  +{
  +     return m_domSupport.isNodeAfter(
  +                                     node1, 
  +                                     node2);
  +}
  +
  +
  +
  +XalanDefaultParsedSourceHelper::XalanDefaultParsedSourceHelper(const 
XalanSourceTreeDOMSupport&      theSourceDOMSupport) :
  +     m_domSupport(theSourceDOMSupport),
  +     m_parserLiaison()
  +{
  +     m_domSupport.setParserLiaison(&m_parserLiaison);
  +}
  +
  +
  +
  +DOMSupport&
  +XalanDefaultParsedSourceHelper::getDOMSupport()
  +{
  +     return m_domSupport;
  +}
  +
  +
  +
  +XMLParserLiaison&
  +XalanDefaultParsedSourceHelper::getParserLiaison()
  +{
  +     return m_parserLiaison;
  +}
  +
  +
  +
   XalanDefaultParsedSource::XalanDefaultParsedSource(const XSLTInputSource&    
theInputSource):
        XalanParsedSource(),
        m_domSupport(),
        m_parserLiaison(m_domSupport),
  -     m_parsedSource(m_parserLiaison.parseXMLStream(theInputSource))
  +     
m_parsedSource(m_parserLiaison.mapDocument(m_parserLiaison.parseXMLStream(theInputSource)))
   {
  +     assert(m_parsedSource != 0);
  +
        m_domSupport.setParserLiaison(&m_parserLiaison);
   }
   
  @@ -80,24 +181,15 @@
   
   
   XalanDocument*       
  -XalanDefaultParsedSource::getDocument()
  +XalanDefaultParsedSource::getDocument() const
   {
        return m_parsedSource;
   }
   
   
   
  -XMLParserLiaison*
  -XalanDefaultParsedSource::getParserLiaison()
  +XalanParsedSourceHelper*
  +XalanDefaultParsedSource::createHelper() const
   {
  -     return &m_parserLiaison;
  +     return new XalanDefaultParsedSourceHelper(m_domSupport);
   }
  -
  -
  -
  -DOMSupport*
  -XalanDefaultParsedSource::getDOMSupport()
  -{
  -     return &m_domSupport;
  -}
  -
  
  
  
  1.3       +65 -7     xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.hpp
  
  Index: XalanDefaultParsedSource.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanDefaultParsedSource.hpp      2001/04/27 20:56:51     1.2
  +++ XalanDefaultParsedSource.hpp      2001/06/06 21:41:10     1.3
  @@ -77,6 +77,67 @@
   
   
   
  +class XalanSourceTreeDocument;
  +
  +
  +
  +class XalanDefaultParsedSourceDOMSupport : public XalanSourceTreeDOMSupport
  +{
  +public:
  +
  +     XalanDefaultParsedSourceDOMSupport(const XalanSourceTreeDOMSupport&            
 theDOMSupport);
  +
  +     virtual
  +     ~XalanDefaultParsedSourceDOMSupport();
  +
  +     virtual void
  +     reset();
  +
  +     // These interfaces are inherited from DOMSupport...
  +
  +     virtual const XalanDOMString*
  +     getNamespaceForPrefix(
  +                     const XalanDOMString&   prefix, 
  +                     const XalanElement&             namespaceContext) const;
  +
  +     virtual const XalanDOMString&
  +     getUnparsedEntityURI(
  +                     const XalanDOMString&   theName,
  +                     const XalanDocument&    theDocument) const;
  +
  +     virtual bool
  +     isNodeAfter(
  +                     const XalanNode&        node1,
  +                     const XalanNode&        node2) const;
  +
  +private:
  +
  +     const XalanSourceTreeDOMSupport&        m_domSupport;
  +};
  +
  +
  +
  +class XALAN_TRANSFORMER_EXPORT XalanDefaultParsedSourceHelper : public 
XalanParsedSourceHelper
  +{
  +public:
  +
  +     XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport& 
theSourceDOMSupport);
  +
  +     virtual DOMSupport&
  +     getDOMSupport();
  +
  +     virtual XMLParserLiaison&
  +     getParserLiaison();
  +
  +private:
  +
  +     XalanDefaultParsedSourceDOMSupport      m_domSupport;
  +
  +     XalanSourceTreeParserLiaison            m_parserLiaison;
  +};
  +
  +
  +
   /**
    * This is designed to allow a XalanTranfomer object to reuse a parsed
    * document. 
  @@ -91,13 +152,10 @@
        ~XalanDefaultParsedSource();
   
        virtual XalanDocument*
  -     getDocument();
  -
  -     virtual XMLParserLiaison*
  -     getParserLiaison();
  +     getDocument() const;
   
  -     virtual DOMSupport*
  -     getDOMSupport();
  +     virtual XalanParsedSourceHelper*
  +     createHelper() const;
   
   private:
   
  @@ -105,7 +163,7 @@
   
        XalanSourceTreeParserLiaison    m_parserLiaison;
   
  -     XalanDocument* const                    m_parsedSource;
  +     XalanSourceTreeDocument* const  m_parsedSource;
   };
   
   
  
  
  
  1.4       +3 -7      xml-xalan/c/src/XalanTransformer/XalanDocumentBuilder.hpp
  
  Index: XalanDocumentBuilder.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDocumentBuilder.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XalanDocumentBuilder.hpp  2001/04/27 20:56:51     1.3
  +++ XalanDocumentBuilder.hpp  2001/06/06 21:41:11     1.4
  @@ -74,7 +74,6 @@
   class DTDHandler;
   class LexicalHandler;
   class XalanDocument;
  -class XMLParserLiaison;
   
   
   
  @@ -93,13 +92,10 @@
   
        // These are inherited from XalanParsedSource...
        virtual XalanDocument*
  -     getDocument() = 0;      
  +     getDocument() const = 0;        
   
  -     virtual XMLParserLiaison*
  -     getParserLiaison() = 0;
  -
  -     virtual DOMSupport*
  -     getDOMSupport() = 0;
  +     virtual XalanParsedSourceHelper*
  +     createHelper() const = 0;
   
        // These are new to XalanDocumentBuilder...
        virtual ContentHandler*
  
  
  
  1.3       +45 -8     xml-xalan/c/src/XalanTransformer/XalanParsedSource.hpp
  
  Index: XalanParsedSource.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanParsedSource.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanParsedSource.hpp     2001/04/27 20:56:51     1.2
  +++ XalanParsedSource.hpp     2001/06/06 21:41:11     1.3
  @@ -75,6 +75,34 @@
   
   
   
  +class XALAN_TRANSFORMER_EXPORT XalanParsedSourceHelper
  +{
  +public:
  +
  +     virtual
  +     ~XalanParsedSourceHelper()
  +     {
  +     }
  +
  +     /**
  +      * Get the DOMSupport instance.
  +      *
  +      * @return A reference to a DOMSupport instance.
  +      */
  +     virtual DOMSupport&
  +     getDOMSupport() = 0;
  +
  +     /**
  +      * Get the XMLParserLiaison instance.
  +      *
  +      * @return A rerefernce to an XMLParserLiaison instance.
  +      */
  +     virtual XMLParserLiaison&
  +     getParserLiaison() = 0;
  +};
  +
  +
  +
   /**
    * This is abstract base class designed to allow a XalanTranfomer 
    * object to reuse a parsed document. 
  @@ -88,16 +116,25 @@
        virtual
        ~XalanParsedSource();
   
  +     /**
  +      * Get a pointer to the XalanDocument instance for the source
  +      * document
  +      *
  +      * @return A pointer to a XalanDocument instance.
  +      */
        virtual XalanDocument*
  -     getDocument() = 0;      
  -
  -     virtual XMLParserLiaison*
  -     getParserLiaison() = 0;
  -
  -     virtual DOMSupport*
  -     getDOMSupport() = 0;
  +     getDocument() const = 0;        
   
  -private:
  +     /**
  +      * Create the appropriate XalanParsedSourceHelper instance to
  +      * use for transforming with the instance.
  +      *
  +      * The caller is responsible for deleting the object when finished.
  +      *
  +      * @return A pointer to a XalanParsedSourceHelper instance.
  +      */
  +     virtual XalanParsedSourceHelper*
  +     createHelper() const = 0;
   };
   
   
  
  
  
  1.19      +30 -20    xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp
  
  Index: XalanTransformer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XalanTransformer.cpp      2001/05/22 03:52:22     1.18
  +++ XalanTransformer.cpp      2001/06/06 21:41:11     1.19
  @@ -168,7 +168,7 @@
   
   int
   XalanTransformer::transform(
  -     XalanParsedSource&                      theParsedXML, 
  +     const XalanParsedSource&        theParsedXML, 
        const XSLTInputSource&          theStylesheetSource,
        const XSLTResultTarget&         theResultTarget)
   {
  @@ -187,12 +187,15 @@
        XalanDOMString  theErrorMessage;
   
        try
  -     {               
  -             // Create some support objects that are necessary for running the 
processor...
  -             DOMSupport&                     theDOMSupport = 
*theParsedXML.getDOMSupport();
  +     {
  +             // Create the helper object that is necessary for running the 
processor...
  +             XalanAutoPtr<XalanParsedSourceHelper>   
theHelper(theParsedXML.createHelper());
  +             assert(theHelper.get() != 0);
   
  -             XMLParserLiaison&       theParserLiaison = 
*theParsedXML.getParserLiaison();
  +             DOMSupport&                                             theDOMSupport 
= theHelper->getDOMSupport();
   
  +             XMLParserLiaison&                               theParserLiaison = 
theHelper->getParserLiaison();
  +
                // Create some more support objects...
                XSLTProcessorEnvSupportDefault  theXSLTProcessorEnvSupport;
   
  @@ -208,6 +211,8 @@
                                theXObjectFactory,
                                theXPathFactory);
   
  +             theXSLTProcessorEnvSupport.setProcessor(&theProcessor);
  +
                // Create a problem listener and send output to a XalanDOMString.
                DOMStringPrintWriter    thePrintWriter(theErrorMessage);
                
  @@ -227,6 +232,8 @@
                // Hack used to cast away const.
                XSLTResultTarget        tempResultTarget(theResultTarget);
   
  +             const EnsureReset       theReset(*this);
  +
                // Set up the stylesheet execution context.
                
m_stylesheetExecutionContext.setXPathEnvSupport(&theXSLTProcessorEnvSupport);
   
  @@ -253,8 +260,6 @@
                                        *(m_functionPairs[f].second));
                }
   
  -             const EnsureReset       theReset(*this);
  -
                // Do the transformation...
                theProcessor.process(
                                        theParsedXML.getDocument(),
  @@ -328,7 +333,7 @@
   
   int
   XalanTransformer::transform(
  -                     XalanParsedSource&                              theParsedXML, 
  +                     const XalanParsedSource&                theParsedXML, 
                        const XalanCompiledStylesheet*  theCompiledStylesheet,
                        const XSLTResultTarget&                 theResultTarget)
   {
  @@ -348,10 +353,13 @@
   
        try
        {
  -             // Create some support objects that are necessary for running the 
processor...
  -             DOMSupport&                     theDOMSupport = 
*theParsedXML.getDOMSupport();
  +             // Create the helper object that is necessary for running the 
processor...
  +             XalanAutoPtr<XalanParsedSourceHelper>   
theHelper(theParsedXML.createHelper());
  +             assert(theHelper.get() != 0);
  +
  +             DOMSupport&                                             theDOMSupport 
= theHelper->getDOMSupport();
   
  -             XMLParserLiaison&       theParserLiaison = 
*theParsedXML.getParserLiaison();
  +             XMLParserLiaison&                               theParserLiaison = 
theHelper->getParserLiaison();
   
                // Create some more support objects...
                XSLTProcessorEnvSupportDefault  theXSLTProcessorEnvSupport;
  @@ -368,6 +376,8 @@
                                theXObjectFactory,
                                theXPathFactory);
   
  +             theXSLTProcessorEnvSupport.setProcessor(&theProcessor);
  +
                // Create a problem listener and send output to a XalanDOMString.
                DOMStringPrintWriter    thePrintWriter(theErrorMessage);
                
  @@ -380,6 +390,8 @@
                // of the one provided...
                XSLTResultTarget        tempResultTarget(theResultTarget);
   
  +             const EnsureReset       theReset(*this);
  +
                // Set up the stylesheet execution context.
                
m_stylesheetExecutionContext.setXPathEnvSupport(&theXSLTProcessorEnvSupport);
   
  @@ -409,8 +421,6 @@
                                        *(m_functionPairs[f].second));
                }
   
  -             const EnsureReset       theReset(*this);
  -
                // Do the transformation...
                theProcessor.process(
                                        theParsedXML.getDocument(),             
  @@ -487,7 +497,7 @@
        const XSLTResultTarget&         theResultTarget)
   {
        // Parse the source document.
  -     XalanParsedSource* const        theParsedXML =
  +     const XalanParsedSource* const  theParsedXML =
                parseSource(theInputSource);
   
        // Make sure the parsed source is destroyed when
  @@ -510,7 +520,7 @@
                        const XSLTResultTarget&                 theResultTarget)
   {
        // Parse the source document.
  -     XalanParsedSource* const        theParsedXML =
  +     const XalanParsedSource* const  theParsedXML =
                parseSource(theInputSource);
   
        // Make sure the parsed source is destroyed when
  @@ -611,7 +621,7 @@
   
   
   
  -XalanCompiledStylesheet*
  +const XalanCompiledStylesheet*
   XalanTransformer::compileStylesheet(const XSLTInputSource&           
theStylesheetSource)
   {
        // Clear the error message.
  @@ -723,7 +733,7 @@
   
   
   void
  -XalanTransformer::destroyStylesheet(XalanCompiledStylesheet* theStylesheet)
  +XalanTransformer::destroyStylesheet(const XalanCompiledStylesheet*   theStylesheet)
   {
   #if !defined(XALAN_NO_NAMESPACES)
        using std::find;
  @@ -745,7 +755,7 @@
   
   
   
  -XalanParsedSource*
  +const XalanParsedSource*
   XalanTransformer::parseSource(
                        const XSLTInputSource&  theInputSource, 
                        bool                                    useXercesDOM)
  @@ -758,7 +768,7 @@
        {       
                XalanParsedSource* theParsedDocument = 0;
   
  -             if(useXercesDOM == 1)
  +             if(useXercesDOM == true)
                {
                        theParsedDocument = new XercesDOMParsedSource(theInputSource);
                }
  @@ -801,7 +811,7 @@
   
   
   void
  -XalanTransformer::destroyParsedSource(XalanParsedSource*     theParsedSource)
  +XalanTransformer::destroyParsedSource(const XalanParsedSource*       
theParsedSource)
   {
   #if !defined(XALAN_NO_NAMESPACES)
        using std::find;
  
  
  
  1.22      +14 -14    xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp
  
  Index: XalanTransformer.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- XalanTransformer.hpp      2001/05/22 03:52:21     1.21
  +++ XalanTransformer.hpp      2001/06/06 21:41:11     1.22
  @@ -141,7 +141,7 @@
         */
        int
        transform(
  -                     XalanParsedSource&                      theParsedXML, 
  +                     const XalanParsedSource&        theParsedXML, 
                        const XSLTInputSource&          theStylesheetSource,
                        const XSLTResultTarget&         theResultTarget);
   
  @@ -156,7 +156,7 @@
         */
        int
        transform(
  -                     XalanParsedSource&                              theParsedXML, 
  +                     const XalanParsedSource&                theParsedXML, 
                        const XalanCompiledStylesheet*  theCompiledStylesheet,
                        const XSLTResultTarget&                 theResultTarget);
   
  @@ -296,7 +296,7 @@
         * @param theStylesheetSource input source
         * @return a pointer to a XalanCompiledStylesheet or 0 for failure.
         */
  -     XalanCompiledStylesheet*
  +     const XalanCompiledStylesheet*
        compileStylesheet(const XSLTInputSource&        theStylesheetSource);
   
        /**
  @@ -307,7 +307,7 @@
         * @param theStylesheet The instance to destroy.
         */
        void
  -     destroyStylesheet(XalanCompiledStylesheet*      theStylesheet);
  +     destroyStylesheet(const XalanCompiledStylesheet*        theStylesheet);
   
        /**
         * Parse a source XML document.  The input source can be 
  @@ -321,7 +321,7 @@
         * @param useXercesDOM          input use default or xerces dom source tree
         * @return      a pointer to a XalanParsedSource or 0 for failure.
         */
  -     XalanParsedSource*
  +     const XalanParsedSource*
        parseSource(
                        const XSLTInputSource&  theInputSource, 
                        bool                                    useXercesDOM = false);
  @@ -334,7 +334,7 @@
         * @param theParsedSource The XalanParsedSource instance to destroy.
         */
        void
  -     destroyParsedSource(XalanParsedSource*  theParsedSource);
  +     destroyParsedSource(const XalanParsedSource*    theParsedSource);
   
        /**
         * Create a document builder.  Using the document builder, you
  @@ -462,8 +462,8 @@
        public:
   
                EnsureDestroyParsedSource(
  -                             XalanTransformer&       theTransformer,
  -                             XalanParsedSource*      theParsedSource) :
  +                             XalanTransformer&                       theTransformer,
  +                             const XalanParsedSource*        theParsedSource) :
                        m_transformer(theTransformer),
                        m_parsedSource(theParsedSource)
                {
  @@ -476,16 +476,16 @@
   
        private:
   
  -             XalanTransformer&                       m_transformer;
  +             XalanTransformer&                               m_transformer;
   
  -             XalanParsedSource* const        m_parsedSource;
  +             const XalanParsedSource* const  m_parsedSource;
        };
   
        struct EnsureDestroyCompiledStylesheet
        {
                EnsureDestroyCompiledStylesheet(
  -                             XalanTransformer&                       theTransformer,
  -                             XalanCompiledStylesheet*        theCompiledStylesheet) 
:
  +                             XalanTransformer&                               
theTransformer,
  +                             const XalanCompiledStylesheet*  theCompiledStylesheet) 
:
                        m_transformer(theTransformer),
                        m_compiledStylesheet(theCompiledStylesheet)
                {
  @@ -498,9 +498,9 @@
   
        private:
   
  -             XalanTransformer&                               m_transformer;
  +             XalanTransformer&                                               
m_transformer;
   
  -             XalanCompiledStylesheet* const  m_compiledStylesheet;
  +             const XalanCompiledStylesheet* const    m_compiledStylesheet;
        };
   
        struct EnsureDestroyDocumentBuilder
  
  
  
  1.3       +30 -14    xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.cpp
  
  Index: XercesDOMParsedSource.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XercesDOMParsedSource.cpp 2001/04/27 20:56:51     1.2
  +++ XercesDOMParsedSource.cpp 2001/06/06 21:41:12     1.3
  @@ -62,10 +62,34 @@
   
   
   
  +class XALAN_TRANSFORMER_EXPORT XercesDOMParsedSourceHelper : public 
XalanParsedSourceHelper
  +{
  +public:
  +
  +     virtual DOMSupport&
  +     getDOMSupport()
  +     {
  +             return m_domSupport;
  +     }
  +
  +     virtual XMLParserLiaison&
  +     getParserLiaison()
  +     {
  +             return m_parserLiaison;
  +     }
  +
  +private:
  +
  +     XercesDOMSupport                m_domSupport;
  +
  +     XercesParserLiaison             m_parserLiaison;
  +};
  +
  +
  +
   XercesDOMParsedSource::XercesDOMParsedSource(const XSLTInputSource&          
theInputSource):
        XalanParsedSource(),
  -     m_domSupport(),
  -     m_parserLiaison(m_domSupport),
  +     m_parserLiaison(),
        m_parsedSource(m_parserLiaison.parseXMLStream(theInputSource))
   {
   }
  @@ -79,23 +103,15 @@
   
   
   XalanDocument*
  -XercesDOMParsedSource::getDocument()
  +XercesDOMParsedSource::getDocument() const
   {
        return m_parsedSource;
   }
   
   
  -
  -XMLParserLiaison*
  -XercesDOMParsedSource::getParserLiaison()
  -{
  -     return &m_parserLiaison;
  -}
  -
  -
   
  -DOMSupport*
  -XercesDOMParsedSource::getDOMSupport()
  +XalanParsedSourceHelper*
  +XercesDOMParsedSource::createHelper() const
   {
  -     return &m_domSupport;
  +     return new XercesDOMParsedSourceHelper;
   }
  
  
  
  1.3       +3 -8      xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.hpp
  
  Index: XercesDOMParsedSource.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XercesDOMParsedSource.hpp 2001/04/27 20:56:51     1.2
  +++ XercesDOMParsedSource.hpp 2001/06/06 21:41:12     1.3
  @@ -91,17 +91,12 @@
        ~XercesDOMParsedSource();
   
        virtual XalanDocument*
  -     getDocument();
  +     getDocument() const;
   
  -     virtual XMLParserLiaison*
  -     getParserLiaison();
  +     virtual XalanParsedSourceHelper*
  +     createHelper() const;
   
  -     virtual DOMSupport*
  -     getDOMSupport();
  -
   private:
  -
  -     XercesDOMSupport                m_domSupport;
   
        XercesParserLiaison             m_parserLiaison;
   
  
  
  

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

Reply via email to