[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: RE: XmlObject.Factory.parse throws "Unexpected element: CDATA"
From: "Radu Preotiuc-Pietro" <radu.preotiuc-pietro () oracle ! com>
Date: 2008-10-24 22:41:09
Message-ID: 20081024154109546.00000001396 () RADUP02
[Download RAW message or body]
Hm, this is strange indeed. Maybe a parser bug? You can use XmlOptions to change the \
parser that XmlBeans uses, you should try that.
Radu
________________________________
From: alex.kazantsev@agfa.com [mailto:alex.kazantsev@agfa.com]
Sent: Monday, October 20, 2008 7:12 AM
To: dev@xmlbeans.apache.org
Subject: XmlObject.Factory.parse throws "Unexpected element: CDATA"
Hi All!
I have one XML file which gives me trouble.
The XML is really simple - just root element, subelement and a lot of spaces around. \
I have to attach the file since adding or removing just one character in it makes \
it parsable again (very strange). I really hope that somebody can help me to figure \
out what is the problem with this particular XML (attached).
Environment:
Java 1.5.0_11, XmlBeans 2.4.0
Java code (works fine with other XML files):
XmlObject xml = XmlObject.Factory.parse(new \
File("d:/Laurens/__d3configserver.xml"));
Throws:
org.apache.xmlbeans.XmlException: d:\Laurens\__d3configserver.xml:457:1: error: \
Unexpected element: CDATA
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1263)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345) \
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:252) \
at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:639)
at com.agfa.apomedia.translation.UtilsTest.testGetTranslatedFile(UtilsTest.java:122) \
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:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.jmock.integration.junit3.VerifyingTestCase.runBare(VerifyingTestCase.java:37) \
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 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) \
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) \
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) \
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) \
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) \
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) \
Caused by: org.xml.sax.SAXParseException: Unexpected element: CDATA
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038) \
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)
... 24 more
Thanks, Alex
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3395" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=796124022-24102008><FONT face=Arial
color=#0000ff size=2>Hm, this is strange indeed. Maybe a parser bug? You can use
XmlOptions to change the parser that XmlBeans uses, you should try
that.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=796124022-24102008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=796124022-24102008><FONT face=Arial
color=#0000ff size=2>Radu</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; \
MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> alex.kazantsev@agfa.com
[mailto:alex.kazantsev@agfa.com] <BR><B>Sent:</B> Monday, October 20, 2008
7:12 AM<BR><B>To:</B> dev@xmlbeans.apache.org<BR><B>Subject:</B>
XmlObject.Factory.parse throws "Unexpected element:
CDATA"<BR></FONT><BR></DIV>
<DIV></DIV><BR><FONT face=sans-serif size=2>Hi All!</FONT> <BR><BR><FONT
face=sans-serif size=2>I have one XML file which gives me trouble.
</FONT><BR><FONT face=sans-serif size=2>The XML is really simple - just root
element, subelement and a lot of spaces around. </FONT><BR><FONT
face=sans-serif size=2>I have to attach the file since adding or removing just
one character in it makes it parsable again (very strange).</FONT> <BR><FONT
face=sans-serif size=2>I really hope that somebody can help me to figure out
what is the problem with this particular XML (attached).</FONT> <BR><BR><FONT
face=sans-serif size=2>Environment:</FONT> <BR><FONT face=sans-serif
size=2> Java 1.5.0_11, XmlBeans 2.4.0</FONT>
<BR><BR><FONT face=sans-serif size=2>Java code (works fine with other XML
files):</FONT> <BR><FONT face=sans-serif size=2>
XmlObject xml = XmlObject.Factory.parse(new
File("d:/Laurens/__d3configserver.xml"));</FONT> <BR><BR><FONT face=sans-serif
size=2>Throws:</FONT> <BR><BR><FONT face=sans-serif
size=2>org.apache.xmlbeans.XmlException:
d:\Laurens\__d3configserver.xml:457:1: error: Unexpected element: CDATA</FONT>
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)</FONT>
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276)</FONT>
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1263)</FONT>
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:252)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:639)</FONT>
<BR><FONT face=sans-serif size=2> at
com.agfa.apomedia.translation.UtilsTest.testGetTranslatedFile(UtilsTest.java:122)</FONT> \
<BR><FONT face=sans-serif size=2> at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</FONT> <BR><FONT
face=sans-serif size=2> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</FONT> \
<BR><FONT face=sans-serif size=2> at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</FONT> \
<BR><FONT face=sans-serif size=2> at
java.lang.reflect.Method.invoke(Method.java:585)</FONT> <BR><FONT
face=sans-serif size=2> at
junit.framework.TestCase.runTest(TestCase.java:154)</FONT> <BR><FONT
face=sans-serif size=2> at
org.jmock.integration.junit3.VerifyingTestCase.runBare(VerifyingTestCase.java:37)</FONT> \
<BR><FONT face=sans-serif size=2> at
junit.framework.TestResult$1.protect(TestResult.java:106)</FONT> <BR><FONT
face=sans-serif size=2> at
junit.framework.TestResult.runProtected(TestResult.java:124)</FONT> <BR><FONT
face=sans-serif size=2> at
junit.framework.TestResult.run(TestResult.java:109)</FONT> <BR><FONT
face=sans-serif size=2> at
junit.framework.TestCase.run(TestCase.java:118)</FONT> <BR><FONT
face=sans-serif size=2> at
junit.framework.TestSuite.runTest(TestSuite.java:208)</FONT> <BR><FONT
face=sans-serif size=2> at
junit.framework.TestSuite.run(TestSuite.java:203)</FONT> <BR><FONT
face=sans-serif size=2> at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)</FONT> \
<BR><FONT face=sans-serif size=2>Caused by: org.xml.sax.SAXParseException:
Unexpected element: CDATA</FONT> <BR><FONT face=sans-serif size=2>
at
org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)</FONT> \
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)</FONT>
<BR><FONT face=sans-serif size=2> at
org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)</FONT>
<BR><FONT face=sans-serif size=2> ... 24
more</FONT> <BR><BR><FONT face=sans-serif size=2>Thanks, Alex</FONT>
<BR><BR></BLOCKQUOTE></BODY></HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic