Page 1 of 1

Bumping ppt4jx version to 8.1.0.2

PostPosted: Wed Dec 04, 2019 10:54 pm
by andreyi
Hi.
I have updated pptx4j to 8.1.0.2:

<dependency>
<groupId>com.plutext</groupId>
<artifactId>docx4j-Enterprise-MergePptx</artifactId>
<version>8.1.0.2</version>
</dependency>

But there is a problem with CTExtension class. In plutext 6.1.0.0 the "any" property of that class was instance of Node class. But in 8.1.0.2 "any" is JAXBElement. Is there a way to create a Node object from the JAXBElement, because our logic related with pptxs use Nodes, Nodelist in many places?

Thanks.

Re: Bumping ppt4jx version to 8.1.0.2

PostPosted: Thu Dec 05, 2019 4:10 pm
by jason
Hi Andrey

There is a CTExtension class in a few different packages, so could you please give the full package name?

I thought you might be referring to org.pptx4j.pml.CTExtension, but it hasn't changed recently:-

In docx4j 8.1.3, we have at https://github.com/plutext/docx4j/blob/ ... n.java#L65

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Extension", propOrder = {
    "any"
})
public class CTExtension implements Child
{

    @XmlAnyElement(lax = true)
    protected Object any;
 
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


This was the same in docx4j 6.1.2: https://github.com/plutext/docx4j/blob/ ... nsion.java and the ObjectFactory methods for creating them haven't changed either.

Also, which JAXB implementation are you using? Did you change it recently?

You should be able to create a Node object from a JAXBElement by marshalling it (XmlUtils.marshaltoW3CDomDocument) but I'd like to understand better the issue you are experiencing.

cheers .. Jason

Re: Bumping ppt4jx version to 8.1.0.2

PostPosted: Fri Dec 06, 2019 1:01 pm
by jason
On further examination, the reason for the change in behaviour is that in Version 8.1.0, [MS-PPTX] and [MS-ODRAWXML] content models were updated with latest schemas.

This introduced org.pptx4j.com.microsoft.schemas.office.powerpoint.x2010.main.CTRandomId; see
https://github.com/plutext/docx4j/blob/ ... domId.java

(That's what the JAXBElement contains)

To confirm this, remove package org.pptx4j.com.microsoft.schemas.office.powerpoint.x2010.main, and remove that package from jcPML. The relevant element then unmarshalls as a DOM element.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                if (o instanceof javax.xml.bind.JAXBElement) {
                        Object o2 = XmlUtils.unwrap(o);
                        System.out.println("containing " + o2.getClass().getName());
                       
                        Document d = XmlUtils.marshaltoW3CDomDocument(o, Context.jcPML);
                        System.out.println(d.getDocumentElement().getLocalName());
                }
 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


(You can also force use of a DOM element by using "lax = false" in CTExtension, but the code has never been that way)

Re: Bumping ppt4jx version to 8.1.0.2

PostPosted: Wed Dec 18, 2019 2:16 am
by andreyi
Hi, Jason.
Thank, you for the suggestion. It help me.

Andrey.