You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2004/05/10 10:03:25 UTC

cvs commit: xml-xerces/c/src/xercesc/dom/impl DOMWriterImpl.cpp

amassari    2004/05/10 01:03:25

  Modified:    c/src/xercesc/dom/impl DOMWriterImpl.cpp
  Log:
  Performance: push a new map on the namespace stack only when an element has a xmlns attribute
  
  Revision  Changes    Path
  1.53      +22 -4     xml-xerces/c/src/xercesc/dom/impl/DOMWriterImpl.cpp
  
  Index: DOMWriterImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMWriterImpl.cpp,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- DOMWriterImpl.cpp	1 Apr 2004 22:05:32 -0000	1.52
  +++ DOMWriterImpl.cpp	10 May 2004 08:03:25 -0000	1.53
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.53  2004/05/10 08:03:25  amassari
  + * Performance: push a new map on the namespace stack only when an element has a xmlns attribute
  + *
    * Revision 1.52  2004/04/01 22:05:32  peiyongz
    * invoke DOMException with Memory Manager
    *
  @@ -1014,8 +1017,7 @@
               int nodeLine = fCurrentLine;
   
               // add an entry in the namespace stack
  -            RefHashTableOf<XMLCh>* namespaceMap=new (fMemoryManager) RefHashTableOf<XMLCh>(12, false, fMemoryManager);
  -            fNamespaceStack->addElement(namespaceMap);
  +            RefHashTableOf<XMLCh>* namespaceMap=NULL;
   
               if ( filterAction == DOMNodeFilter::FILTER_ACCEPT)
               {
  @@ -1056,6 +1058,11 @@
                       }
                       if(!bPrefixDeclared)
                       {
  +                        if(namespaceMap==NULL)
  +                        {
  +                            namespaceMap=new (fMemoryManager) RefHashTableOf<XMLCh>(12, false, fMemoryManager);
  +                            fNamespaceStack->addElement(namespaceMap);
  +                        }
                           namespaceMap->put((void*)prefix,(XMLCh*)nodeToWrite->getNamespaceURI());
                           *fFormatter  << XMLFormatter::NoEscapes
                                        << chSpace << XMLUni::fgXMLNSString;
  @@ -1108,6 +1115,11 @@
                       {
                           if(XMLString::equals(ns, XMLUni::fgXMLNSURIName)) 
                           {
  +                            if(namespaceMap==NULL)
  +                            {
  +                                namespaceMap=new (fMemoryManager) RefHashTableOf<XMLCh>(12, false, fMemoryManager);
  +                                fNamespaceStack->addElement(namespaceMap);
  +                            }
   			                const XMLCh* nsPrefix = attribute->getLocalName();
                               if(XMLString::equals(attribute->getNodeName(),XMLUni::fgXMLNSString))
   								nsPrefix = XMLUni::fgZeroLenString;
  @@ -1134,6 +1146,11 @@
                                   }
                                   if(!bPrefixDeclared)
                                   {
  +                                    if(namespaceMap==NULL)
  +                                    {
  +                                        namespaceMap=new (fMemoryManager) RefHashTableOf<XMLCh>(12, false, fMemoryManager);
  +                                        fNamespaceStack->addElement(namespaceMap);
  +                                    }
                                       namespaceMap->put((void*)prefix,(XMLCh*)attribute->getNamespaceURI());
                                       *fFormatter  << XMLFormatter::NoEscapes
                                                    << chSpace << XMLUni::fgXMLNSString << chColon << prefix
  @@ -1228,7 +1245,8 @@
               }
   
               // remove the namespace map at this level
  -            fNamespaceStack->removeLastElement();
  +            if(namespaceMap!=NULL)
  +                fNamespaceStack->removeLastElement();
   
               break;
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org