azavea / python-sld

A simple python library that enables dynamic SLD creation and manipulation.
http://azavea.github.com/python-sld/
Apache License 2.0
27 stars 17 forks source link

load schema only when validating #9

Open sirmmo opened 11 years ago

sirmmo commented 11 years ago

In some conditions the app didn't work properly, so we added controls to avoid the loading of the remote XSD for non-validating calls.

dzwarg commented 10 years ago

@sirmmo, thank you for this PR. I was going through these today, and I wonder how you would accommodate the scenario where someone creates an SLD dynamically (not based on an existing SLD document), then attempts to validate it later?

At line 1488, the validate method validates the current document against the stored _schemadoc, which by your method won't be set if the schema is not loaded.

sirmmo commented 10 years ago

@dzwarg you are right, in fact. I was not using "validate" method while generating the sld, honestly. will move the xsd loading to the method (I think it would not be a big issue moving the xsd loading to the end of the xml generation process...)