drewnoakes / xmp-core-dotnet

.NET library for working with the Extensible Metadata Platform (XMP)
60 stars 22 forks source link

XmpMetaFactory.ParseFromBuffer fails when there is an XML-comment in the input XML buffer #44

Closed rominator1983 closed 3 years ago

rominator1983 commented 3 years ago

I think the title explains it quite good. I get an exception:

  HResult=0x80004002
  Message=Unable to cast object of type 'System.Xml.Linq.XComment' to type 'System.Xml.Linq.XElement'.
  Source=XmpCore.StrongName
  StackTrace:
   at XmpCore.Impl.ParseRdf.Rdf_NodeElementList(XmpMeta xmp, XmpNode xmpParent, XElement rdfRdfNode, ParseOptions options)
   at XmpCore.Impl.XmpMetaParser.ParseXmlDoc(XDocument document, ParseOptions options)
   at XXX.cs:line 44
   at XXX.Test.cs:line 116

This will probably also be true for other similar XNodes (processing instruction, ...?)

kwhopper commented 3 years ago

Are you able to share the file, or perhaps the XML out of it?

drewnoakes commented 3 years ago

@rominator1983 thanks for the bug report. I believe this has now been fixed.

rominator1983 commented 3 years ago

oh. sorry I did read your comment only just yet. I had an XML-comment just after the closing xmpmeta-Tag and before the closing packet-Processing-Instruction.