[OpenLayers-Dev] Format.XML question

Tim Schaub tschaub at opengeo.org
Thu Jul 10 17:12:30 EDT 2008


Hey-

bartvde at osgis.nl wrote:
> Hi list,
> 
> is there a way to limit getElementsByTagNameNS to a certain level?
> 
> For instance a GML FeatureCollection can have a boundedBy element on the
> highest level, but also theoretically one per feature. I am only interested
> in the first one, and currently I have to check the parentNode to be sure I
> am dealing with the right one. A level in getElementsByTagNameNS would be a
> nicer approach IMHO.

The xml.getElementsByTagNameNS method is just a cross-browser wrapper 
for the DOM:element.getElementsByTagNameNS method.  Its behavior follows 
the W3C XML DOM specification.

It is a hugely inefficient way to traverse the dom (particularly in IE), 
and you can typically find a better way.

If you're talking about GML parsing, I've worked up a new parser that I 
need to make into a patch.

http://trac.openlayers.org/browser/sandbox/topp/almanac/lib/OpenLayers/Format/GML/Base.js

This parser calls getElementsByTagNameNS once instead many, many times 
as with the parser in the trunk.

Tim

> 
> What do people think? Am I missing something?
> 
> Best regards,
> Bart
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> !DSPAM:4033,48737694268471804284693!
> 




More information about the Dev mailing list