[OpenLayers-Dev] XML parsing, SLD parsing

Andreas Hocevar andreas.hocevar at gmail.com
Sun Nov 4 18:01:30 EST 2007


Chris,

On 11/3/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Sat, Nov 03, 2007 at 11:36:59PM +0100, Andreas Hocevar wrote:
> > I would propose to add another convenience method in
> > OpenLayers.Format.XML, called eg. getTextContent, which would be
> > node.textContent in a cross-browser manner.
>
> I'm in favor of that. Please create a ticket, attach a patch, and then
> mention in the SLD ticket that it depends on the new ticket you've
> created.

Further investigation (ie. testing in Opera and Safari) brought me to
the conclusion that the effort of getting textContent in a
cross-browser manner is too small to justify a separate convenience
function:

var textContent = node.text || node.textContent;

When I proposed to create a separate convenience function, I was not
sure if the above would be sufficient to make it work in Opera and
Safari, but it definitely does (like it obviously also does in
OpenLayers.Util.getXmlNodeValue).

So I just changed my code to use the above, and unless you or someone
else really really wants to have a convenience function for that, I do
not see any need to create a ticket and patch for adding this to
OpenLayers.Format.XML.

Bottom line: OpenLayers.Format.SLD now works reliably without using
any XML functions from OpenLayers.Util. An updated patch is attached
to #533.

Regards,
Andreas.



More information about the Dev mailing list