Using <Format/> and CDATA does not work in TextSymbolizer #1522

springmeyer opened this Issue Oct 5, 2012 · 3 comments


None yet

2 participants


Something like this works:

<TextSymbolizer face-name="DejaVu Sans Book" dx="10">'hello\n'<Format size='20'>'world'</Format></TextSymbolizer>

But not:

<TextSymbolizer face-name="DejaVu Sans Book" dx="10"><![CDATA['hello\n'<Format size='20'>'world'</Format>]]></TextSymbolizer>

Supporting CDATA for text is important to avoid XML parsing problems on odd characters. But it should not block the usage of <Format/>


This breaks specifically in TileMill where CDATA is used to wrap all values in text-name after mapbox/tilemill#901 and mapbox/carto#125

@springmeyer springmeyer referenced this issue in mapbox/carto Oct 5, 2012

Support Mapnik's text-name Formatter #196

herm commented Oct 5, 2012

Your second example doesn't work because it is wrong. CDATA tells the XML parser not to process any XML tags inside and hello\n'<Format size='20'>'world'</Format> is not a valid expression.

So your example would have to be

<TextSymbolizer face-name="DejaVu Sans Book" dx="10"><![CDATA['hello\n']]><Format size='20'><![CDATA['world']]></Format></TextSymbolizer>

which should work. TileMill has to exclude XML tags from CDATA.

Every other behavior would be insane. It would violate all expectations people have about XML parsing.


Okay, thanks for the comments. Can workaround as per mapbox/carto#196. closing.

@springmeyer springmeyer closed this Oct 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment