Warn when invalid attributes are used in XML to construct Symbolizers #110

Closed
artemp opened this Issue Oct 11, 2011 · 8 comments

Comments

Projects
None yet
1 participant
Owner

artemp commented Oct 11, 2011

Mapnik's XML parsing (in trunk/Mapnik2) recently switched to using all attributes for symbolizers (for Line/Pattern/Raster, etc like Pattern/Text symbolizers always did), but this means it is easy to make a typo of a property name without knowing. We should throw a warning, and perhaps in strict mode throw an error.

Owner

artemp commented Oct 11, 2011

[herm] It would also be nice to have at least a warning when an invalid attribute ist used.

For example

produces no error or warning. But "abc" is not a valid attibute for LineSymbolizer.

Owner

artemp commented Oct 11, 2011

[springmeyer] yes, Herm I agree about the attributes. I am going to work on this. so, accepting ticket

Owner

artemp commented Oct 11, 2011

[springmeyer] but as far as the first problem mentioned, it seems fixed now, as with ? and extra / I get:

{{{
RuntimeError: XML document not well formed:
Couldn't find end of Start Tag TextSymbolizer line 17 (encountered in file 'tests/data/good_maps/text_rotation.xml' at line 18)
}}}

Owner

artemp commented Oct 11, 2011

[springmeyer] okay, impl of this is working, but I need to apply the function to check each part of the map which will take some time, so attaching patch so far for what I have, then will finish up next week.

Owner

artemp commented Oct 11, 2011

[springmeyer] running this on one of the maps in the test suite reveals old usage of 'bgcolor' where mapnik2 only understands 'background-color', so this patch is already helping validate current xml in the test suite. will need to give though about whether to have a setting that might throw...

{{{
#!sh
$ nik2img.py tests/data/good_maps/polygon_symbolizer.xml t.png

warning attribute 'bgcolor' is not valid, acceptable keys are: 'background-color,background-image,srs,buffer_size,paths_from_xml,minimum_version'

}}}

Owner

artemp commented Oct 11, 2011

[springmeyer] done in r2582

artemp closed this Oct 11, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment