[4suite] [Amara] CDATA problem
Uche Ogbuji
uche at ogbuji.net
Mon Apr 13 06:35:36 MDT 2009
Sorry for the slow response.
Jim Urban wrote:
> I’ve been using Amara/4Suite to modify an existing XML document. This
> document has a number of elements that contain CDATA. In the original
> document, they appear like this:
>
> <Description>\n
>
> <![CDATA[Bulk Bin #11 Dist Metal Detector Faulted\n
>
> -----\n
>
> ]]>\n
>
> </Description>
>
> I make modifications to the .XML document and write it back out to a new
> .XML document. My write command looks like this:
>
> outfile.write(doc.xml(cdataSectionElements=[u'Description' ]))
>
> I can successfully add the CDATA statement back in, but unfortunately,
> two additional carriage returns are added to my description so it ends
> up looking like this:
>
> <Description><![CDATA[\n
>
> Bulk Bin #11 Dist Metal Detector Faulted\n
>
> -----\n
>
> \n
>
> ]]></Description>
>
> I have tried adding rules when I bind the file, but have been
> unsuccessful in figuring out the syntax. I can go through and strip the
> ‘\n’ s but that seems kind of inelegant and I was hoping for a better
> solution. Also, I have no control over the original .XML document. It
> is an export from a ControlLogix PLC and there are no output options.
>
> Does anyone have any suggestions?
That would be a wart in 4Suite's writer framework (It doesn't look as if
you used the indent option, so there should be no added whitespace),
except that in a quick test I can't reproduce that.
Can you post a minimal test that reproduces the problem?
Thanks.
--
Uche Ogbuji http://uche.ogbuji.net
Founding Partner, Zepheira http://zepheira.com
Linked-in profile: http://www.linkedin.com/in/ucheogbuji
Articles: http://uche.ogbuji.net/tech/publications/
friendfeed: http://friendfeed.com/uche
More information about the 4suite
mailing list