【问题标题】:XmlDocument.Loadxml System.Xml.XmlException: Name cannot begin with the '8' character - xml from imageglueXmlDocument.Loadxml System.Xml.XmlException:名称不能以“8”字符开头 - imageglue 中的 xml
【发布时间】:2013-10-17 14:42:14
【问题描述】:

我正在使用 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>

【问题讨论】:

    标签: c# xml exif


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-08
      • 1970-01-01
      • 1970-01-01
      • 2018-02-18
      • 1970-01-01
      • 2020-01-14
      • 2011-05-13
      • 2014-04-16
      相关资源
      最近更新 更多