Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
artemp opened this issue Oct 11, 2011 · 8 comments
Closed
Milestone

Comments

@artemp
Copy link
Member

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.

@artemp
Copy link
Member Author

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.

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

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

@artemp
Copy link
Member Author

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)
}}}

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

@artemp
Copy link
Member Author

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.

@artemp
Copy link
Member Author

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'

}}}

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] done in r2582

@artemp artemp closed this as completed Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant