0

我正在使用 ImageGlue 从图像中读取 Exif 数据。ImageGlue 成功获取 exif 数据并返回一个 xml 字符串。当我尝试使用 XMLDocument 加载 xml 字符串时,它会引发错误:

名称不能以“8”字符开头。

我知道 xml 的哪一部分导致了错误,但我不知道这是 xml 的问题,还是试图加载的 xmldocument 对象。xml 在下面,导致错误的标签是最后一个: Industries, Inc. 它不喜欢“8298”,如果我删除它,它可以正常工作。是 ImageGlue 的问题没有从 Exif 生成正确的 xml,还是 XmlDocument 对象(C#)没有正确读取它......?

<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:exif=\"http://ns.adobe.com/exif/1.0/#\">
<rdf:Description>
<dc:date>2013-10-17T14-08-19Z</dc:date>
<dc:type>image</dc:type>
<dc:format>image/jpeg</dc:format>
<dc:source>Photo</dc:source>
<exif:ImageWidth>4368 pixels</exif:ImageWidth>    
<exif:ImageLength>2912 pixels</exif:ImageLength>    
<exif:BitsPerSample>8,8,8</exif:BitsPerSample>  
<exif:Compression>6</exif:Compression>   
<exif:PhotometricInterpretation>2</exif:PhotometricInterpretation>    
<exif:Model>Canon EOS 5D</exif:Model>    
<exif:Orientation>Normal</exif:Orientation>   
<exif:SamplesPerPixel>3</exif:SamplesPerPixel>    
<exif:XResolution>72 pixels per inch</exif:XResolution>    
<exif:YResolution>72 pixels per inch</exif:YResolution>    
<exif:ResolutionUnit>inch</exif:ResolutionUnit>    
<exif:Software>Adobe Photoshop CS5 Windows</exif:Software>    
<exif:DateTime>2013:10:16 10:42:48</exif:DateTime>    
<exif:Artist>bobbi </exif:Artist>    
<exif:ThumbnailOffset>838</exif:ThumbnailOffset> 
<exif:ThumbnailLength>6049</exif:ThumbnailLength>
<exif:Tag 8298>Industries, Inc.</exif:Tag 8298>
4

1 回答 1

4

那是无效的 XML - 它是 ImageGlue 没有生成正确的 XML。它正在尝试使用“Tag 8298”的 XML 标记名称,但其中的空格不起作用,这意味着 8298 被解释为不能以数字开头的属性名称。

于 2013-10-17T14:44:42.700 回答