getElementsByTagName prb/bug (8.4 only)
Added by Anonymous over 19 years ago
Legacy ID: #3092226 Legacy Poster: Daniel Chaffiol (vonc)
Hi, When I look for elements based on their tagname in a java extension having a Element (ElementOverNodeInfo) as parameter, it works in 8.3, not in 8.4. In 8.4 the code (of mine) NodeList exps = exproot.getElementsByTagName("wrd"); does return the correct number of nodes... but they are all equals to 'exproot'! Indeed, when I compare the code of \net\sf\saxon\dom\DocumentOverNodeInfo.java in 8.3 and 8.4, the only modifications are in getElementsByTagName and getElementsByTagNameNS. 1/ You create a smaller ArrayList nodes (100 instead of 500)... why not. 2/ For every matching name element, you add 'node' instead of 'next'!? - line 176 - I put back 'next' instead of 'node', and all went well from that on... Could you confirm this is a bug (or explain to me where I misinterpreted/misused that function) ? Thanks in advance. -- Daniel Chaffiol
Replies (1)
RE: getElementsByTagName prb/bug (8.4 only) - Added by Anonymous over 19 years ago
Legacy ID: #3094611 Legacy Poster: Michael Kay (mhkay)
It seems that when testing the fix for https://sourceforge.net/tracker/index.php?func=detail&aid=1122242&group_id=29872&atid=397617 I applied the correct change to the 8.3 code base, and then miscopied it both to the bug entry on SourceForge and to the 8.4 code base. The correction you made is fine. The change in array initialization from 500 to 100 doesn't affect the correct behaviour, it's purely a tuning parameter. I've found with experience that setting the value too high can cause worse performance problems (running out of memory) than setting it too low. Ideally one should choose a figure that will be big enough say 80% of the time. Michael Kay
Please register to reply