c$xml and cdata/empty elements

I created a XML file for a third party with C$XML. This XML file is not accepted because:

 

1. my elements may contain &, ', < or >. In my XML file this is converted to &amp, &apos or &gt. This is not accepted by this third party. When I put the data between 

<![CDATA[              ]]>  and use those signs, the XML file is accepted. Is there an OP-CODE to automatically put the data between <![CDATA[              ]]> and not convert those signs in C$XML?

2. Empty elements are in my XML file like <Val/>. This is not accepted by this third party. They want the empty elements represented like <Val></Val>. Is there a way to do this automatically with C$XML?

 

Emmie

  • Emmie,

    Your third party is clearly not using one of the standard XML processors.  Instead, the third party is probably using some homemade processor.  What you are describing are two different lexical representations of identical data.  If you have any economic leverage over the third party, you might try to use it.

    You can 'fix' the first issue by post-processing the XML document with an XSLT stylesheet.  There is a 'cdata-section-element' attribute in the xsl:output element that will cause the XSL processor to wrap the data in CDATA.

    The second issue can also be fixed in XSLT using a more brute force approach.  Use an identity transform and use a template that matches empty elements; output the empty elements using text.  Not exactly a pretty thing, but it will get the result you need.