Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
A text document containing a "style:style" attribute for the element style:column-sep, cannot be parsed/loaded by OdfDom.
<style:column-sep style:width="0.009cm" style:color="#000000" style:height="100%" style:style="solid"/>
This is the Excpetion thrown by odfdom-0.8.10:
java.lang.ClassCastException: org.odftoolkit.odfdom.incubator.doc.style.OdfStyle cannot be cast to org.odftoolkit.odfdom.pkg.OdfAttribute
at org.odftoolkit.odfdom.pkg.OdfXMLFactory.newOdfAttribute(OdfXMLFactory.java:256)
at org.odftoolkit.odfdom.pkg.OdfFileDom.createAttributeNS(OdfFileDom.java:332)
at org.odftoolkit.odfdom.pkg.OdfFileDom.createAttributeNS(OdfFileDom.java:322)
at org.odftoolkit.odfdom.pkg.OdfFileSaxHandler.startElement(OdfFileSaxHandler.java:104)
at org.odftoolkit.odfdom.pkg.rdfa.MultiContentHandler.startElement(MultiContentHandler.java:83)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.odftoolkit.odfdom.pkg.OdfFileDom.initialize(OdfFileDom.java:223)
at org.odftoolkit.odfdom.dom.OdfContentDom.initialize(OdfContentDom.java:60)
at org.odftoolkit.odfdom.pkg.OdfFileDom.<init>(OdfFileDom.java:105)
at org.odftoolkit.odfdom.dom.OdfContentDom.<init>(OdfContentDom.java:50)
at org.odftoolkit.odfdom.pkg.OdfFileDom.newFileDom(OdfFileDom.java:157)
at org.odftoolkit.odfdom.pkg.OdfPackageDocument.getFileDom(OdfPackageDocument.java:323)
at org.odftoolkit.odfdom.dom.OdfSchemaDocument.getFileDom(OdfSchemaDocument.java:405)
at org.odftoolkit.odfdom.dom.OdfSchemaDocument.getContentDom(OdfSchemaDocument.java:206)
at org.odftoolkit.simple.Document.getContentRoot(Document.java:870)
at org.odftoolkit.simple.TextDocument.getContentRoot(TextDocument.java:327)
at org.odftoolkit.simple.TextDocument.getContentRoot(TextDocument.java:114)
at de.eeconsultants.escriba.common.officecomponent.blockeditmode.TextBlockVariantUtil.main(TextBlockVariantUtil.java:593)
The reason for this is, that OdfDom treats this attribute as an element inside the class OdfXMLFactory in the method called getOdfNodeClass.
The line:
if (mIncubatorElements.contains(qName))
should look like this:
if ( mIncubatorElements.contains(qName) && nodeType.equals(ELEMENT_PACKAGE_NAME) )
I will provide a patch and a testcase for that.
Attachments
Attachments
Issue Links
- duplicates
-
ODFTOOLKIT-414 ClassCast: OdfStyle cannot be OdfAttribute on some <style:column-sep> (maybe new openoffice?)
- Closed
- is duplicated by
-
ODFTOOLKIT-414 ClassCast: OdfStyle cannot be OdfAttribute on some <style:column-sep> (maybe new openoffice?)
- Closed