You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Radhakrishnan J <ra...@tavant.com> on 2004/11/23 07:49:28 UTC
Generating documents consumable by a DTD validating Parser
Hi,
We have a usecase where the XML document generated by XmlBeans needs to be
validated against a DTD. Also, there are cases where CDATA sections need to
be used. This doesn't seem to be straightforward.
GenericStringDocument genericStringDoc =
GenericStringDocument.Factory.newInstance();
genericStringDoc.setGenericString(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<some-content some-attribute=\"some-attribute-value\">" +
"<![CDATA[some-content-value is: Tom &Jerry is my favorite cartoon show
]]>" +
"</some-content>");
Generates the xml text:
<xb:GenericString xmlns:xb="http://tavant/test/xmlbeans">
<?xml version="1.0" encoding="UTF-8"?>
<some-content some-attribute="some-attribute-value">
<![CDATA[some-content-value is: Tom &Jerry is my favorite cartoon
show ]]>
</some-content>
</xb:GenericString>
I have to replace the '<![CDATA' string with '<![CDATA'. Also, special
characters within the CDATA section get replaced with their references, and
do not get dereferenced when seen by a SAX parser. Any suggestions on how
this could be handled neatly ?
Thanks,
Radhakrishnan J
Infrastructure Team
phone: +91-80-51190367
e-mail: radhakrishnan.j@tavant.com
http://kwiki-infra.tavant.com/kwiki/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org