Unable to save document that might have malformed XML Part

I’ve attached a file called “Scrambled.doc” that’s been giving us some problems. We can’t save it using Aspose - the following code fails with a null ref exception:



Dim Doc as New Document(SourceFileName)



Doc.Save(DestFileName)



along with the following stack trace:





at xaa035fc640f94856.x39a0e849afa5b554.x1ff8ac05a72bd9dd(Int32 x18d1054d82981887, CustomXmlMarkup x2f992229ae4fc9a1)

at x9e260ffa1ac41ffa.xe397b5e25a350375.x69b2ede4917298d1(CustomXmlMarkup x2f992229ae4fc9a1)

at x9e260ffa1ac41ffa.x163859bfa28558c4.x0a79c02b4c66999f(CustomXmlMarkup x2f992229ae4fc9a1)

at xf989f31a236ff98c.xe0dcd40792266ce3.xcef930bd97bac9bd(Paragraph x41baca1d6c0c2e8e, Boolean xa59013d234619c58, x7d1c3cf590044820 xc30cd6401e231d63)

at xf989f31a236ff98c.xe0dcd40792266ce3.x53ca22156bcc3784(Paragraph x41baca1d6c0c2e8e, x7d1c3cf590044820 xc30cd6401e231d63)

at x9e260ffa1ac41ffa.x163859bfa28558c4.VisitParagraphEnd(Paragraph para)

at Aspose.Words.Paragraph.x3bbb475596fa1de1(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.CompositeNode.xf7ae36cd24e0b11c(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)

at Aspose.Words.CompositeNode.x464d2134480a7bf2(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.CompositeNode.xf7ae36cd24e0b11c(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.Drawing.Shape.Accept(DocumentVisitor visitor)

at Aspose.Words.CompositeNode.x464d2134480a7bf2(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.CompositeNode.xf7ae36cd24e0b11c(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)

at Aspose.Words.CompositeNode.x464d2134480a7bf2(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.CompositeNode.xf7ae36cd24e0b11c(DocumentVisitor x672ff13faf031f3d)

at Aspose.Words.Markup.CustomXmlMarkup.Accept(DocumentVisitor visitor)

at x9e260ffa1ac41ffa.x163859bfa28558c4.x6075c9125351e131(CompositeNode x03e7e66b1eecc96f)

at x9e260ffa1ac41ffa.x163859bfa28558c4.x51ee56decc29a9da(Section xb32f8dd719a105db)

at x9e260ffa1ac41ffa.x163859bfa28558c4.x160a0bf4de8f6bd0()

at x9e260ffa1ac41ffa.x163859bfa28558c4.x8cac5adfe79bc025(x8556eed81191af11 x5ac1382edb7bf2c2)

at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)

at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)

at Aspose.Words.Document.Save(String fileName)

at Test1.MainForm.TestButton_Click(Object sender, EventArgs e) in [our code]







While investigating the document, I saw that the Aspose object model indicates that there are 3 custom XML parts, while the Word object model indicates that there are 4 (ignoring built-in ones). When I extracted the data from the custom XML parts, the third one appears to be referencing an invalid schema or something like that (I’m not so good with XML errors in general, so I may be misinterpreting). I’ve also attached that to this message in the file “customxmlpart.txt”.



Is it possible that the errors found in the third XML part are causing the problems Aspose.Words is having with saving the document? Perhaps the error is causing an exception, the fourth XML part never gets read, and then things go wrong when trying to save? Any more information on this would be much appreciated.



Thanks,

Michael Whalen

Hi Michael,

Thanks for your inquiry. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-9826. 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.

Yes, this issue seems to be related to ' custom XML tags'. Unfortunately, you can not determine which custom xml tag is causing this issue while saving the document. Note that MS Word removes the custom XML tags while saving your document to Doc file format. Please check the attached image for detail.

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


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