[OpenLayers-Dev] XML parsing, SLD parsing

Andreas Hocevar andreas.hocevar at gmail.com
Mon Nov 5 13:50:32 EST 2007


no need to worry!

On 11/5/07, Tim Schaub <tschaub at openplans.org> wrote:
> Ok, help me out here.
> Where does node.nodeValue fail?

It is working perfectly fine, and the method getChildValue in
OpenLayers.Format.XML is just a convenience function that is also
working perfectly fine.

> Thanks for helping me see what I'm missing here.

The original concern was that OpenLayers.Format.XML.getChildValue,
unlike OpenLayers.Util.getXmlNodeValue, does not fall back to
node.textContent, which is what I needed in some cases. Chris pointed
out that OpenLayers.Util.getXmlNodeValue should not be used, because
it allows XML documents that are too sloppy.

So I got rid of OpenLayers.Util.getXmlNodeValue in the sld parser, and
now I use OpenLayers.Format.XML.getChildValue and node.text ||
node.textContent instead, depending on what I want to get out of the
XML document. It works perfect, also in Safari.

The other discussion was whether we need a getTextContent function,
but the statement
"node.text || node.textContent" is simple enough to not need one.


More information about the Dev mailing list