Why not load up XQilla and use xpaths?
Or maybe write your code in XSLT, XQuery or even Obyx.

On 25 Oct 2012, at 15:12, Kelly Davis <theosekmecha...@yahoo.com> wrote:
> In our code we have many loops of the form....
> 
> XMLCh *namespace = ...                               
> XMLCh *elementName = ...         
> DOMNodeList *domNodeList =  domElement->getElementsByTagNameNS(namespace, 
> elementName);                                
> XMLSize_t domNodeListSize = domNodeList->getLength();           
> for (XMLSize_t count = 0; count < domNodeListSize; ++count) {                 
>                           
>     DOMElement *nextDOMElement = (DOMElement *) domNodeList->item(count);
>     // Modify nextDOMElement by adding attributes
> }
> 
> These are extremely slow.
> 
> The problem seems to be multi-fold:
> 
> 1. The API has no getElementsByTagNameNS() that returns a "const 
> DOMNodeList*", thus allowing optimizations. (Not xerces-c's fault, but it's a 
> nice-to-have!)
> 2. DOMNodeList:: getLength() is order O(V + E), where V is the number of 
> DOMElements under domElement and E is the number of edges
> 3. DOMNodeList:: item(XMLSize_t index) is of oder O(V + E) as 
> nextDOMElement's attributes are modified and thus the DOMDocument's fChanges 
> is incremented
> 
> These yield a for loop that is of O((V + E)^2), which for the number of such 
> loops we have is far, far to slow.
> 
> Short of re-writing DOMDeepNodeListImpl, what is the proper solution to this 
> problem?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
> For additional commands, e-mail: c-dev-h...@xerces.apache.org
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to