XmlDocument.Loadxml System.Xml.XmlException: Name cannot begin with the '8' character - xml from imageglue

StackOverflow https://stackoverflow.com/questions/19429844

  •  01-07-2022
  •  | 
  •  

문제

I'm using ImageGlue to read Exif data from an image. ImageGlue gets the exif data successfully and returns an xml string. When I try to use an XMLDocument to load the xml string, it throws the error:

Name cannot begin with the "8" character".

I know what part of the xml is causing the error, but I don't know if it is an issue with the xml, or the xmldocument object trying to load. The xml is below, the tag causing the error is the last one: Industries, Inc. It doesn't like the "8298", if I remove it, it works fine. Is it ImageGlue's issue not generating the right xml from the Exif, or is the XmlDocument object (C#) not reading it correctly...?

<?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>
도움이 되었습니까?

해결책

That's invalid XML - it's ImageGlue not generating the right XML. It is trying to use an XML tag name of "Tag 8298", but the space doesn't work in there, meaning the 8298 is interpreted as an attribute name, which cannot begin with a digit.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top