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

Mind the CDATA when xml-escaping variables #22

Open
dooley opened this issue Mar 29, 2016 · 2 comments
Open

Mind the CDATA when xml-escaping variables #22

dooley opened this issue Mar 29, 2016 · 2 comments

Comments

@dooley
Copy link

dooley commented Mar 29, 2016

Can someone please explain why some chars in the vars-parameters are replaced by nik4 (line 157)? This way Postgresql throws an error, because the single quotes in the given sql-fragment are replaced by ' Are there any side-effects if we remove the single-quote replacement?

<Layer status="off" name="xxx" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"> <StyleName>xxx</StyleName> <Datasource base="xxx"> <Parameter name="table"><![CDATA[(SELECT id, the_geom FROM xxx WHERE ST_Contains(${sql_poly}, the_geom)) as foo]]></Parameter> <Parameter name="key_field"><![CDATA[id]]></Parameter> <Parameter name="geometry_field"><![CDATA[the_geom]]></Parameter> </Datasource> </Layer>
nik4.py --vars sql_poly="ST_GeomFromText('POLYGON((9.6101188659668 53.324516580827, 9.6933746337891 53.323081133135, 9.6933746337891 53.294875047878, 9.6104621887207 53.297440007518, 9.6101188659668 53.324516580827))',4326)" ...

@Zverik
Copy link
Owner

Zverik commented Apr 5, 2016

Well, it seems I xml-screen variables, so they don't break XML. I forgot about CDATA. You can fix this by either removing the CDATA frame, or (for now) removing the replacement from the code.

I'll add a check for CDATA a bit later.

@Zverik Zverik changed the title single quote in vars Mind the CDATA when xml-escaping variables Apr 5, 2016
@dooley
Copy link
Author

dooley commented Apr 5, 2016

I removed that replacing piece of code already on my local instance and so far have not seen any side-effects. But would be nice if we don't have to take care of this when installing on other machines.

And thanks for creating such a useful tool.

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

2 participants