Hi,
I am trying to run read the xml/docx from the jar and accessing it. It runs fine in java 6. but my server is running in java 5. I want to read and write the docx in java 5 in my unix server. Could you please help in this to resolve or suggest any other alternates.
Code Snippet:
InputStream resourceInputStream = this.getClass().getClassLoader().getResourceAsStream("RAS_Input.xml");
JAXBContext jc = Context.jcXmlPackage;
Unmarshaller u = jc.createUnmarshaller();
u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());
org.docx4j.xmlPackage.Package wmlPackageEl = (org.docx4j.xmlPackage.Package) ((JAXBElement) u.unmarshal(new javax.xml.transform.stream.StreamSource(resourceInputStream))).getValue();
org.docx4j.convert.in.FlatOpcXmlImporter xmlPackage = new org.docx4j.convert.in.FlatOpcXmlImporter(wmlPackageEl);
template = (WordprocessingMLPackage) xmlPackage.get(); // Error occurs here
Exception:
ERROR org.docx4j.convert.in.FlatOpcXmlImporter .getRawPart line 607 - prefix dcterms is not bound to a namespace
ERROR org.docx4j.convert.in.FlatOpcXmlImporter .getRawPart line 608 - <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">wb161491</dc:creator><cp:lastModifiedBy>Praveen Jayaprakash</cp:lastModifiedBy><cp:revision>2</cp:revision><dcterms:created xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="dcterms:W3CDTF">2012-11-19T11:17:00Z</dcterms:created><dcterms:modified xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="dcterms:W3CDTF">2012-11-19T11:17:00Z</dcterms:modified></cp:coreProperties>
java.lang.IllegalArgumentException: prefix dcterms is not bound to a namespace
at com.sun.xml.bind.DatatypeConverterImpl._parseQName(DatatypeConverterImpl.java:324)
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.parseXsiType(XsiTypeLoader.java:53)
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:31)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:402)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:380)
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:35)
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:101)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:224)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:261)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:230)
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:107)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:289)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:272)
at org.docx4j.openpackaging.parts.JaxbXmlPart.unmarshal(JaxbXmlPart.java:285)
at org.docx4j.convert.in.FlatOpcXmlImporter.getRawPart(FlatOpcXmlImporter.java:450)
at org.docx4j.convert.in.FlatOpcXmlImporter.getRawPart(FlatOpcXmlImporter.java:400)
at org.docx4j.convert.in.FlatOpcXmlImporter.getPart(FlatOpcXmlImporter.java:339)
Regards,
Praveen_J