[OpenLayers-Dev] XML parsing, SLD parsing

Tim Schaub tschaub at openplans.org
Mon Nov 5 14:53:28 EST 2007


Thanks Andreas-

Guess my question was - where do you need node.text or node.textContext 
instead of using the standard node.nodeValue?

Tim

Andreas Hocevar wrote:
> Tim,
> 
> 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.
> 
> Regards,
> Andreas.
> 
> !DSPAM:4033,472f6646280141439371379!
> 




More information about the Dev mailing list