FooDocument.Factory.parse("MyXmlFile.xml");
is an incorrect usage of the api. The string value you intend to should be
something along the lines of:String fooDoc = "<foo><baz>someVal</baz></foo>"; FooDocument.Factory.parse(fooDoc); In this case, I think the error message is to be expected as FooDocument is literally trying to parse "MyXmlFile.xml" as xml rather than the contents of MyXmlFile.xml. It might help to parse the getting started docs to see how some of the other apis are used. Hope this helps, -Jacobd On 10/9/07, Youssef <[EMAIL PROTECTED]> wrote: > > Radu Preotiuc-Pietro wrote: > > It would be interesting to understand why Ole had that error with JDK > > 1.6 and why putting xerces on the classpath solved it, but most of the > > time this "Unexpected element: CDATA" error is caused by an attempt to > > parse non-XML content as XML. > > > > Radu > > > > On Mon, 2007-10-08 at 12:52 +0530, [EMAIL PROTECTED] wrote: > > > >> I am using jre1.5.0_06 and also try to put xerces 2.9.1 in the > >> classpath but still facing same problem. > >> > >> Thanks and Regards, > >> Deepak Jerambhai Pansheriya > >> Tata Consultancy Services > >> Mailto: [EMAIL PROTECTED] > >> Website: http://www.tcs.com > >> ____________________________________________ > >> Experience certainty. IT Services > >> Business Solutions > >> Outsourcing > >> ____________________________________________ > >> > >> > >> Ole Matzura <[EMAIL PROTECTED]> > >> > >> 10/08/2007 12:29 PM > >> Please respond to > >> [email protected] > >> > >> > >> > >> > >> To > >> [email protected] > >> cc > >> > >> Subject > >> Re: error: > >> Unexpected > >> element: CDATA > >> > >> > >> > >> > >> > >> > >> > >> > >> Hi, > >> > >> we had this error under jdk 1.6.0_02 and got around it by putting > >> xerces > >> 2.9.1 in the classpath (instead of using the built-in xerces version) > >> > >> maybe you have a similar setup!? > >> > >> /Ole > >> eviware.com > >> > >> [EMAIL PROTECTED] wrote: > >> > >>> Hi All, > >>> > >>> I get following Exception on parsing my XML file. > >>> > >>> > >>> > >>> _org.apache.xmlbeans.XmlException_: error: Unexpected element: CDATA > >>> at > >>> org.apache.xmlbeans.impl.store.Locale > >>> > >> $SaxLoader.load(_Locale.java:3471_) > >> > >>> at > >>> > >> org.apache.xmlbeans.impl.store.Locale.parse(_Locale.java:706_) > >> > >>> at > >>> > >>> > >> org.apache.xmlbeans.impl.store.Locale.parseToXmlObject > (_Locale.java:690_) > >> > >>> at > >>> > >>> > >> org.apache.xmlbeans.impl.store.Locale.parseToXmlObject > (_Locale.java:677_) > >> > >>> at > >>> > >>> > >> org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse > (_SchemaTypeLoaderBase.java:208_) > >> > >>> at com.tcs.epoch.v100.WITSMAPDocument$Factory.parse(Unknown > >>> Source) > >>> at > >>> > >>> > >> org.epoch.witsml.services.WITSMLService.LoadObjectMaps > (_WITSMLService.java:69_) > >> > >>> at > >>> > >>> > >> org.epoch.witsml.services.WITSMLService.init(_WITSMLService.java:51_) > >> > >>> at > >>> > >>> > >> org.apache.axis.providers.java.JavaProvider.getNewServiceObject > (_JavaProvider.java:238_) > >> > >>> at > >>> > >>> > >> org.apache.axis.providers.java.JavaProvider.getServiceObject > (_JavaProvider.java:91_) > >> > >>> at > >>> > >>> > >> org.apache.axis.providers.java.JavaProvider.invoke > (_JavaProvider.java:287_) > >> > >>> at > >>> > >>> > >> org.apache.axis.strategies.InvocationStrategy.visit > (_InvocationStrategy.java:32_) > >> > >>> at > >>> > >> org.apache.axis.SimpleChain.doVisiting(_SimpleChain.java:118_) > >> > >>> at org.apache.axis.SimpleChain.invoke(_SimpleChain.java:83_) > >>> at > >>> > >>> > >> org.apache.axis.handlers.soap.SOAPService.invoke > (_SOAPService.java:454_) > >> > >>> at > >>> org.apache.axis.server.AxisServer.invoke(_AxisServer.java:281_) > >>> at > >>> > >>> > >> org.apache.axis.transport.http.AxisServlet.doPost > (_AxisServlet.java:699_) > >> > >>> at > >>> > >> javax.servlet.http.HttpServlet.service(_HttpServlet.java:709_) > >> > >>> at > >>> > >>> > >> org.apache.axis.transport.http.AxisServletBase.service > (_AxisServletBase.java:327_) > >> > >>> at > >>> > >> javax.servlet.http.HttpServlet.service(_HttpServlet.java:802_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter > (_ApplicationFilterChain.java:237_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.ApplicationFilterChain.doFilter > (_ApplicationFilterChain.java:157_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardWrapperValve.invoke > (_StandardWrapperValve.java:214_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardValveContext.invokeNext > (_StandardValveContext.java:104_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardPipeline.invoke > (_StandardPipeline.java:520_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardContextValve.invokeInternal > (_StandardContextValve.java:198_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardContextValve.invoke > (_StandardContextValve.java:152_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardValveContext.invokeNext > (_StandardValveContext.java:104_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardPipeline.invoke > (_StandardPipeline.java:520_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardHostValve.invoke > (_StandardHostValve.java:137_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardValveContext.invokeNext > (_StandardValveContext.java:104_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.valves.ErrorReportValve.invoke > (_ErrorReportValve.java:117_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardValveContext.invokeNext > (_StandardValveContext.java:102_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardPipeline.invoke > (_StandardPipeline.java:520_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardEngineValve.invoke > (_StandardEngineValve.java:109_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardValveContext.invokeNext > (_StandardValveContext.java:104_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.StandardPipeline.invoke > (_StandardPipeline.java:520_) > >> > >>> at > >>> > >>> > >> org.apache.catalina.core.ContainerBase.invoke(_ContainerBase.java:929_) > >> > >>> at > >>> > >>> > >> org.apache.coyote.tomcat5.CoyoteAdapter.service > (_CoyoteAdapter.java:160_) > >> > >>> at > >>> > >>> > >> org.apache.coyote.http11.Http11Processor.process > (_Http11Processor.java:799_) > >> > >>> at > >>> org.apache.coyote.http11.Http11Protocol > >>> > >> $Http11ConnectionHandler.processConnection(_Http11Protocol.java:705_) > >> > >>> at > >>> > >>> > >> org.apache.tomcat.util.net.TcpWorkerThread.runIt > (_PoolTcpEndpoint.java:577_) > >> > >>> at > >>> org.apache.tomcat.util.threads.ThreadPool > >>> > >> $ControlRunnable.run(_ThreadPool.java:683_) > >> > >>> at java.lang.Thread.run(Unknown Source) > >>> 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:3439_) > >> > >>> > >>> My XSD is as below. > >>> > >>> <?xml version="1.0" encoding="UTF-8"?> > >>> <xsd:schema xmlns:ets="http://www.tcs.com/epoch/v100" > >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema" > >>> targetNamespace="http://www.tcs.com/epoch/v100" > >>> elementFormDefault="qualified" > >>> > >> attributeFormDefault="unqualified" > >> > >>> version="1.0.0"> > >>> <!-- XML Schema for WITSML OBject Mapping file --> > >>> <xsd:element name="WITSMAP"> > >>> <xsd:annotation> > >>> <xsd:documentation> > >>> WITSML Object-Implementation class > >>> mapping > >>> </xsd:documentation> > >>> </xsd:annotation> > >>> <xsd:complexType> > >>> <xsd:sequence> > >>> <xsd:element name="GetFromStore"> > >>> <xsd:annotation> > >>> <xsd:documentation> > >>> Mapping For > >>> all Get FromStore Implementation > >>> </xsd:documentation> > >>> </xsd:annotation> > >>> <xsd:complexType> > >>> <xsd:sequence> > >>> > >>> > >> <xsd:element > >> > >>> name="ObjectGetFS" > >>> > >>> maxOccurs="unbounded"> > >>> > >>> <xsd:annotation> > >>> > >>> > >> > >> > >>> <xsd:documentation> > >>> > >>> > >> > >> > >>> Object Mapping for GetFromStore > >>> > >>> > >> > >> > >>> Implementation > >>> > >>> > >> > >> > >>> </xsd:documentation> > >>> > >>> </xsd:annotation> > >>> > >>> <xsd:complexType> > >>> > >>> > >> > >> > >>> <xsd:attribute name="ObjName" > >>> > >>> > >> > >> > >>> type="xsd:string" use="required"> > >>> > >>> > >> > >> > >>> <xsd:annotation> > >>> > >>> > >> > >> > >>> <xsd:documentation> > >>> > >>> > >> > >> > >>> Name of WITSML Object > >>> > >>> > >> > >> > >>> </xsd:documentation> > >>> > >>> > >> > >> > >>> </xsd:annotation> > >>> > >>> > >> > >> > >>> </xsd:attribute> > >>> > >>> > >> > >> > >>> <xsd:attribute name="Class" > >>> > >>> > >> > >> > >>> type="xsd:string" use="required"> > >>> > >>> > >> > >> > >>> <xsd:annotation> > >>> > >>> > >> > >> > >>> <xsd:documentation> > >>> > >>> > >> > >> > >>> Class Implement this > >>> > >>> > >> > >> > >>> object for Get From > >>> > >>> > >> > >> > >>> Store Interfaces > >>> > >>> > >> > >> > >>> </xsd:documentation> > >>> > >>> > >> > >> > >>> </xsd:annotation> > >>> > >>> > >> > >> > >>> </xsd:attribute> > >>> > >>> </xsd:complexType> > >>> > >>> > >> </xsd:element> > >> > >>> </xsd:sequence> > >>> </xsd:complexType> > >>> </xsd:element> > >>> <xsd:element name="AddToStore"> > >>> <xsd:annotation> > >>> <xsd:documentation> > >>> Mapping For > >>> all Get FromStro Implementation > >>> </xsd:documentation> > >>> </xsd:annotation> > >>> <xsd:complexType> > >>> <xsd:sequence> > >>> > >>> > >> <xsd:element > >> > >>> name="ObjectAddTS" > >>> > >>> maxOccurs="unbounded" minOccurs="0"> > >>> > >>> <xsd:annotation> > >>> > >>> > >> > >> > >>> <xsd:documentation> > >>> > >>> > >> > >> > >>> Object Mapping for GetFromStore > >>> > >>> > >> > >> > >>> Implementation > >>> > >>> > >> > >> > >>> </xsd:documentation> > >>> > >>> </xsd:annotation> > >>> > >>> <xsd:complexType> > >>> > >>> > >> > >> > >>> <xsd:attribute name="ObjName" > >>> > >>> > >> > >> > >>> type="xsd:string" use="required"> > >>> > >>> > >> > >> > >>> <xsd:annotation> > >>> > >>> > >> > >> > >>> <xsd:documentation> > >>> > >>> > >> > >> > >>> Name of WITSML Object > >>> > >>> > >> > >> > >>> </xsd:documentation> > >>> > >>> > >> > >> > >>> </xsd:annotation> > >>> > >>> > >> > >> > >>> </xsd:attribute> > >>> > >>> > >> > >> > >>> <xsd:attribute name="Class" > >>> > >>> > >> > >> > >>> type="xsd:string" use="required"> > >>> > >>> > >> > >> > >>> <xsd:annotation> > >>> > >>> > >> > >> > >>> <xsd:documentation> > >>> > >>> > >> > >> > >>> Class Implement this > >>> > >>> > >> > >> > >>> object for Get From > >>> > >>> > >> > >> > >>> Store Interfaces > >>> > >>> > >> > >> > >>> </xsd:documentation> > >>> > >>> > >> > >> > >>> </xsd:annotation> > >>> > >>> > >> > >> > >>> </xsd:attribute> > >>> > >>> </xsd:complexType> > >>> > >>> > >> </xsd:element> > >> > >>> </xsd:sequence> > >>> </xsd:complexType> > >>> </xsd:element> > >>> </xsd:sequence> > >>> </xsd:complexType> > >>> </xsd:element> > >>> </xsd:schema> > >>> > >>> > >>> > >>> While my Parsing XML is like this > >>> > >>> <?xml version="1.0" encoding="UTF-8" ?> > >>> <WITSMAP xmlns="http://www.tcs.com/epoch/v100"> > >>> <GetFromStore> > >>> <ObjectGetFS ObjName="Well" Class="" /> > >>> </GetFromStore> > >>> <AddToStore> > >>> <!-- ObjectAddTS ObjName="" Class="" /--> > >>> </AddToStore> > >>> > >>> </WITSMAP> > >>> > >>> > >>> I can not figure out why I am geting this exception. > >>> > >>> > >>> Deepak Jerambhai Pansheriya > >>> Tata Consultancy Services > >>> Mailto: [EMAIL PROTECTED] > >>> Website: http://www.tcs.com > >>> ____________________________________________ > >>> Experience certainty. IT Services > >>> Business Solutions > >>> Outsourcing > >>> ____________________________________________ > >>> =====-----=====-----===== > >>> Notice: The information contained in this e-mail > >>> message and/or attachments to it may contain > >>> confidential or privileged information. If you are > >>> not the intended recipient, any dissemination, use, > >>> review, distribution, printing or copying of the > >>> information contained in this e-mail message > >>> and/or attachments to it are strictly prohibited. If > >>> you have received this communication in error, > >>> please notify us by reply e-mail or telephone and > >>> immediately and permanently delete the message > >>> and any attachments. Thank you > >>> > >>> > >>> > >>> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> ForwardSourceID:NT00006AB2 > >> =====-----=====-----===== > >> Notice: The information contained in this e-mail > >> message and/or attachments to it may contain > >> confidential or privileged information. If you are > >> not the intended recipient, any dissemination, use, > >> review, distribution, printing or copying of the > >> information contained in this e-mail message > >> and/or attachments to it are strictly prohibited. If > >> you have received this communication in error, > >> please notify us by reply e-mail or telephone and > >> immediately and permanently delete the message > >> and any attachments. Thank you > >> > >> > >> > > > > Notice: This email message, together with any attachments, may contain > information of BEA Systems, Inc., its subsidiaries and affiliated > entities, that may be confidential, proprietary, copyrighted and/or > legally privileged, and is intended solely for the use of the individual or > entity named in this message. If you are not the intended recipient, and > have received this message in error, please immediately return this by email > and then delete it. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > hi, > can you please post the java code source you use to parse your xml file? > i had the same strange exceptions when i use > FooDocument.Factory.parse("MyXmlFile.xml"); but when i use > File xmlFile = new File("MyXmlFile.xml"); > FooDocument.Factory.parse(xmlFile); > this exception strangely deseppears!! > > cheers, > > Youssef > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >

