GNOME Bugzilla – Bug 356476
F-Spot removes non-supported existing xmp tags
Last modified: 2006-09-20 06:17:48 UTC
Before importing photo, the photo contains the following XMP tags. verified with strings <photo> | more <?xpacket begin=" " id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Public XMP Toolkit Core 4.0"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"> <photoshop:Urgency>8</photoshop:Urgency> <photoshop:Instructions>Instructions String</photoshop:Instructions> <photoshop:City>City String</photoshop:City> <photoshop:State>State String</photoshop:State> <photoshop:Country>Country String</photoshop:Country> <photoshop:TransmissionReference>Job Identifier String</photoshop:TransmissionReference> <photoshop:Headline>Headline String</photoshop:Headline> <photoshop:Credit>Provider String</photoshop:Credit> <photoshop:Source>Source String</photoshop:Source> <photoshop:CaptionWriter>Description Writer String</photoshop:CaptionWriter> <photoshop:AuthorsPosition>Creator Job Title</photoshop:AuthorsPosition> <photoshop:SupplementalCategories> <rdf:Bag> <rdf:li>Categories 1</rdf:li> <rdf:li>Categories 2</rdf:li> <rdf:li>Categories 3</rdf:li> </rdf:Bag> </photoshop:SupplementalCategories> <photoshop:DateCreated>2006-09-16</photoshop:DateCreated> <photoshop:Category>Category String</photoshop:Category> </rdf:Description> <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:creator> <rdf:Seq> <rdf:li>Creator Name</rdf:li> </rdf:Seq> </dc:creator> <dc:subject> <rdf:Bag> <rdf:li>Keyword 1</rdf:li> <rdf:li>Keyword 2</rdf:li> <rdf:li>Keyword 3</rdf:li> </rdf:Bag> </dc:subject> <dc:description> <rdf:Alt> <rdf:li xml:lang="x-default">AppleMark
</rdf:li> </rdf:Alt> </dc:description> <dc:title> <rdf:Alt> <rdf:li xml:lang="x-default">Title String</rdf:li> </rdf:Alt> </dc:title> <dc:rights> <rdf:Alt> <rdf:li xml:lang="x-default">Copyright Notice String</rdf:li> </rdf:Alt> </dc:rights> </rdf:Description> <rdf:Description rdf:about="" xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/"> <xapRights:WebStatement>URL.COM.String</xapRights:WebStatement> <xapRights:UsageTerms> <rdf:Alt> <rdf:li xml:lang="x-default">Rights Usage Terms String</rdf:li> </rdf:Alt> </xapRights:UsageTerms> </rdf:Description> <rdf:Description rdf:about="" xmlns:xap="http://ns.adobe.com/xap/1.0/"> <xap:Rating>4</xap:Rating> </rdf:Description> <rdf:Description rdf:about="" xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/"> <Iptc4xmpCore:Location>Location String</Iptc4xmpCore:Location> <Iptc4xmpCore:CountryCode>US</Iptc4xmpCore:CountryCode> <Iptc4xmpCore:IntellectualGenre>Intellectual Genre String</Iptc4xmpCore:IntellectualGenre> <Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource"> <Iptc4xmpCore:CiAdrExtadr>Creator Address 1
Creator Address 1</Iptc4xmpCore:CiAdrExtadr> <Iptc4xmpCore:CiAdrCity>Creator City</Iptc4xmpCore:CiAdrCity> <Iptc4xmpCore:CiAdrRegion>Creator State/Province</Iptc4xmpCore:CiAdrRegion> <Iptc4xmpCore:CiAdrPcode>Creator Postal Code</Iptc4xmpCore:CiAdrPcode> <Iptc4xmpCore:CiAdrCtry>Creator Country</Iptc4xmpCore:CiAdrCtry> <Iptc4xmpCore:CiTelWork>Creator Phone 1
Creator Phone 2</Iptc4xmpCore:CiTelWork> <Iptc4xmpCore:CiEmailWork>Creator email@address1
Creator email@address2</Iptc4xmpCore:Ci EmailWork> <Iptc4xmpCore:CiUrlWork>Creator web.address.com1
Creator web.address.com2</Iptc4xmpCore: CiUrlWork> </Iptc4xmpCore:CreatorContactInfo> <Iptc4xmpCore:SubjectCode> <rdf:Bag> <rdf:li>12345678</rdf:li> <rdf:li>23456789</rdf:li> <rdf:li>34567890</rdf:li> </rdf:Bag> </Iptc4xmpCore:SubjectCode> <Iptc4xmpCore:Scene> <rdf:Bag> <rdf:li>123456</rdf:li> <rdf:li>234567</rdf:li> <rdf:li>345678</rdf:li> </rdf:Bag> </Iptc4xmpCore:Scene> </rdf:Description> <rdf:Description rdf:about="" xmlns:mediapro="http://ns.iview-multimedia.com/mediapro/1.0/"> <mediapro:Status>Status String</mediapro:Status> <mediapro:Event>Event String</mediapro:Event> <mediapro:People> <rdf:Bag> <rdf:li>People 1</rdf:li> <rdf:li>People 2</rdf:li> <rdf:li>People 3</rdf:li> </rdf:Bag> </mediapro:People> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="w"?> After importing, and automatically tagged it as a favorite, the embedded XMP information looks like this. verified with strings <photo> | more <?xpacket begin=" " id="testing"?> <x:xmpmeta xmlns:x="adobe:ns:meta/"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns="http://purl.org/dc/elements/1.1/ "> <rdf:Description> <ns:subject> <rdf:Bag> <rdf:li>City String</rdf:li> <rdf:li>State String</rdf:li> <rdf:li>Country String</rdf:li> <rdf:li>Source String</rdf:li> <rdf:li>Categories 1</rdf:li> <rdf:li>Categories 2</rdf:li> <rdf:li>Categories 3</rdf:li> <rdf:li>Keyword 1</rdf:li> <rdf:li>Keyword 2</rdf:li> <rdf:li>Keyword 3</rdf:li> <rdf:li>Location String</rdf:li> <rdf:li>Favorites</rdf:li> </rdf:Bag> </ns:subject> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="r"?>
Created attachment 72960 [details] Photo with lots of embedded XMP tags This test photo, have been tagged by iViewMedia Pro. I put something on every tag field I could find. 1) Check the tags on the original photo with "strings <original photo> | more" 2) Import the photo to f-spot, and tag it as a favorite during import 3) Check the tags on the imported photo with "strings <imported photo> | more"
I get the following two exceptions during import/tagging. loading exif data Saved 1628 bytes System.ArgumentException: Invalid attribute namespace for namespace declaration. at System.Xml.XmlAttribute..ctor (System.String prefix, System.String localName, System.String namespaceURI, System.Xml.XmlDocument doc, Boolean atomizedNames, Boolean checkNamespace) [0x00000] at System.Xml.XmlDocument.CreateAttribute (System.String prefix, System.String localName, System.String namespaceURI, Boolean atomizedNames, Boolean checkNamespace) [0x00000] at System.Xml.XmlDocument.CreateAttribute (System.String prefix, System.String localName, System.String namespaceURI) [0x00000] at SemWeb.RdfXmlWriter.SetAttribute (System.Xml.XmlElement element, System.String nsuri, System.String prefix, System.String localname, System.String val) [0x00000] at SemWeb.RdfXmlWriter.Close () [0x00000] at FSpot.Xmp.XmpFile.Save (System.IO.Stream stream) [0x00000] ... ... loading exif data old = "" new = "" heading = "ASCII" loading exif data value = 2005:09:02 16:57:11 len = 19 System.Xml.XmlException: Document element did not appear. Line 1, position 1. at System.Xml.XmlTextReader.Read () [0x00000] at Mono.Xml.EntityResolvingXmlReader.Read () [0x00000] at Mono.Xml.DTDValidatingReader.ReadContent () [0x00000] at Mono.Xml.DTDValidatingReader.Read () [0x00000] at Mono.Xml.Schema.XsdValidatingReader.Read () [0x00000] at System.Xml.XmlValidatingReader.Read () [0x00000] at SemWeb.RdfXmlReader+XmlBaseAwareReader.Read () [0x00000] at SemWeb.RdfXmlReader.Select (StatementSink storage) [0x00000] at SemWeb.Store.Import (StatementSource source) [0x00000] at SemWeb.MemoryStore.Import (StatementSource source) [0x00000] at FSpot.Xmp.XmpFile.Load (System.IO.Stream stream) [0x00000] _:bnode1689108480 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> . _:bnode1689108480 <http://www.w3.org/1999/02/22-rdf-syntax-ns#li> "City String" .
Seems to be related with bug #356242
I suspect this is the new SemWeb getting upset about the empty About="" attributes... We need to fix SemWeb to handle this.
I checked this RDF extract in the W3 validator (http://www.w3.org/RDF/Validator/) and it parsed successfully (after I joined some tags that had a <CR> in it) Testing the RDF validator (http://rdfabout.com/demo/validator/) with the same RDF extract (removed the first three lines, and the last two lines so I only kept everything between the first <rdf:RDF>) failed. Validation failed: An empty relative URI was found in the document but could not be converted into an absolute URI because no base URI is known for the document. ============ W3 validator parsed successfully the following extract: <?xpacket begin=" " id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Public XMP Toolkit Core 4.0"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"> <photoshop:Urgency>8</photoshop:Urgency> <photoshop:Instructions>Instructions String</photoshop:Instructions> <photoshop:City>City String</photoshop:City> <photoshop:State>State String</photoshop:State> <photoshop:Country>Country String</photoshop:Country> <photoshop:TransmissionReference>Job Identifier String</photoshop:TransmissionReference> <photoshop:Headline>Headline String</photoshop:Headline> <photoshop:Credit>Provider String</photoshop:Credit> <photoshop:Source>Source String</photoshop:Source> <photoshop:CaptionWriter>Description Writer String</photoshop:CaptionWriter> <photoshop:AuthorsPosition>Creator Job Title</photoshop:AuthorsPosition> <photoshop:SupplementalCategories> <rdf:Bag> <rdf:li>Categories 1</rdf:li> <rdf:li>Categories 2</rdf:li> <rdf:li>Categories 3</rdf:li> </rdf:Bag> </photoshop:SupplementalCategories> <photoshop:DateCreated>2006-09-16</photoshop:DateCreated> <photoshop:Category>Category String</photoshop:Category> </rdf:Description> <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:creator> <rdf:Seq> <rdf:li>Creator Name</rdf:li> </rdf:Seq> </dc:creator> <dc:subject> <rdf:Bag> <rdf:li>Keyword 1</rdf:li> <rdf:li>Keyword 2</rdf:li> <rdf:li>Keyword 3</rdf:li> </rdf:Bag> </dc:subject> <dc:description> <rdf:Alt> <rdf:li xml:lang="x-default">AppleMark
</rdf:li> </rdf:Alt> </dc:description> <dc:title> <rdf:Alt> <rdf:li xml:lang="x-default">Title String</rdf:li> </rdf:Alt> </dc:title> <dc:rights> <rdf:Alt> <rdf:li xml:lang="x-default">Copyright Notice String</rdf:li> </rdf:Alt> </dc:rights> </rdf:Description> <rdf:Description rdf:about="" xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/"> <xapRights:WebStatement>URL.COM.String</xapRights:WebStatement> <xapRights:UsageTerms> <rdf:Alt> <rdf:li xml:lang="x-default">Rights Usage Terms String</rdf:li> </rdf:Alt> </xapRights:UsageTerms> </rdf:Description> <rdf:Description rdf:about="" xmlns:xap="http://ns.adobe.com/xap/1.0/"> <xap:Rating>4</xap:Rating> </rdf:Description> <rdf:Description rdf:about="" xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/"> <Iptc4xmpCore:Location>Location String</Iptc4xmpCore:Location> <Iptc4xmpCore:CountryCode>US</Iptc4xmpCore:CountryCode> <Iptc4xmpCore:IntellectualGenre>Intellectual Genre String</Iptc4xmpCore:IntellectualGenre> <Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource"> <Iptc4xmpCore:CiAdrExtadr>Creator Address 1
Creator Address 1</Iptc4xmpCore:CiAdrExtadr> <Iptc4xmpCore:CiAdrCity>Creator City</Iptc4xmpCore:CiAdrCity> <Iptc4xmpCore:CiAdrRegion>Creator State/Province</Iptc4xmpCore:CiAdrRegion> <Iptc4xmpCore:CiAdrPcode>Creator Postal Code</Iptc4xmpCore:CiAdrPcode> <Iptc4xmpCore:CiAdrCtry>Creator Country</Iptc4xmpCore:CiAdrCtry> <Iptc4xmpCore:CiTelWork>Creator Phone 1
Creator Phone 2</Iptc4xmpCore:CiTelWork> <Iptc4xmpCore:CiEmailWork>Creator email@address1
Creator email@address2</Iptc4xmpCore:CiEmailWork> <Iptc4xmpCore:CiUrlWork>Creator web.address.com1
Creator web.address.com2</Iptc4xmpCore:CiUrlWork> </Iptc4xmpCore:CreatorContactInfo> <Iptc4xmpCore:SubjectCode> <rdf:Bag> <rdf:li>12345678</rdf:li> <rdf:li>23456789</rdf:li> <rdf:li>34567890</rdf:li> </rdf:Bag> </Iptc4xmpCore:SubjectCode> <Iptc4xmpCore:Scene> <rdf:Bag> <rdf:li>123456</rdf:li> <rdf:li>234567</rdf:li> <rdf:li>345678</rdf:li> </rdf:Bag> </Iptc4xmpCore:Scene> </rdf:Description> <rdf:Description rdf:about="" xmlns:mediapro="http://ns.iview-multimedia.com/mediapro/1.0/"> <mediapro:Status>Status String</mediapro:Status> <mediapro:Event>Event String</mediapro:Event> <mediapro:People> <rdf:Bag> <rdf:li>People 1</rdf:li> <rdf:li>People 2</rdf:li> <rdf:li>People 3</rdf:li> </rdf:Bag> </mediapro:People> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="w"?> === The RDF parser at SEMWEB failed the above RDF extract (after removing the first three lines (keeping everything between the first <rdf:RDF> pair) Error message: Validation failed: An empty relative URI was found in the document but could not be converted into an absolute URI because no base URI is known for the document.
Posted a message to the semweb's yahoo group.
http://tech.groups.yahoo.com/group/semweb-dotnet/message/114
Confirmed. I removed the empty >>about=""<< attribute, and semweb validates it fine.
Got an answer from semweb. --- The solution is to set the BaseURI property on the RdfXmlReader before reading in the document --- a URI that will represent the photo itself. The URI itself doesn't matter, as long as it won't potentially clash with other resources that might be found in the RDF. ---
Been trying to modify MetadataStore.cs - row 204 RdfXmlReader rxr = new RdfXmlReader(stream); // Set a default BaseUri rxr.BaseUri = "dummyforunknowndocs"; descriptions.Import (rxr); XmpFile.cs - row 33 RdfXmlReader rxr = new SemWeb.RdfXmlReader(stream); // Set a default BaseUri rxr.BaseUri = "dummyforunknowndocs"; store.Import (rxr); XmpFile.cs - row 52 writer = new RdfXmlWriter(rdfdoc); // Set a default BaseUri writer.BaseUri = "dummyforunknowndocs"; No luck. I added a debug message, and got the following extra information: prefix=>rdf<, localname=>nodeID<, nsuri=>http://www.w3.org/1999/02/22-rdf-syntax-ns#< prefix=>rdf<, localname=>nodeID<, nsuri=>http://www.w3.org/1999/02/22-rdf-syntax-ns#< prefix=>xmlns<, localname=>CiAdrExtadr<, nsuri=>http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/< System.ArgumentException: Invalid attribute namespace for namespace declaration. at System.Xml.XmlAttribute..ctor (System.String prefix, System.String localName, System.String namespaceURI, System.Xml.XmlDocument doc, Boolean atomizedNames, Boolean checkNamespace) [0x00000] at System.Xml.XmlDocument.CreateAttribute (System.String prefix, System.String localName, System.String namespaceURI, Boolean atomizedNames, Boolean checkNamespace) [0x00000] at System.Xml.XmlDocument.CreateAttribute (System.String prefix, System.String localName, System.String namespaceURI) [0x00000] at SemWeb.RdfXmlWriter.SetAttribute (System.Xml.XmlElement element, System.String nsuri, System.String prefix, System.String localname, System.String val) [0x00000] at SemWeb.RdfXmlWriter.Close () [0x00000] at FSpot.Xmp.XmpFile.Save (System.IO.Stream stream) [0x00000]
Another answer from semweb (Joshua Tauberer) ========== > I tried to set the BaseUri just before the Import was done. > But I still get the following error. > > System.ArgumentException: Invalid attribute namespace for namespace > declaration. That's a real bug. It was caused by the library trying to make up a namespace prefix, and it came up with a bad one: "xmlns", which is of course reserved for XML namespaces. I'm pushing version 0.75 to the website in a few minutes (http://razor.occams.info/code/semweb) which fixes this, plus a number of other things that have been waiting to be released for a few months. ========== Have not tried this latest release of their semweb though.
ok, well I just commited a hack to work around that in our code as well. The code in cvs should work properly at least.