T
thelinuxguy1997
Hi all,
I am new to Java and xmlbeans so I would really appreciate any help or
hint on this matter:
I have a java parser based on xmlbeans that throws an exception when
starts parsing a valid XML file.
1. Here is an excerpt from the faulty code (pretty standard code):
CircuitInquiryResponseDocument m_parsedDoc = null;
try {
System.out.println("getParsedData::uri :"+uri);
File ifile = new File(uri);
m_parsedDoc = CircuitInquiryResponseDocument.Factory.parse(ifile);
//code throws here
.....
//some other code
}
catch (XmlException e)
{
//some exception handling code
}
2. Here is the output:
org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA
[Loaded java.lang.StackTraceElement from
/apps/opt/jdk142_06/jre/lib/rt.jar]
at
org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3467)
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
noNamespace.CircuitInquiryResponseDocument$Factory.parse(Unknown
Source)
at
com.verizon.ncon.nconDataParser.getParsedData(nconDataParser.java:49)
at
com.verizon.ncon.nconDataParser.main(nconDataParser.java:176)
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:3435)
... 7 more
Xml exception
java.io.IOException: org.apache.xmlbeans.XmlException: error:
Unexpected element: CDATA
at
com.verizon.ncon.nconDataParser.getParsedData(nconDataParser.java:110)
at
com.verizon.ncon.nconDataParser.main(nconDataParser.java:176)
3. The xml file is parsed correctly when using a SAX parser. However,
my company wants us to start using the xmlbeans for parsing xml files.
Thanks in advance for any help on this matter,
Silvio
I am new to Java and xmlbeans so I would really appreciate any help or
hint on this matter:
I have a java parser based on xmlbeans that throws an exception when
starts parsing a valid XML file.
1. Here is an excerpt from the faulty code (pretty standard code):
CircuitInquiryResponseDocument m_parsedDoc = null;
try {
System.out.println("getParsedData::uri :"+uri);
File ifile = new File(uri);
m_parsedDoc = CircuitInquiryResponseDocument.Factory.parse(ifile);
//code throws here
.....
//some other code
}
catch (XmlException e)
{
//some exception handling code
}
2. Here is the output:
org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA
[Loaded java.lang.StackTraceElement from
/apps/opt/jdk142_06/jre/lib/rt.jar]
at
org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3467)
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
noNamespace.CircuitInquiryResponseDocument$Factory.parse(Unknown
Source)
at
com.verizon.ncon.nconDataParser.getParsedData(nconDataParser.java:49)
at
com.verizon.ncon.nconDataParser.main(nconDataParser.java:176)
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:3435)
... 7 more
Xml exception
java.io.IOException: org.apache.xmlbeans.XmlException: error:
Unexpected element: CDATA
at
com.verizon.ncon.nconDataParser.getParsedData(nconDataParser.java:110)
at
com.verizon.ncon.nconDataParser.main(nconDataParser.java:176)
3. The xml file is parsed correctly when using a SAX parser. However,
my company wants us to start using the xmlbeans for parsing xml files.
Thanks in advance for any help on this matter,
Silvio