Bjoern created ODFTOOLKIT-455:
---------------------------------
Summary: Text document with "style:style" attribute cannot be
parsed by odfdom
Key: ODFTOOLKIT-455
URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-455
Project: ODF Toolkit
Issue Type: Bug
Components: odfdom
Reporter: Bjoern
Attachments: Example.odt
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:
{quote}
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)
{quote}
The reason for this is, that OdfDom treats this attribute as an element inside
the class OdfXMLFactory in the method called getOdfNodeClass.
The line:
{quote}
if (mIncubatorElements.contains(qName))
{quote}
should look like this:
{quote}
if ( mIncubatorElements.contains(qName) &&
nodeType.equals(ELEMENT_PACKAGE_NAME) )
{quote}
I will provide a patch and a testcase for that.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)