dbertoni    01/05/02 08:56:27

  Modified:    c/src/XSLT ElemCopyOf.cpp ElemValueOf.cpp ElemValueOf.hpp
                        StylesheetExecutionContext.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        StylesheetHandler.cpp StylesheetHandler.hpp
                        StylesheetRoot.cpp StylesheetRoot.hpp
                        XSLTEngineImpl.cpp XSLTEngineImpl.hpp
                        XSLTResultTarget.hpp
  Log:
  New implementation to push character data to the result tree.
  
  Revision  Changes    Path
  1.17      +2 -13     xml-xalan/c/src/XSLT/ElemCopyOf.cpp
  
  Index: ElemCopyOf.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopyOf.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ElemCopyOf.cpp    2001/03/09 16:20:05     1.16
  +++ ElemCopyOf.cpp    2001/05/02 15:55:45     1.17
  @@ -149,11 +149,7 @@
        case XObject::eTypeBoolean:
        case XObject::eTypeNumber:
        case XObject::eTypeString:
  -             {
  -                     const XalanDOMString&   s = value->str();
  -
  -                     executionContext.characters(toCharArray(s), 0, 
length(s));
  -             }
  +             executionContext.characters(value);
                break;
   
        case XObject::eTypeNodeSet:
  @@ -222,14 +218,7 @@
                break;
   
        default:
  -             {
  -                     const XalanDOMString&   s = value->str();
  -
  -                     if (!isEmpty(s))
  -                     {
  -                             executionContext.characters(toCharArray(s), 0, 
s.length());
  -                     }
  -             }
  +             executionContext.characters(value);
                break;
        }
   }
  
  
  
  1.23      +20 -31    xml-xalan/c/src/XSLT/ElemValueOf.cpp
  
  Index: ElemValueOf.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ElemValueOf.cpp   2001/03/09 16:19:56     1.22
  +++ ElemValueOf.cpp   2001/05/02 15:55:48     1.23
  @@ -165,23 +165,27 @@
   
   
   void
  -ElemValueOf::execute(StylesheetExecutionContext&             
executionContext) const
  +ElemValueOf::execute(StylesheetExecutionContext&     executionContext) const
   {
        ElemTemplateElement::execute(executionContext);
   
  -     XalanNode* sourceNode = executionContext.getCurrentNode();
  +     XalanNode* const        sourceNode = executionContext.getCurrentNode();
  +     assert(sourceNode != 0);
   
        if (m_isDot == true)
        {
  -             StylesheetExecutionContext::GetAndReleaseCachedString   
theResult(executionContext);
  -
  -             DOMServices::getNodeData(*sourceNode, theResult.get());
  -     
  -             outputValue(executionContext, theResult.get());
  +             if (m_disableOutputEscaping == false)
  +             {
  +                     executionContext.characters(*sourceNode);
  +             }
  +             else
  +             {
  +                     executionContext.charactersRaw(*sourceNode);
  +             }
   
                if(0 != executionContext.getTraceListeners())
                {
  -                     fireSelectionEvent(executionContext, sourceNode, 
theResult.get());
  +                     fireSelectionEvent(executionContext, sourceNode, 
DOMServices::getNodeData(*sourceNode));
                }
        }
        else
  @@ -199,30 +203,15 @@
   
                        if (XObject::eTypeNull != type)
                        {
  -                             outputValue(executionContext, value->str());
  +                             if (m_disableOutputEscaping == false)
  +                             {
  +                                     executionContext.characters(value);
  +                             }
  +                             else
  +                             {
  +                                     executionContext.charactersRaw(value);
  +                             }
                        }
  -             }
  -     }
  -}
  -
  -
  -
  -void
  -ElemValueOf::outputValue(
  -                     StylesheetExecutionContext&             
executionContext,
  -                     const XalanDOMString&                   theValue) const
  -{
  -     const unsigned int      len = length(theValue);
  -
  -     if(len > 0)
  -     {
  -             if(m_disableOutputEscaping == false)
  -             {
  -                     executionContext.characters(toCharArray(theValue), 0, 
len);
  -             }
  -             else
  -             {
  -                     executionContext.charactersRaw(toCharArray(theValue), 
0, len);
                }
        }
   }
  
  
  
  1.13      +1 -5      xml-xalan/c/src/XSLT/ElemValueOf.hpp
  
  Index: ElemValueOf.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ElemValueOf.hpp   2001/03/09 16:19:56     1.12
  +++ ElemValueOf.hpp   2001/05/02 15:55:50     1.13
  @@ -108,11 +108,6 @@
   private:
   
        void
  -     outputValue(
  -                     StylesheetExecutionContext&             
executionContext,
  -                     const XalanDOMString&                   theValue) const;
  -
  -     void
        fireSelectionEvent(
                        StylesheetExecutionContext&             
executionContext,
                        XalanNode*                                              
sourceNode,
  @@ -123,6 +118,7 @@
                        StylesheetExecutionContext&             
executionContext,
                        XalanNode*                                              
sourceNode,
                        const XObjectPtr                                
theValue) const;
  +
   
        /**
         * The select pattern used to locate the value.
  
  
  
  1.52      +34 -0     xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
  
  Index: StylesheetExecutionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- StylesheetExecutionContext.hpp    2001/04/11 02:36:21     1.51
  +++ StylesheetExecutionContext.hpp    2001/05/02 15:55:51     1.52
  @@ -1416,6 +1416,40 @@
        virtual CountersTable&
        getCountersTable() = 0;
   
  +     /**
  +      * Send character data from a node to the result tree.
  +      *
  +      * @param node The node to send.
  +      */
  +     virtual void
  +     characters(const XalanNode&             node) = 0;
  +
  +     /**
  +      * Send character data from an XObject to the result tree.
  +      *
  +      * @param node The xobject to send.
  +      */
  +     virtual void
  +     characters(const XObjectPtr&    xobject) = 0;
  +
  +     /**
  +      * Send raw character data from a node to the result tree.
  +      *
  +      * @param node The node to send.
  +      * @param length number of characters to read from the array
  +      */
  +     virtual void
  +     charactersRaw(const XalanNode&  node) = 0;
  +
  +     /**
  +      * Send raw character data from an XObject to the result tree.
  +      *
  +      * @param node The xobject to send.
  +      */
  +     virtual void
  +     charactersRaw(const XObjectPtr&         xobject) = 0;
  +
  +
        // These interfaces are inherited from XPathExecutionContext...
   
        virtual void
  
  
  
  1.63      +65 -34    
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
  
  Index: StylesheetExecutionContextDefault.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- StylesheetExecutionContextDefault.cpp     2001/04/30 18:12:53     1.62
  +++ StylesheetExecutionContextDefault.cpp     2001/05/02 15:55:53     1.63
  @@ -147,11 +147,11 @@
        m_keyTables(),
        m_keyDeclarationSet(),
        m_countersTable(),
  -     m_useDOMResultTreeFactory(false),
        m_ignoreHTMLElementNamespaces(false),
        m_sourceTreeResultTreeFactory(),
        m_mode(0),
  -     m_formatterToTextCache()
  +     m_formatterToTextCache(),
  +     m_formatterToSourceTreeCache()
   {
   }
   
  @@ -179,11 +179,11 @@
        m_keyTables(),
        m_keyDeclarationSet(),
        m_countersTable(),
  -     m_useDOMResultTreeFactory(false),
        m_ignoreHTMLElementNamespaces(false),
        m_sourceTreeResultTreeFactory(),
        m_mode(0),
  -     m_formatterToTextCache()
  +     m_formatterToTextCache(),
  +     m_formatterToSourceTreeCache()
   {
   }
   
  @@ -922,43 +922,43 @@
   
        BorrowReturnResultTreeFrag      theResultTreeFrag(*this);
   
  -     if (m_useDOMResultTreeFactory == true)
  -     {
  -             XalanDocument* const    theDocument = 
m_xsltProcessor->getDOMFactory();
  +#if 1
  +     GetReleaseCachedObject<FormatterToSourceTree>   
theGuard(m_formatterToSourceTreeCache);
   
  -             FormatterToDOM  tempFormatter(
  -                                     theDocument,
  -                                     theResultTreeFrag.get(),
  -                                     0);
  +     FormatterToSourceTree* const    theFormatter = theGuard.get();
  +     assert(theFormatter != 0);
  +
  +     XalanSourceTreeDocument* const  theDocument = getSourceTreeFactory();
   
  -             tempFormatter.setPrefixResolver(m_xsltProcessor);
  +     theFormatter->setDocument(theDocument);
  +     theFormatter->setDocumentFragment(theResultTreeFrag.get());
  +
  +     theFormatter->setPrefixResolver(m_xsltProcessor);
   
  -             theResultTreeFrag->setOwnerDocument(theDocument);
  +     theResultTreeFrag->setOwnerDocument(theDocument);
   
  -             StylesheetExecutionContext::OutputContextPushPop        
theOutputContextPushPop(
  +     StylesheetExecutionContext::OutputContextPushPop        
theOutputContextPushPop(
                                *this,
  -                             &tempFormatter);
  +                             theFormatter);
   
  -             templateChild.executeChildren(*this, sourceNode);
  -     }
  -     else
  -     {
  -             XalanSourceTreeDocument* const  theDocument = 
getSourceTreeFactory();
  +     templateChild.executeChildren(*this, sourceNode);
  +#else
  +     XalanSourceTreeDocument* const  theDocument = getSourceTreeFactory();
   
  -             FormatterToSourceTree   tempFormatter(
  +     FormatterToSourceTree   tempFormatter(
                                        theDocument,
                                        theResultTreeFrag.get());
   
  -             tempFormatter.setPrefixResolver(m_xsltProcessor);
  +     tempFormatter.setPrefixResolver(m_xsltProcessor);
   
  -             theResultTreeFrag->setOwnerDocument(theDocument);
  +     theResultTreeFrag->setOwnerDocument(theDocument);
   
  -             StylesheetExecutionContext::OutputContextPushPop        
theOutputContextPushPop(
  +     StylesheetExecutionContext::OutputContextPushPop        
theOutputContextPushPop(
                                *this,
                                &tempFormatter);
   
  -             templateChild.executeChildren(*this, sourceNode);
  -     }
  +     templateChild.executeChildren(*this, sourceNode);
  +#endif
   
        return getXObjectFactory().createResultTreeFrag(theResultTreeFrag);
   }
  @@ -1102,7 +1102,7 @@
                        xmlDecl,
                        standalone);
   
  -     m_formatterListeners.insert(theFormatter);
  +     m_formatterListeners.push_back(theFormatter);
   
        return theFormatter;
   }
  @@ -1143,7 +1143,7 @@
                theFormatter->setPrefixResolver(m_xsltProcessor);
        }
   
  -     m_formatterListeners.insert(theFormatter);
  +     m_formatterListeners.push_back(theFormatter);
   
        return theFormatter;
   }
  @@ -1162,7 +1162,7 @@
                        docFrag,
                        currentElement);
   
  -     m_formatterListeners.insert(theFormatter);
  +     m_formatterListeners.push_back(theFormatter);
   
        theFormatter->setPrefixResolver(m_xsltProcessor);
   
  @@ -1181,7 +1181,7 @@
                        doc,
                        elem);
   
  -     m_formatterListeners.insert(theFormatter);
  +     m_formatterListeners.push_back(theFormatter);
   
        theFormatter->setPrefixResolver(m_xsltProcessor);
   
  @@ -1198,7 +1198,7 @@
        FormatterToText* const  theFormatter =
                new FormatterToText(writer, encoding);
   
  -     m_formatterListeners.insert(theFormatter);
  +     m_formatterListeners.push_back(theFormatter);
   
        return theFormatter;
   }
  @@ -1792,7 +1792,7 @@
        PrintWriter* const      thePrintWriter =
                new XalanOutputStreamPrintWriter(*theTextOutputStream);
   
  -     m_printWriters.insert(thePrintWriter);
  +     m_printWriters.push_back(thePrintWriter);
   
        return thePrintWriter;
   }
  @@ -1807,7 +1807,7 @@
        XalanOutputStream* const        theOutputStream =
                new XalanFileOutputStream(theFileName);
   
  -     m_outputStreams.insert(theOutputStream);
  +     m_outputStreams.push_back(theOutputStream);
   
        return createPrintWriter(theOutputStream);
   }
  @@ -1827,7 +1827,7 @@
        XalanOutputStream* const                theOutputStream =
                new XalanStdOutputStream(theStream);
   
  -     m_outputStreams.insert(theOutputStream);
  +     m_outputStreams.push_back(theOutputStream);
   
        return createPrintWriter(theOutputStream);
   }
  @@ -1838,6 +1838,37 @@
   StylesheetExecutionContextDefault::getCountersTable()
   {
        return m_countersTable;
  +}
  +
  +
  +
  +void
  +StylesheetExecutionContextDefault::characters(const XalanNode&       node)
  +{
  +     m_xsltProcessor->characters(node);
  +}
  +
  +
  +void
  +StylesheetExecutionContextDefault::characters(const XObjectPtr&              
xobject)
  +{
  +     m_xsltProcessor->characters(xobject);
  +}
  +
  +
  +
  +void
  +StylesheetExecutionContextDefault::charactersRaw(const XalanNode&    node)
  +{
  +     m_xsltProcessor->charactersRaw(node);
  +}
  +
  +
  +
  +void
  +StylesheetExecutionContextDefault::charactersRaw(const XObjectPtr&   xobject)
  +{
  +     m_xsltProcessor->charactersRaw(xobject);
   }
   
   
  
  
  
  1.57      +27 -43    
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
  
  Index: StylesheetExecutionContextDefault.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- StylesheetExecutionContextDefault.hpp     2001/04/30 18:12:54     1.56
  +++ StylesheetExecutionContextDefault.hpp     2001/05/02 15:55:56     1.57
  @@ -89,6 +89,7 @@
   #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
   #include <XalanSourceTree/XalanSourceTreeDocument.hpp>
   #endif
  +#include <XalanSourceTree/FormatterToSourceTree.hpp>
   
   
   
  @@ -114,28 +115,23 @@
   
   #if defined(XALAN_NO_NAMESPACES)
        typedef deque<const ElemTemplateElement*>                       
ElementRecursionStackType;
  -     typedef set<FormatterListener*,
  -                             less<FormatterListener*> >                      
        FormatterListenerSetType;
  -     typedef set<PrintWriter*,
  -                             less<PrintWriter*> >                            
        PrintWriterSetType;
  -     typedef set<XalanOutputStream*,
  -                             less<XalanOutputStream*> >                      
        OutputStreamSetType;
  +     typedef vector<FormatterListener*>                                      
FormatterListenerVectorType;
  +     typedef vector<PrintWriter*>                                            
PrintWriterVectorType;
  +     typedef vector<XalanOutputStream*>                                      
OutputStreamVectorType;
        typedef set<const KeyDeclaration*,
                                less<const KeyDeclaration*> >                   
KeyDeclarationSetType;
        typedef pair<const XPath*, clock_t>                                     
XPathCacheEntry;
        typedef map<XalanDOMString,
                                XPathCacheEntry,
                                less<XalanDOMString> >                          
        XPathCacheMapType;
  -     typedef vector<FormatterToText*>                                        
FormatterToTextCacheType;
   #else
        typedef std::deque<const ElemTemplateElement*>          
ElementRecursionStackType;
  -     typedef std::set<FormatterListener*>                            
FormatterListenerSetType;
  -     typedef std::set<PrintWriter*>                                          
PrintWriterSetType;
  -     typedef std::set<XalanOutputStream*>                            
OutputStreamSetType;
  +     typedef std::vector<FormatterListener*>                         
FormatterListenerVectorType;
  +     typedef std::vector<PrintWriter*>                                       
PrintWriterVectorType;
  +     typedef std::vector<XalanOutputStream*>                         
OutputStreamVectorType;
        typedef std::set<const KeyDeclaration*>                         
KeyDeclarationSetType;
        typedef std::pair<const XPath*, clock_t>                        
XPathCacheEntry;
        typedef std::map<XalanDOMString, XPathCacheEntry>       
XPathCacheMapType;
  -     typedef std::vector<FormatterToText*>                           
FormatterToTextCacheType;
   #endif
   
        typedef Stylesheet::KeyTablesTableType                          
KeyTablesTableType;
  @@ -180,29 +176,6 @@
        virtual
        ~StylesheetExecutionContextDefault();
   
  -     /**
  -      * Get the value of the flag that controls whether result tree
  -      * fragments are created using a DOM factory, or a 
XalanSourceTreeDocument.
  -      *
  -      * @return The value
  -      */
  -     bool
  -     getUseDOMResultTreeFactory() const
  -     {
  -             return m_useDOMResultTreeFactory;
  -     }
  -
  -     /**
  -      * Set the value of the flag that controls whether result tree
  -      * fragments are created using a DOM factory, or a 
XalanSourceTreeDocument.
  -      *
  -      * @param theValue The boolean value
  -      */
  -     void
  -     setUseDOMResultTreeFactory(bool         theValue)
  -     {
  -             m_useDOMResultTreeFactory = theValue;
  -     }
   
        /**
         * Set the value of the flag that controls whether HTML output will
  @@ -747,6 +720,19 @@
        virtual CountersTable&
        getCountersTable();
   
  +     virtual void
  +     characters(const XalanNode&             node);
  +
  +     virtual void
  +     characters(const XObjectPtr&    xobject);
  +
  +     virtual void
  +     charactersRaw(const XalanNode&  node);
  +
  +     virtual void
  +     charactersRaw(const XObjectPtr&         xobject);
  +
  +
        // These interfaces are inherited from XPathExecutionContext...
   
        virtual void
  @@ -993,9 +979,7 @@
   
        XalanNode*                                              m_rootDocument;
   
  -     enum { eDefaultVariablesCollectionSize = 10,
  -                eXPathCacheMax = 50,
  -                eDefaultVariablesStackSize = 200,
  +     enum { eXPathCacheMax = 50,
                   eDefaultParamsVectorSize = 10 };
   
        ElementRecursionStackType                       m_elementRecursionStack;
  @@ -1004,11 +988,11 @@
   
        const StylesheetRoot*                           m_stylesheetRoot;
   
  -     FormatterListenerSetType                        m_formatterListeners;
  +     FormatterListenerVectorType                     m_formatterListeners;
   
  -     PrintWriterSetType                                      m_printWriters;
  +     PrintWriterVectorType                           m_printWriters;
   
  -     OutputStreamSetType                                     m_outputStreams;
  +     OutputStreamVectorType                          m_outputStreams;
   
        CollationCompareFunctor*                        
m_collationCompareFunctor;
   
  @@ -1027,8 +1011,6 @@
   
        CountersTable                                           m_countersTable;
   
  -     bool                                                            
m_useDOMResultTreeFactory;
  -
        // If true, we will not check HTML output for elements with
        // namespaces.  This is an optimization which can lead to
        // non-conforming behavior.
  @@ -1036,8 +1018,10 @@
   
        // Holds the current mode.
        const QName*                        m_mode;
  +
  +     XalanObjectCacheDefault<FormatterToText>                
m_formatterToTextCache;
   
  -     XalanObjectCacheDefault<FormatterToText>        m_formatterToTextCache;
  +     XalanObjectCacheDefault<FormatterToSourceTree>  
m_formatterToSourceTreeCache;
   
        /**
         * The factory that will be used to create result tree fragments based 
on our
  
  
  
  1.63      +0 -4      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.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- StylesheetHandler.cpp     2001/04/30 18:12:55     1.62
  +++ StylesheetHandler.cpp     2001/05/02 15:55:57     1.63
  @@ -87,10 +87,6 @@
   
   
   
  -#include <XMLSupport/Formatter.hpp>
  -
  -
  -
   #include "Constants.hpp"
   #include "ElemApplyImport.hpp"
   #include "ElemApplyTemplates.hpp"
  
  
  
  1.28      +1 -1      xml-xalan/c/src/XSLT/StylesheetHandler.hpp
  
  Index: StylesheetHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.hpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- StylesheetHandler.hpp     2001/02/12 23:56:07     1.27
  +++ StylesheetHandler.hpp     2001/05/02 15:55:58     1.28
  @@ -75,7 +75,7 @@
   
   
   
  -#include <XMLSupport/FormatterListener.hpp>
  +#include <PlatformSupport/FormatterListener.hpp>
   
   
   
  
  
  
  1.43      +1 -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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- StylesheetRoot.cpp        2001/04/11 13:36:08     1.42
  +++ StylesheetRoot.cpp        2001/05/02 15:56:00     1.43
  @@ -100,7 +100,6 @@
   
   
   
  -#include <XMLSupport/Formatter.hpp>
   #include <XMLSupport/FormatterToHTML.hpp>
   #include <XMLSupport/FormatterToText.hpp>
   #include <XMLSupport/FormatterToXML.hpp>
  @@ -121,7 +120,7 @@
   
   //#define XALAN_VQ_SPECIAL_TRACE
   #if defined(XALAN_VQ_SPECIAL_TRACE)
  -#include "d:/Rational/Quantify/pure.h"
  +#include "C:/Program Files/Rational/Quantify/pure.h"
   #endif
   
   
  
  
  
  1.13      +1 -1      xml-xalan/c/src/XSLT/StylesheetRoot.hpp
  
  Index: StylesheetRoot.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StylesheetRoot.hpp        2000/09/19 15:12:16     1.12
  +++ StylesheetRoot.hpp        2001/05/02 15:56:01     1.13
  @@ -72,7 +72,7 @@
   
   
   
  -#include <XMLSupport/FormatterListener.hpp>
  +#include <PlatformSupport/FormatterListener.hpp>
   
   
   
  
  
  
  1.96      +159 -76   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.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- XSLTEngineImpl.cpp        2001/04/30 18:12:57     1.95
  +++ XSLTEngineImpl.cpp        2001/05/02 15:56:02     1.96
  @@ -100,7 +100,6 @@
   
   
   
  -#include <XMLSupport/Formatter.hpp>
   #include <XMLSupport/FormatterToDOM.hpp>
   #include <XMLSupport/FormatterToText.hpp>
   #include <XMLSupport/FormatterToXML.hpp>
  @@ -1475,7 +1474,7 @@
   
                if(getTraceListeners() > 0)
                {
  -                     GenerateEvent 
ge(GenerateEvent::EVENTTYPE_STARTDOCUMENT);
  +                     const GenerateEvent             
ge(GenerateEvent::EVENTTYPE_STARTDOCUMENT);
   
                        fireGenerateEvent(ge);
                }
  @@ -1502,7 +1501,7 @@
   
        if(getTraceListeners() > 0)
        {
  -             GenerateEvent ge(GenerateEvent::EVENTTYPE_ENDDOCUMENT);
  +             const GenerateEvent             
ge(GenerateEvent::EVENTTYPE_ENDDOCUMENT);
   
                fireGenerateEvent(ge);
        }
  @@ -1669,8 +1668,10 @@
   
                if(getTraceListeners() > 0)
                {
  -                     const GenerateEvent     
ge(GenerateEvent::EVENTTYPE_STARTELEMENT,
  -                                     thePendingElementName, 
&thePendingAttributes);
  +                     const GenerateEvent             ge(
  +                             GenerateEvent::EVENTTYPE_STARTELEMENT,
  +                             thePendingElementName,
  +                             &thePendingAttributes);
   
                        fireGenerateEvent(ge);
                }
  @@ -1746,7 +1747,7 @@
   
        if(getTraceListeners() > 0)
        {
  -             GenerateEvent ge(GenerateEvent::EVENTTYPE_ENDELEMENT, name);
  +             const GenerateEvent             
ge(GenerateEvent::EVENTTYPE_ENDELEMENT, name);
   
                fireGenerateEvent(ge);
        }
  @@ -1763,6 +1764,7 @@
   }
   
   
  +
   void
   XSLTEngineImpl::characters(
                        const XMLCh* const      ch,
  @@ -1784,21 +1786,15 @@
        assert(getFormatterListener() != 0);
        assert(ch != 0);
   
  -     setMustFlushPendingStartDocument(true);
  +     doFlushPending();
   
  -     flushPending();
  -
  -     const Stylesheet::QNameVectorType&      cdataElems =
  -                     m_stylesheetRoot->getCDATASectionElems();
  -
  -     if(0 != cdataElems.size() && 0 != m_cdataStack.size() && 
m_cdataStack.back() == true)
  +     if(generateCDATASection() == true)
        {
                getFormatterListener()->cdata(ch + start, length);
   
                if(getTraceListeners() > 0)
                {
  -                     GenerateEvent ge(GenerateEvent::EVENTTYPE_CDATA, ch, 
start, length);
  -                     fireGenerateEvent(ge);
  +                     fireCharacterGenerateEvent(ch, start, length, true);
                }
        }
        else
  @@ -1807,40 +1803,123 @@
   
                if(getTraceListeners() > 0)
                {
  -                     GenerateEvent ge(GenerateEvent::EVENTTYPE_CHARACTERS, 
ch,
  -                                             start, length);
  -                     fireGenerateEvent(ge);
  +                     fireCharacterGenerateEvent(ch, start, length, false);
  +             }
  +     }
  +}
  +
  +
  +
  +void
  +XSLTEngineImpl::characters(const XalanNode&          node)
  +{
  +     assert(getFormatterListener() != 0);
  +
  +     doFlushPending();
  +
  +     if(generateCDATASection() == true)
  +     {
  +             DOMServices::getNodeData(node, *getFormatterListener(), 
&FormatterListener::cdata);
  +
  +             if(getTraceListeners() > 0)
  +             {
  +                     fireCharacterGenerateEvent(node, true);
                }
        }
  +     else
  +     {
  +             DOMServices::getNodeData(node, *getFormatterListener(), 
&FormatterListener::characters);
  +
  +             if(getTraceListeners() > 0)
  +             {
  +                     fireCharacterGenerateEvent(node, false);
  +             }
  +     }
   }
   
   
   
  +void
  +XSLTEngineImpl::characters(const XObjectPtr& xobject)
  +{
  +     assert(getFormatterListener() != 0);
  +     assert(xobject.null() == false);
   
  +     doFlushPending();
  +
  +     if(generateCDATASection() == true)
  +     {
  +             xobject->str(*getFormatterListener(), 
&FormatterListener::cdata);
  +
  +             if(getTraceListeners() > 0)
  +             {
  +                     fireCharacterGenerateEvent(xobject, true);
  +             }
  +     }
  +     else
  +     {
  +             xobject->str(*getFormatterListener(), 
&FormatterListener::characters);
  +
  +             if(getTraceListeners() > 0)
  +             {
  +                     fireCharacterGenerateEvent(xobject, false);
  +             }
  +     }
  +}
  +
  +
  +
   void 
  -XSLTEngineImpl::charactersRaw (
  +XSLTEngineImpl::charactersRaw(
                        const XMLCh* const      ch,
  -                     const unsigned int      /* start */,
  +                     const unsigned int      start,
                        const unsigned int      length)
   {
  -     setMustFlushPendingStartDocument(true);
  +     assert(ch != 0);
   
  -     flushPending();
  +     doFlushPending();
   
        getFormatterListener()->charactersRaw(ch, length);
   
        if(getTraceListeners() > 0)
        {
  -             GenerateEvent ge(GenerateEvent::EVENTTYPE_CHARACTERS,
  -                             ch, 0, length);
  +             fireCharacterGenerateEvent(ch, start, length, false);
  +     }
  +}
   
  -             fireGenerateEvent(ge);
  +
  +
  +void
  +XSLTEngineImpl::charactersRaw(const XalanNode&       node)
  +{
  +     doFlushPending();
  +
  +     DOMServices::getNodeData(node, *getFormatterListener(), 
&FormatterListener::charactersRaw);
  +
  +     if(getTraceListeners() > 0)
  +     {
  +             fireCharacterGenerateEvent(node, false);
        }
   }
   
   
   
   void
  +XSLTEngineImpl::charactersRaw(const XObjectPtr&              xobject)
  +{
  +     doFlushPending();
  +
  +     xobject->str(*getFormatterListener(), 
&FormatterListener::charactersRaw);
  +
  +     if(getTraceListeners() > 0)
  +     {
  +             fireCharacterGenerateEvent(xobject, false);
  +     }
  +}
  +
  +
  +
  +void
   XSLTEngineImpl::resetDocument()
   {
        assert(getFormatterListener() != 0);
  @@ -1859,10 +1938,8 @@
   {
        assert(getFormatterListener() != 0);
        assert(ch != 0);
  -
  -     setMustFlushPendingStartDocument(true);
   
  -     flushPending();
  +     doFlushPending();
   
        getFormatterListener()->ignorableWhitespace(ch, length);
   
  @@ -1885,10 +1962,8 @@
        assert(getFormatterListener() != 0);
        assert(target != 0);
        assert(data != 0);
  -
  -     setMustFlushPendingStartDocument(true);
   
  -     flushPending();
  +     doFlushPending();
   
        getFormatterListener()->processingInstruction(target, data);
   
  @@ -1911,9 +1986,7 @@
        assert(getFormatterListener() != 0);
        assert(data != 0);
   
  -     setMustFlushPendingStartDocument(true);
  -
  -     flushPending();
  +     doFlushPending();
   
        getFormatterListener()->comment(data);
   
  @@ -1931,10 +2004,8 @@
   {
        assert(getFormatterListener() != 0);
        assert(name != 0);
  -
  -     setMustFlushPendingStartDocument(true);
   
  -     flushPending();
  +     doFlushPending();
   
        getFormatterListener()->entityReference(name);
   
  @@ -2506,39 +2577,12 @@
   
   
   
  -static const XalanDOMChar    theTokenDelimiterCharacters[] =
  -{
  -             XalanUnicode::charLeftCurlyBracket,
  -             XalanUnicode::charRightCurlyBracket,
  -             XalanUnicode::charApostrophe,
  -             XalanUnicode::charQuoteMark,
  -             0
  -};
  -
  -
  -
  -static const XalanDOMChar    theLeftCurlyBracketString[] =
  -{
  -             XalanUnicode::charLeftCurlyBracket,
  -             0
  -};
  -
  -
  -
  -static const XalanDOMChar    theRightCurlyBracketString[] =
  -{
  -             XalanUnicode::charRightCurlyBracket,
  -             0
  -};
  -
  -
  -
   void
   XSLTEngineImpl::copyAttributeToTarget(
                        const XalanAttr&                attr,
                        XalanNode*                              /* contextNode 
*/,
                        const Stylesheet*               /* stylesheetTree */,
  -                     AttributeListImpl&              attrList, 
  +                     AttributeListImpl&              attrList,
                        const XalanElement&     /* namespaceContext */)
   {
        const XalanDOMString&   attrName = attr.getName();
  @@ -2548,15 +2592,7 @@
        // TODO: Find out about empty attribute template expression handling.
        if(0 != length(attrValue))
        {
  -             if((equals(attrName, DOMServices::s_XMLNamespace) || 
startsWith(attrName, DOMServices::s_XMLNamespaceWithSeparator))
  -                && startsWith(attrValue, 
XALAN_STATIC_UCODE_STRING("quote:")))
  -             {
  -                     addResultAttribute(attrList, attrName, 
substring(attrValue, 6));
  -             }
  -             else
  -             {
  -                     addResultAttribute(attrList, attrName, attrValue);
  -             }
  +             addResultAttribute(attrList, attrName, attrValue);
        }
   }
   
  @@ -2815,8 +2851,7 @@
   
   
   void
  -XSLTEngineImpl::resetCurrentState(
  -                     XalanNode*      xmlNode)
  +XSLTEngineImpl::resetCurrentState(XalanNode* xmlNode)
   {
        if(0 != xmlNode)
        {
  @@ -2937,6 +2972,54 @@
        }
   
        setFormatterListenerImpl(flistener);
  +}
  +
  +
  +
  +void
  +XSLTEngineImpl::fireCharacterGenerateEvent(
  +                     const XalanNode&        theNode,
  +                     bool                            isCDATA)
  +{
  +     fireCharacterGenerateEvent(DOMServices::getNodeData(theNode), isCDATA);
  +}
  +
  +
  +
  +void
  +XSLTEngineImpl::fireCharacterGenerateEvent(
  +                     const XObjectPtr&       theXObject,
  +                     bool                            isCDATA)
  +{
  +     fireCharacterGenerateEvent(theXObject->str(), isCDATA);
  +}
  +
  +
  +
  +void
  +XSLTEngineImpl::fireCharacterGenerateEvent(
  +                     const XalanDOMString&   theString,
  +                     bool                                    isCDATA)
  +{
  +     fireCharacterGenerateEvent(c_wstr(theString), 0, length(theString), 
isCDATA);
  +}
  +
  +
  +
  +void
  +XSLTEngineImpl::fireCharacterGenerateEvent(
  +                     const XMLCh*    ch,
  +                     unsigned int    start,
  +                     unsigned int    length,
  +                     bool                    isCDATA)
  +{
  +     const GenerateEvent             ge(
  +             isCDATA == true ? GenerateEvent::EVENTTYPE_CDATA : 
GenerateEvent::EVENTTYPE_CHARACTERS,
  +             ch,
  +             start,
  +             length);
  +
  +     fireGenerateEvent(ge);
   }
   
   
  
  
  
  1.65      +71 -2     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.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- XSLTEngineImpl.hpp        2001/03/29 22:24:27     1.64
  +++ XSLTEngineImpl.hpp        2001/05/02 15:56:04     1.65
  @@ -468,6 +468,22 @@
                        const unsigned int      length);
   
        /**
  +      * Send character data from the node to the result tree.
  +      *
  +      * @param node The node to send.
  +      */
  +     void
  +     characters(const XalanNode&             node);
  +
  +     /**
  +      * Send character data from an XObject to the result tree.
  +      *
  +      * @param node The xobject to send.
  +      */
  +     virtual void
  +     characters(const XObjectPtr&    xobject);
  +
  +     /**
         * Receive notification of the beginning of an element with an empty
         * attribute list
         *
  @@ -475,8 +491,7 @@
         * @exception SAXException
         */
        virtual void
  -     startElement(
  -                     const XMLCh* const      name);
  +     startElement(const XMLCh* const         name);
   
        /**
         * Receive notification of character data. If available, when the
  @@ -495,6 +510,22 @@
                        const unsigned int      length);
   
        /**
  +      * Send raw character data from the node to the result tree.
  +      *
  +      * @param node The node to send.
  +      */
  +     virtual void
  +     charactersRaw(const XalanNode&  node);
  +
  +     /**
  +      * Send raw character data from an XObject to the result tree.
  +      *
  +      * @param node The xobject to send.
  +      */
  +     virtual void
  +     charactersRaw(const XObjectPtr&         xobject);
  +
  +     /**
         * Called when a Comment is to be constructed.
         *
         * @param       data    pointer to comment data
  @@ -1638,6 +1669,44 @@
        }
   
   private:
  +
  +     bool
  +     generateCDATASection() const
  +     {
  +             return 0 != m_cdataStack.size() &&
  +                        m_cdataStack.back() == true;
  +     }
  +
  +     void
  +     doFlushPending()
  +     {
  +             setMustFlushPendingStartDocument(true);
  +
  +             flushPending();
  +     }
  +
  +     void
  +     fireCharacterGenerateEvent(
  +                     const XalanNode&        theNode,
  +                     bool                            isCDATA);
  +
  +     void
  +     fireCharacterGenerateEvent(
  +                     const XObjectPtr&       theXObject,
  +                     bool                            isCDATA);
  +
  +     void
  +     fireCharacterGenerateEvent(
  +                     const XalanDOMString&   theString,
  +                     bool                                    isCDATA);
  +
  +     void
  +     fireCharacterGenerateEvent(
  +                     const XMLCh*    ch,
  +                     unsigned int    start,
  +                     unsigned int    length,
  +                     bool                    isCDATA);
  +
   
        XMLParserLiaison&       m_parserLiaison;
   
  
  
  
  1.13      +1 -4      xml-xalan/c/src/XSLT/XSLTResultTarget.hpp
  
  Index: XSLTResultTarget.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTResultTarget.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XSLTResultTarget.hpp      2001/03/15 22:19:54     1.12
  +++ XSLTResultTarget.hpp      2001/05/02 15:56:05     1.13
  @@ -82,10 +82,7 @@
   
   
   
  -#include <XMLSupport/FormatterListener.hpp>
  -
  -
  -
  +class FormatterListener;
   class XalanDocument;
   class XalanDocumentFragment;
   class XalanElement;
  
  
  

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

Reply via email to