Archived Forum Post

Index of archived forum posts

Question:

Reading XMP data

Jan 22 '14 at 10:18

I am trying to read XMP from a jpg but with no luck. Running in VS2013, using latest C# x64 chilkat XMP download, .net 4.5,

The image has 5 embedded xmp docs, when I break into line xmp.GetEmbedded(i), doc is always empty. I have verified valid XMP exists in the photo using another XMP viewer.

        var xmp = new Xmp();
        xmp.UnlockComponent("anything for 30-day trial");
        xmp.LoadAppFile(@"c:\_dev\testphotos\june 28 005.JPG");

        var n = xmp.NumEmbedded;

        for (var i =0; i<n; i++)
        {
            var doc = xmp.GetEmbedded(i);
            Debug.WriteLine(doc.Content);
        }

What am I missing?


Answer

Thanks. I received your email with the JPG, and I will test it now..


Answer

I tested, but did not find any problem. I noticed two things: You're not checking the return value of UnlockComponent or LoadAppFile. Check that these methods return true for success, and if not, then examine the contents of the LastErrorText.


Answer

OK found the problem.

I misinterpreted the docs. I was using Chilkat.Xml.Content but should have been using Chilkat.Xml.GetXml().

When I switched it works fine.