How to Include Special Characters in Weave Configuration Files

When you need to use special characters in your Weave configuration files it's necessary to use the CDATA XML construct so that all the characters are correctly interpreted.

All text in an XML file will be interpreted by an XML parser. Some characters (<, >, &, !) have a special meaning in XML so if they are used in an XML file their markup language meaning will be used rather than their literal character meaning. In order to use the literal character meaning of special characters the text is put in a CDATA section. CDATA sections can be used anywhere character data would be used, and anything within the CDATA section will be ignored by the XML parser (that is, the XML markup meaning will be ignored). 

Step-by-step guide

  1. CDATA sections are used a lot when specifying file paths and locations to ensure all characters in the path and file name are interpreted correctly:

    <wms:url><![CDATA[http://services.land.vic.gov.au/catalogue/publicproxy/guest/dv_geoserver/wms]]></wms:url>

    Or when setting filters:

    <filter><![CDATA[plan_code <> 0]]></filter>
    

     

     

  2. CDATA sections begin with the string

    <![CDATA[



  3. CDATA sections end with the string 

     ]]>



  4. An alternative to using CDATA sections is to use the markup characters to get the resulting character you need. However this can get messy, using CDATA sections makes your XML files much more readable and reduces the likelihood of mistakes. 

    For example, the same filter parameter given in Step 1 can be written as:

    <filter>plan_code &lt;&gt; 0</filter>