You are viewing a plain text version of this content. The canonical link for it is here.
Posted to odf-dev@incubator.apache.org by "Svante Schubert (JIRA)" <ji...@apache.org> on 2017/06/20 10:58:00 UTC

[jira] [Resolved] (ODFTOOLKIT-455) Text document with "style:style" attribute cannot be parsed by odfdom

     [ https://issues.apache.org/jira/browse/ODFTOOLKIT-455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Svante Schubert resolved ODFTOOLKIT-455.
----------------------------------------
       Resolution: Fixed
         Assignee: Svante Schubert
    Fix Version/s: 0.6.2-incubating

Thanks again, Bjorn!
I pushed the tested version to our TRUNC. 

With your test patch only the build fails and with your test and fix patches everything works splendid, building with "mvn clean install -Ppedantic"

> 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 Kirchhoff
>            Assignee: Svante Schubert
>             Fix For: 0.6.2-incubating
>
>         Attachments: Example.odt, ODFTOOLKIT-455-Fix.patch, Test_document_with_stylestyle_attribute.patch
>
>
> 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)