Element.getElementsByTagName Efficiency 2003-01-23 - By Joseph Kesselman
>My concern is that the access time for a linear search for specific nodes based on the tag vals of 3 or more attributes >may be a bad fit as the number of children gets to the hundreds or thousands.
It may be. You may want to do a single pass and precalculate a name-to-node lookup table. Or, as you noted, you may want to treat XML only as your interchange format and use a private data structure within your application. (If you do that, you'll probably want to write code to read and regenerate the XML through SAX rather than DOM.) You could even implement a DOM-compatable wrapper around *your* data structures, if you want to expose your data through a standard API; Xalan-J has taken that approach as its primary mode of operation.
______________________________________ Joe Kesselman / IBM Research
<br><font size=2 face="sans-serif">></font><font size=2 color=blue face= "Arial">My concern is that the access time for a linear search for specific nodes based on the tag vals of 3 or more attributes >may be a bad fit as the number of children gets to the hundreds or thousands.</font> <br> <br><font size=2 color=blue face="Arial">It may be. You may want to do a single pass and precalculate a name-to-node lookup table. Or, as you noted, you may want to treat XML only as your interchange format and use a private data structure within your application. (If you do that, you'll probably want to write code to read and regenerate the XML through SAX rather than DOM.) You could even implement a DOM-compatable wrapper around *your* data structures, if you want to expose your data through a standard API; Xalan-J has taken that approach as its primary mode of operation.</font> <br><font size=2 face="sans-serif"><br> ______________________________________<br> Joe Kesselman / IBM Research<br> </font>
|
|