Hi, We are using XmlBeans and in some places need to generate documents that are DTD conformant. Sometimes, another XML document needs to be embedded within these documents. I tried to use a SAX Parser ( Xerces v 2.2.0 ) to process a test XML string generated by XmlBeans. The following is the XML ( as seen in java code ),
"<?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>"; XmlBeans generates the following character stream for this ( set as content for the *GenericString* element ). <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 ]]> </some-content> </xb:GenericString> I wrote a simple SAX handler that just prints what it sees ( I'm new to this parsing business ). The following is the output : class org.apache.xerces.jaxp.SAXParserFactoryImpl class org.apache.xerces.jaxp.SAXParserImpl setDocumentLocator(org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy@ 14c1103) startDocument() startElement(,,xb:GenericString,org.apache.xerces.parsers.AbstractSAXParser$ [EMAIL PROTECTED]) characters(char[],int,int): < characters(char[],int,int): <?xm characters(char[],int,int): <?xml version="1.0" encoding="UTF-8"?> characters(char[],int,int): <?xml version="1.0" encoding="UTF-8"?>< characters(char[],int,int): <?xml version="1.0" encoding="UTF-8"?><some-content some-attribute="some-attribute-value"> characters(char[],int,int): <?xml version="1.0" encoding="UTF-8"?><some-content some-attribute="some-attribute-value">< characters(char[],int,int): <?xml version="1.0" encoding="UTF-8"?><some-content some-attribute="some-attribute-value"><!CDATA[some-content-value is: Tom characters(char[],int,int): <?xml version="1.0" encoding="UTF-8"?><some-content some-attribute="some-attribute-value"><!CDATA[some-content-value is: Tom & characters(char[],int,int): <?xml version="1.0" encoding="UTF-8"?><some-content some-attribute="some-attribute-value"><!CDATA[some-content-value is: Tom &Jerry is my favorite cartoo show ! org.xml.sax.SAXParseException: The character sequence "]]>" must not appear in content unless used to mark the end of a CDATA section. at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at tavant.xmlbeans.test.TestMarkupCharactersAsContent.testGenerateXml(TestMarku pCharactersAsContent.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.textui.TestRunner.doRun(TestRunner.java:116) at junit.textui.TestRunner.start(TestRunner.java:172) at com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12) I don't understand the problem here ?? I tried to search the archives but the response time was too high. Apologies if this is an oft-repeated query. Thanks, Radhakrishnan J Infrastructure Team phone: +91-80-51190367 e-mail: [EMAIL PROTECTED] http://kwiki-infra.tavant.com/kwiki/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]