DOMParser API getting slow
--------------------------

                 Key: XERCESC-1788
                 URL: https://issues.apache.org/jira/browse/XERCESC-1788
             Project: Xerces-C++
          Issue Type: Bug
          Components: DOM
    Affects Versions: 2.7.0
         Environment: Windows XP, VC++ 6
            Reporter: Sanish Kanjany
             Fix For: Nightly build (please specify the date)


I have been using xerces-c2.2 for a long and now moved to xerces-c2.7. I was 
using deprecated DOM_Parser(with 2.2) and now using XercesDOMParser(with 2.7) 
itself. I had to write some wrappers for DOMNode, DOMDocument, DOMNodeList etc 
to avoid changes in my existing code as DOM_Node, DOM_Document, DOM_NodeList 
etc. I could see the parsing time is significantly reduced with xerces-2.7.  
But some APIs to the parser is getting slow down. 

For example,  in the function given below, to  get all element children of a 
node, is very slow when the reference node has a large number of child nodes. 
The function spends more time inside the for loop. The same function is very 
fast with old version of xerces-c(2.2).

bool CMyDomParser::GetAllChildNodes(DOM_Node node, std::vector<DOM_Node>& nodes)
{
        nodes.clear();
        if(node == NULL)
                return false;
        DOM_NodeList nodelist = node.getChildNodes();
        if(nodelist == NULL)
                return true;
        bool retval = false;
        int iLisSize=nodelist.getLength();
        for(int i=0; i < iLisSize; i++)
        {
                DOM_Node oTempNode=nodelist.item(i);
                if(oTempNode.getNodeType() != DOM_Node::ELEMENT_NODE)
                        continue;
                retval = true;
                nodes.push_back(oTempNode);
        }
        return true;
}


 What will be the base reason ? 
Anyadvancement needed in my code?  
Is there any change in implementation of DOMNodelist ::item(int) ?

Thanks,
Sanish

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to