dbertoni    2003/01/22 11:41:15

  Modified:    c/src/XercesParserLiaison XercesDocumentWrapper.cpp
                        XercesDocumentWrapper.hpp XercesParserLiaison.cpp
                        XercesParserLiaison.hpp
  Log:
  Fix for bug 14793.
  
  Revision  Changes    Path
  1.10      +12 -6     
xml-xalan/c/src/XercesParserLiaison/XercesDocumentWrapper.cpp
  
  Index: XercesDocumentWrapper.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentWrapper.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XercesDocumentWrapper.cpp 17 Jan 2003 01:37:43 -0000      1.9
  +++ XercesDocumentWrapper.cpp 22 Jan 2003 19:41:14 -0000      1.10
  @@ -116,7 +116,8 @@
   XercesDocumentWrapper::XercesDocumentWrapper(
                        const DOMDocument_Type*         theXercesDocument,
                        bool                                            
threadSafe,
  -                     bool                                            
buildWrapper) :
  +                     bool                                            
buildWrapper,
  +                     bool                                            
buildMaps) :
        XalanDocument(),
        m_xercesDocument(theXercesDocument),
        m_documentElement(0),
  @@ -130,6 +131,7 @@
        m_doctype(0),
        m_mappingMode(threadSafe == true ? false : !buildWrapper),
        m_indexValid(false),
  +     m_buildMaps(m_mappingMode == true ? true : buildMaps),
        m_elementAllocator(25),
        m_textAllocator(25),
        m_attributeAllocator(25),
  @@ -1406,7 +1408,8 @@
                                this,
                                &m_navigators.back(),
                                m_navigators,
  -                             2);
  +                             2,
  +                             m_buildMaps);
   
                theTreeWalker.traverse(theStartChild, m_xercesDocument);
        }
  @@ -1436,12 +1439,14 @@
                        XercesDocumentWrapper*                  theDocument,
                        XercesWrapperNavigator*                 
theDocumentNavigator,
                        WrapperNavigatorVectorType&             theNavigators,
  -                     unsigned long                                   
theStartIndex) :
  +                     unsigned long                                   
theStartIndex,
  +                     bool                                                    
theBuildMapsFlag) :
        m_document(theDocument),
        m_navigators(theNavigators),
        m_currentIndex(theStartIndex),
        m_parentNavigatorStack(),
  -     m_siblingNavigatorStack()
  +     m_siblingNavigatorStack(),
  +     m_buildMaps(theBuildMapsFlag)
   {
        assert(theDocument != 0 && theDocumentNavigator != 0);
   
  @@ -1467,7 +1472,8 @@
   void
   XercesDocumentWrapper::BuildWrapperTreeWalker::startNode(const DOMNodeType*  
        node)
   {
  -     XalanNode* const        theWrapperNode = 
m_document->createWrapperNode(node, m_currentIndex, false);
  +     XalanNode* const        theWrapperNode =
  +             m_document->createWrapperNode(node, m_currentIndex, 
m_buildMaps);
   
        XercesWrapperNavigator& theCurrentNodeNavigator = m_navigators.back();
   
  @@ -1569,7 +1575,7 @@
   
                        // Create a bridge node.
                        XalanNode* const        theCurrentAttr =
  -                             m_document->createWrapperNode(theAttr, 
m_currentIndex, false);
  +                             m_document->createWrapperNode(theAttr, 
m_currentIndex, m_buildMaps);
                        assert(theCurrentAttr != 0);
   
                        // Get the attribute node's navigator...
  
  
  
  1.6       +9 -2      
xml-xalan/c/src/XercesParserLiaison/XercesDocumentWrapper.hpp
  
  Index: XercesDocumentWrapper.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentWrapper.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XercesDocumentWrapper.hpp 20 Dec 2002 01:45:43 -0000      1.5
  +++ XercesDocumentWrapper.hpp 22 Jan 2003 19:41:15 -0000      1.6
  @@ -135,12 +135,14 @@
         * @param theXercesDocument The Xerces document to bridge
         * @param threadSafe If true, the tree can safely be shared amongst 
multiple threads.  (Also implies buildWrapper == true)
         * @param buildWrapper If true, all of the bridge nodes will be built 
during construction.
  +      * @param buildMaps If true, a map of Xerces to Xalan nodes will be 
built, even if the bridge is built
         *
         */
        XercesDocumentWrapper(
                        const DOMDocument_Type*         theXercesDocument,
                        bool                                            
threadSafe = true,
  -                     bool                                            
buildWrapper = true);
  +                     bool                                            
buildWrapper = true,
  +                     bool                                            
buildMaps = false);
   
        virtual
        ~XercesDocumentWrapper();
  @@ -412,7 +414,8 @@
                                XercesDocumentWrapper*                          
theDocument,
                                XercesWrapperNavigator*                         
theDocumentNavigator,
                                WrapperNavigatorVectorInnerType&        
theNavigators,
  -                             unsigned long                                   
        theStartIndex);
  +                             unsigned long                                   
        theStartIndex,
  +                             bool                                            
                theBuildMapsFlag);
   
                virtual
                ~BuildWrapperTreeWalker();
  @@ -457,6 +460,8 @@
                NavigatorStackType                                      
m_parentNavigatorStack;
   
                NavigatorStackType                                      
m_siblingNavigatorStack;
  +
  +             const bool                                                      
m_buildMaps;
        };
   
   
  @@ -600,6 +605,8 @@
        bool                                                                    
m_mappingMode;
   
        bool                                                                    
m_indexValid;
  +
  +     const bool                                                              
m_buildMaps;
   
        mutable XercesElementWrapperAllocator   m_elementAllocator;
   
  
  
  
  1.58      +8 -4      
xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.cpp
  
  Index: XercesParserLiaison.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.cpp,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- XercesParserLiaison.cpp   28 Nov 2002 00:26:07 -0000      1.57
  +++ XercesParserLiaison.cpp   22 Jan 2003 19:41:15 -0000      1.58
  @@ -114,6 +114,7 @@
        m_documentMap(),
        m_buildBridge(true),
        m_threadSafe(false),
  +     m_buildMaps(false),
        m_executionContext(0)
   {
   }
  @@ -134,6 +135,7 @@
        m_buildWrapper(true),
        m_buildBridge(true),
        m_threadSafe(false),
  +     m_buildMaps(false),
        m_executionContext(0)
   {
   }
  @@ -254,7 +256,7 @@
   
        if (theXercesDocument != 0)
        {
  -             theNewDocument = doCreateDocument(theXercesDocument, 
m_threadSafe, m_buildWrapper, true);
  +             theNewDocument = doCreateDocument(theXercesDocument, 
m_threadSafe, m_buildWrapper, m_buildMaps, true);
   
                theParser->adoptDocument();
   #else
  @@ -484,11 +486,12 @@
   XercesParserLiaison::createDocument(
                        const DOMDocument_Type*         theXercesDocument,
                        bool                                            
threadSafe,
  -                     bool                                            
buildWrapper)
  +                     bool                                            
buildWrapper,
  +                     bool                                            
buildMaps)
   {
        // As we did not create the underlying DOMDocument - ensure we don't
        // delete it later.
  -     return doCreateDocument(theXercesDocument, threadSafe, buildWrapper, 
false);
  +     return doCreateDocument(theXercesDocument, threadSafe, buildWrapper, 
buildMaps, false);
   }
   
   
  @@ -736,10 +739,11 @@
                        const DOMDocument_Type*         theXercesDocument,
                        bool                                            
threadSafe,
                        bool                                            
buildWrapper,
  +                     bool                                            
buildMaps,
                        bool                                            isOwned)
   {
        XercesDocumentWrapper* const            theNewDocument =
  -             new XercesDocumentWrapper(theXercesDocument, threadSafe, 
buildWrapper);
  +             new XercesDocumentWrapper(theXercesDocument, threadSafe, 
buildWrapper, buildMaps);
   
        DocumentEntry&  theEntry = m_documentMap[theNewDocument];
        
  
  
  
  1.43      +41 -2     
xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.hpp
  
  Index: XercesParserLiaison.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.hpp,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- XercesParserLiaison.hpp   28 Nov 2002 00:26:07 -0000      1.42
  +++ XercesParserLiaison.hpp   22 Jan 2003 19:41:15 -0000      1.43
  @@ -388,7 +388,7 @@
        XalanDocument*
        createDocument(const DOMDocument_Type*  theXercesDocument)
        {
  -             return createDocument(theXercesDocument, m_threadSafe, 
m_buildWrapper);
  +             return createDocument(theXercesDocument, m_threadSafe, 
m_buildWrapper, m_buildMaps);
        }
   
        /**
  @@ -400,13 +400,15 @@
         * @param theXercesDocument The Xerces document.
         * @param threadSafe If true, read access to the tree will be 
thread-safe (implies buildBridge == true).
         * @param buildWrapper If true, the entire wrapper structure is built.
  +      * @param buildMaps If true, the map of Xerces to Xalan nodes is always 
built.
         * @return a pointer to a new XalanDocument-derived instance.
         */
        XalanDocument*
        createDocument(
                        const DOMDocument_Type*         theXercesDocument,
                        bool                                            
threadSafe,
  -                     bool                                            
buildWrapper);
  +                     bool                                            
buildWrapper,
  +                     bool                                            
buildMaps = false);
   
        /**
         * This API is deprecated.
  @@ -628,6 +630,37 @@
                }
        }
   
  +     /**
  +      * This functions returns the state of the liaison's buildMaps flag.
  +      * If true, maps will be created to allow mapping of Xalan<->Xerces 
mapping
  +      * in both directions for XercesWrapper classes.
  +      *
  +      * @return true, if the new documents will be built with Maps
  +      */
  +     bool
  +     getBuildMaps() const
  +     
  +     {
  +             return m_buildMaps;
  +     }
  + 
  +     /**
  +      * This functions sets the state of the liaison's buildMaps flag.
  +      * When this flag is true, maps will be built providing Xerces<->Xalan
  +      * mapping in Wrapper classes.
  +      *
  +      * @note The maps created use a large amount of memory.  If only
  +      * Xalan->Xerces node mapping is required, do not set this to true.
  +      *
  +      * @param newState The new state for the flag.
  +      *
  +      */
  +     void
  +     setBuildMaps(bool       newState)
  +     {
  +             m_buildMaps = newState;
  +     }
  +
   #if XERCES_VERSION_MAJOR >= 2
        typedef XERCES_CPP_NAMESPACE_QUALIFIER XercesDOMParser  DOMParserType;
   #else
  @@ -650,6 +683,8 @@
        /**
         * Create a XalanDocument proxy for an existing Xerces document.
         *
  +      * This API is deprecated.
  +      *
         * @param theXercesDocument The Xerces document.
         * @param threadSafe If true, read access to the tree will be 
thread-safe (implies buildBridge == true).
         * @param buildBridge If true, the entire bridge structure is built.
  @@ -667,6 +702,7 @@
         * @param theXercesDocument The Xerces document.
         * @param threadSafe If true, read access to the tree will be 
thread-safe (implies buildBridge == true).
         * @param buildWrapper If true, the entire bridge structure is built.
  +      * @param buildMaps If true, the map of Xerces to Xalan nodes is always 
built.
         * @return a pointer to a new XercesDocumentWrapper instance.
         */
        XercesDocumentWrapper*
  @@ -674,6 +710,7 @@
                        const DOMDocument_Type*         theXercesDocument,
                        bool                                            
threadSafe,
                        bool                                            
buildWrapper,
  +                     bool                                            
buildMaps,
                        bool                                            
isOwned);
   
   private:
  @@ -704,6 +741,8 @@
        bool                            m_buildBridge;
   
        bool                            m_threadSafe;
  +
  +     bool                            m_buildMaps;
   
        ExecutionContext*       m_executionContext;
   };
  
  
  

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

Reply via email to