Label captions cause invalid XML

From Fs_wiki

Jump to: navigation, search

Editing Label captions cause invalid XML

If you create a label on your sketch and put spaces in the caption, then this is stored in the XML as follows:

<pctext style="entrance" nodeposxrel="-1.0" nodeposyrel="1.0">0105&space;Riano&space;(Ent.)</pctext>

The &space; part of this crashes some XML parsers/viewers as invalid XML syntax, making it impossible to edit the XML in these editors.

Normally spaces are fine within element text in XML, so the following XML element is fine:

<pctext style="entrance" nodeposxrel="-1.0" nodeposyrel="1.0">0105 Riano (Ent.)</pctext>

However, if you make this edit to the XML file then Tunnel does not keep the spaces when it displays the sketch.


Is there some boilerplate I can stick at the header of the XML file that will cause these &space; things to be interpreted okay by your XML reader? Sometimes it's something like:

<!DOCTYPE publicwhip
[
<!ENTITY space   "–">
]>

If you find what works for your XML reader, I'll put it in.

Footleg: I am not familiar with this technique. Usually you would just parse white space in XML element text as part of the data. All I know is that if I try to view the XML containing &space; in the element text using Internet Explorer then it tells me the file is invalid at this point.