0

I'm trying to compare two PowerPoint presentations at XML level to find the difference between a hidden shape and a visible shape.

For that I'm using the name space Microsoft.XmlDiffPatch and XmlDiff property. But while invoking the compare function I got the error

System.Xml.XmlException: 'Data at the root level is invalid. Line 1, position 1.'

How can I get rid of this type of error? And why do get this error?

Here is my code :

 XmlDiff xmldiff = new XmlDiff(XmlDiffOptions.IgnoreChildOrder|
                               XmlDiffOptions.IgnoreNamespaces|
                               XmlDiffOptions.IgnorePrefixes|
                               XmlDiffOptions.IgnoreWhitespace|
                               XmlDiffOptions.IgnoreComments|
                               XmlDiffOptions.IgnoreXmlDecl);

var Result =
    xmldiff.Compare(XmlReader.Create(@"C:\Users\MySystemDoc\Test\TestSlide1.pptx"),
                    XmlReader.Create(@"C:\Users\MySystemDoc\Test\TestSlide2.pptx"));

Thanks in advance.

yacc
  • 2,915
  • 4
  • 19
  • 33
Curious Bee
  • 55
  • 10
  • 1
    A pptx file is not an XML file. It's basically a zip file which contains the content. You'd have to somehow get an XML-representation of the pptx. – Lennart Jan 15 '20 at 13:23
  • Ok. Let me try that way. @Lennart thanks for the reply . Do you have any other suggessions for me ? – Curious Bee Jan 15 '20 at 13:32
  • 1
    https://stackoverflow.com/questions/520798/diff-for-powerpoint – Lennart Jan 15 '20 at 13:33
  • @Lennart thanks . I went through the link but unfortunately I can't integrate with SharePoint or any other third party which needs to pay. could you tell me how can I use the Review mechanism for my purpose? I just need to understand how the hiding process works in xml level – Curious Bee Jan 15 '20 at 13:53
  • 1
    Use the Open XML SDK Productivity Tool. Open the original file. Use the Compare feature to compare it to the desired result. This will show you how the Office Open XML differs (and also the Open XML SDK code to generate the one from the other). – Cindy Meister Jan 15 '20 at 17:23

0 Answers0