XmlDocument.Loadxml System.Xml.XmlException:名称不能以 '8' 字符开头 - xml 来自 imageglue



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

名称不能以"8"字符开头。

我知道 xml 的哪一部分导致了错误,但我不知道是 xml 的问题,还是 xmldocument 对象尝试加载的问题。xml在下面,导致错误的标签是最后一个:工业公司它不喜欢"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>
这是

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

最新更新