Exception while using crimson-1.1.3.jar with Aspose.Words for Java

Hi,
I am using latest aspose jar" aspose.words.jdk16.jar"

When i call document.save(“Output.Docx”) method I am getting the fallowing exception

Exception in thread "Thread-77"
java.lang.AbstractMethodError: org.apache.crimson.tree.XmlDocument.getXmlStandalone() Z
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at asposewobfuscated.rh.a(Unknown Source)
at asposewobfuscated.rh.a(Unknown Source)
at com.aspose.words.eq.Gt(Unknown Source)
at com.aspose.words.eq.a(Unknown Source)...
.
.
.
.
at com.aspose.words.Document.Save(Unknown Source)
at com.aspose.words.Document.Save(Unknown Source)...

Can any one please help me on this ?

Could you please help with this issue as it is Critical?
Thanks

Hi Sreelakshmi,

Thanks for your query. It would be great if you please share your document for investigation purposes.

can any one help with this issue?
Thanks

Hi i am using below code.
I don’t want to delete the

import org.apache.crimsion.tree.XmlWriteContext;
import org.apache.crimsion.tree.XmlDocument;
import org.apache.crimsion.tree.XmlDocumentBuilder;

statements in the below code. we are using these statements in some other part of the class.

import org.apache.crimsion.tree.XmlWriteContext;
import org.apache.crimsion.tree.XmlDocument;
import org.apache.crimsion.tree.XmlDocumentBuilder;
import com.aspose.words.*;

public void insertDocumentAtReplace() throws Exception {
    Document mainDoc = new Document(getMyDir() + "Acutetoxicityfinalreport_dl.Docx");
    mainDoc.getRange().replace(Pattern.compile("\\{Output}\\]"), new InsertDocumentAtReplaceHandler(), false);
    mainDoc.save(getMyDir() + "Outjava.docx");
}

private class InsertDocumentAtReplaceHandler implements IReplacingCallback
{
    public int replacing(ReplacingArgs e) throws Exception
    {
        Document subDoc = new Document(getMyDir() + "Output.rtf");
        
        // Insert a document after the paragraph, containing the match text.
        Paragraph para = (Paragraph) e.getMatchNode().getParentNode();
        insertDocument(para, subDoc);
        
        // Remove the paragraph with the match text.
        para.remove();
        
        return ReplaceAction.SKIP;
    }
}
    
    public static void insertDocument(Node insertAfterNode, Document srcDoc) throws Exception
    {
        // Make sure that the node is either a paragraph or table.
        if ((insertAfterNode.getNodeType() != NodeType.PARAGRAPH) &
                (insertAfterNode.getNodeType() != NodeType.TABLE))
            throw new IllegalArgumentException("The destination node should be either a paragraph or table.");

            // We will be inserting into the parent of the destination paragraph.
        
        
        CompositeNode dstStory = insertAfterNode.getParentNode();

        // This object will be translating styles and lists during the import.
        
        
        NodeImporter importer = new NodeImporter(srcDoc, insertAfterNode.getDocument(), ImportFormatMode.KEEP_SOURCE_FORMATTING);

        // Loop through all sections in the source document.
        
        
        for (Section srcSection: srcDoc.getSections())
        
        {
            
            // Loop through all block level nodes (paragraphs and tables) in the body of the section.
            
            for (Node srcNode: (Iterable) srcSection.getBody())
            
            {
                
                // Let's skip the node if it is a last empty paragraph in a section.
                
                if (srcNode.getNodeType() == (NodeType.PARAGRAPH))
                
                {
                    
                    Paragraph para = (Paragraph) srcNode;
                    
                    if (para.isEndOfSection() && !para.hasChildNodes())
                        
                        continue;
                    
                }
                
                // This creates a clone of the node, suitable for insertion into the destination document.
                
                
                Node newNode = importer.importNode(srcNode, true);
                
                // Insert new node after the reference node.
                
                
                dstStory.insertAfter(newNode, insertAfterNode);
                
                insertAfterNode = newNode;
                
            }
            
        }
        
    }

Please find the attached documents.
Please reply me as early as possible. this is critical issue for us.

Thanks in advance.

Hi Sreelakshmi,

Thanks for sharing the code. I have tested the scenario and have not found any issue while using latest version of Aspose.Words for Java. Please use the latest version of Aspose.Word for Java. I have attached the output document with this post.

Please let us know if you have any more queries.

Hi Sreelakshmi,

Thanks for sharing the information. Are you facing the same exception If you remove the following lines of import?

import org.apache.crimsion.tree.XmlWriteContext;
import org.apache.crimsion.tree.XmlDocument;
import org.apache.crimsion.tree.XmlDocumentBuilder;

I am facing the exception when i have these three statement in my code.
but i don’t want to delete these import statements from my code.these statements are using in the class in some other method.

Hi Sreelakshmi,

Thanks for sharing the information. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSJAVA-592 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,
When can I expect this issue to be fixed.
Thanks,
Kalyani

Hi Kalyani,

Thanks for your query. I have verified the status of this issue form our issue tracking system and like to share with you that this issue is under analysis phase. I am afraid, I can’t provide you any reliable estimate at the moment. Once your issue is analyzed, we will then be able to provide you an estimate.

We appreciate your patience.

is there a solution on this? I got the same exception…

Hi Yiding,

Thanks for your query. I have verified the status of this issue (WORDSJAVA-592) from our issue tracking system and regret to share with you that this issue is still unresolved. Currently it is under analysis phase. We will inform you via this forum thread as soon as it’s resolved.

Sorry for the inconvenience.

Hi,
Any luck on this issue. When can I expect this issue to be resolved
thanks,

Hi Sreelakshmi,

Thanks for your inquiry. Unfortunately, your issue is not resolved yet. Currently, this issue is under analysis phase. I am afraid, I can’t provide you any reliable estimate at the moment. Once your issue is analyzed, we will then be able to provide you an estimate.

We appreciate your patience.

The issues you have found earlier (filed as WORDSJAVA-592) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.