I am getting unmarshalling exception while using the ListHelper Class for getting unorderedlist. The code is as shown below
- Code: Select all
import org.docx4j.convert.in.xhtml.ListHelper;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.openpackaging.parts.WordprocessingML.NumberingDefinitionsPart;
import org.docx4j.wml.Numbering;
public class TestUnOrderedListTestCase extends ListHelper {
public static void main(String[] args) throws Exception {
TestUnOrderedListTestCase objUnOrderedListTestCaseNDP = new TestUnOrderedListTestCase();
objUnOrderedListTestCaseNDP.test1();
}
public void test1() throws Exception {
try {
NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
Numbering.Num num = getUnorderedList(ndp);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}//end of the class
The exception is as shown below.
[color=#FF0000]
- Code: Select all
javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"abstractNum"). Expected elements are <{urn:schemas-microsoft-com:office:excel}ClientData>,<{urn:schemas-microsoft-com:office:office}OLEObject>,<{http://opendope.org/SmartArt/DataHierarchy}SmartArtDataHierarchy>,<{http://schemas.openxmlformats.org/officeDocument/2006/bibliography}Sources>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}alias>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}altChunk>,<{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}anchor>,<{urn:schemas-microsoft-com:office:word}anchorlock>,<{http://opendope.org/conditions}and>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}annotationRef>,<{urn:schemas-microsoft-com:vml}arc>,<{urn:schemas-microsoft-com:vml}background>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bibliography>,<{http://schemas.openxmlformats.org/drawingml/2006/main}blip>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}body>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkStart>,<{urn:schemas-microsoft-com:office:word}borderbottom>,<{urn:schemas-microsoft-com:office:word}borderleft>,<{urn:schemas-microsoft-com:office:word}borderright>,<{urn:schemas-microsoft-com:office:word}bordertop>,<{urn:schemas-microsoft-com:office:office}bottom>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}br>,<{urn:schemas-microsoft-com:office:office}callout>,<{http://schemas.openxmlformats.org/drawingml/2006/chart}chart>,<{http://schemas.openxmlformats.org/drawingml/2006/chart}chartSpace>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}citation>,<{urn:schemas-microsoft-com:office:office}clippath>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}color>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}colorsDef>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}colorsDefHdr>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}colorsDefHdrLst>,<{urn:schemas-microsoft-com:office:office}column>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}commentRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}commentRangeStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}commentReference>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}comments>,<{urn:schemas-microsoft-com:office:office}complex>,<{http://opendope.org/components}components>,<{http://opendope.org/conditions}condition>,<{http://opendope.org/conditions}conditionref>,<{http://opendope.org/conditions}conditions>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}continuationSeparator>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}cr>,<{urn:schemas-microsoft-com:vml}curve>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}dataBinding>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}dataModel>,<{http://schemas.microsoft.com/office/drawing/2008/diagram}dataModelExt>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}dayLong>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}dayShort>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}del>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}delText>,<{urn:schemas-microsoft-com:office:office}diagram>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}docDefaults>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}document>,<{http://schemas.microsoft.com/office/drawing/2008/diagram}drawing>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}drawing>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}endnoteRef>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}endnotes>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}equation>,<{urn:schemas-microsoft-com:office:office}extrusion>,<{http://opendope.org/conditions}false>,<{urn:schemas-microsoft-com:office:office}fill>,<{urn:schemas-microsoft-com:vml}fill>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}fldChar>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}fldSimple>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}fonts>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}footerReference>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}footnoteRef>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}footnotes>,<{urn:schemas-microsoft-com:vml}formulas>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ftr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}glossaryDocument>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}group>,<{urn:schemas-microsoft-com:vml}group>,<{urn:schemas-microsoft-com:vml}handles>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}hdr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}headerReference>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}highlight>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}hyperlink>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}id>,<{urn:schemas-microsoft-com:vml}image>,<{http://opendope.org/SmartArt/DataHierarchy}imageRef>,<{urn:schemas-microsoft-com:vml}imagedata>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ind>,<{urn:schemas-microsoft-com:office:office}ink>,<{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}inline>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ins>,<{urn:schemas-microsoft-com:office:powerpoint}iscomment>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}jc>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}lastRenderedPageBreak>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}layoutDef>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}layoutDefHdr>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}layoutDefHdrLst>,<{urn:schemas-microsoft-com:office:office}left>,<{http://schemas.openxmlformats.org/drawingml/2006/compatibility}legacyDrawing>,<{urn:schemas-microsoft-com:vml}line>,<{http://opendope.org/SmartArt/DataHierarchy}list>,<{http://opendope.org/SmartArt/DataHierarchy}listItem>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}lock>,<{urn:schemas-microsoft-com:office:office}lock>,<{http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas}lockedCanvas>,<{http://schemas.openxmlformats.org/officeDocument/2006/math}mathPr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}monthLong>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}monthShort>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}noBreakHyphen>,<{http://opendope.org/conditions}not>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}numPr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}numbering>,<{http://schemas.openxmlformats.org/officeDocument/2006/math}oMath>,<{http://schemas.openxmlformats.org/officeDocument/2006/math}oMathPara>,<{http://opendope.org/conditions}or>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}outlineLvl>,<{urn:schemas-microsoft-com:vml}oval>,<{http://opendope.org/SmartArt/DataHierarchy}p>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pBdr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pPr>,<{urn:schemas-microsoft-com:vml}path>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}permEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}permStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pgNum>,<{http://schemas.openxmlformats.org/drawingml/2006/picture}pic>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}pict>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}picture>,<{urn:schemas-microsoft-com:vml}polyline>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}proofErr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ptab>,<{http://opendope.org/questions}question>,<{http://opendope.org/questions}questionnaire>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}r>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}rFonts>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}rPr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}rStyle>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}recipients>,<{urn:schemas-microsoft-com:vml}rect>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}relIds>,<{http://opendope.org/questions}response>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}richText>,<{urn:schemas-microsoft-com:office:office}right>,<{urn:schemas-microsoft-com:vml}roundrect>,<{http://schemas.openxmlformats.org/schemaLibrary/2006/main}schemaLibrary>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sdt>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sdtContent>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sdtPr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sectPr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}separator>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}settings>,<{urn:schemas-microsoft-com:vml}shadow>,<{urn:schemas-microsoft-com:vml}shape>,<{urn:schemas-microsoft-com:office:office}shapedefaults>,<{urn:schemas-microsoft-com:office:office}shapelayout>,<{urn:schemas-microsoft-com:vml}shapetype>,<{http://opendope.org/SmartArt/DataHierarchy}sibTransBody>,<{urn:schemas-microsoft-com:office:office}signatureline>,<{urn:schemas-microsoft-com:office:office}skew>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}smartTag>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}softHyphen>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}spacing>,<{urn:schemas-microsoft-com:vml}stroke>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}style>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}styleDef>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}styleDefHdr>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}styleDefHdrLst>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}styles>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sym>,<{http://schemas.openxmlformats.org/drawingml/2006/diagram}t>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}t>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tab>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tabs>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tag>,<{http://schemas.openxmlformats.org/drawingml/2006/main}tbl>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tbl>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblGrid>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPr>,<{http://schemas.openxmlformats.org/drawingml/2006/main}tblStyleLst>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tc>,<{http://opendope.org/SmartArt/DataHierarchy}textBody>,<{urn:schemas-microsoft-com:vml}textbox>,<{urn:schemas-microsoft-com:office:powerpoint}textdata>,<{urn:schemas-microsoft-com:vml}textpath>,<{http://schemas.openxmlformats.org/drawingml/2006/main}theme>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeManager>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeOverride>,<{urn:schemas-microsoft-com:office:office}top>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tr>,<{http://opendope.org/conditions}true>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}txbxContent>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}u>,<{http://schemas.openxmlformats.org/drawingml/2006/chart}userShapes>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}webSettings>,<{urn:schemas-microsoft-com:office:word}wrap>,<{http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing}wsDr>,<{}xml>,<{http://opendope.org/conditions}xpathref>,<{http://opendope.org/xpaths}xpaths>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}yearLong>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}yearShort>[/color]
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:648)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:236)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:231)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1051)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:484)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:135)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:105)
at org.docx4j.XmlUtils.unmarshalString(XmlUtils.java:275)
at org.docx4j.XmlUtils.unmarshalString(XmlUtils.java:255)
at org.docx4j.convert.in.xhtml.ListHelper.getUnorderedList(ListHelper.java:27)
at com.csc.reportbuilder.tmpronto.xsltdocx4jreport.TestUnOrderedListTestCase.test1(TestUnOrderedListTestCase.java:24)
at com.csc.reportbuilder.tmpronto.xsltdocx4jreport.TestUnOrderedListTestCase.main(TestUnOrderedListTestCase.java:15)
Can you please adivce me where I am doing the mistake.
Can you please share me the code how to render the unorderedlist.
Thanks & Regards,
B.V.Suresh Babu.