c# - How to get this XmlAttribute -


from musicbrainz rest service, following xml:

<artist-list offset="0" count="59">   <artist type="person" id="xxxxx" ext:score="100">   ... 

using wcf , xmlserializationformat, i'm able type , id attributes... how "ext:score" one?

this works:

  public class artist   {     [xmlattribute("id")]     public string id { get; set; }      [xmlattribute("type")]     public artisttype type { get; set; } 

but doesnt:

[xmlattribute("ext:score")] public string score { get; set; } 

it produces serialization exception. i've tried using "score", doesn't work.

any help?

the attribute named "score", , in namespace referenced "ext", presumably xml namespace alias.

so find "ext" maps (look xmlns), , add:

[xmlattribute("score", namespace="http://example.org/ext-9.1#")] public string score { get; set; } 

edit; found here; see xmlns:ext="http://example.org/ext-9.1#". note main objects seem in xmlns="http://musicbrainz.org/ns/mmd-1.0#" may need account @ root/object level.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -