XML deserialization problem (attribute with a namespace)

Posted by Johnny on Stack Overflow See other posts from Stack Overflow or by Johnny
Published on 2010-03-08T10:48:16Z Indexed on 2010/03/08 10:51 UTC
Read the original article Hit count: 474

Filed under:
|
|
|

hi,

I'm trying to deserialize the following XML node (RDF actually) into a class.

<rdf:Description rdf:about="http://d.opencalais.com/genericHasher-1/dae360d4-25f1-34a7-9c70-d5f7e4cfe175">
    <rdf:type rdf:resource="http://s.opencalais.com/1/type/em/e/Country"/>
    <c:name>Egypt</c:name>
</rdf:Description>


    [Serializable]
    [XmlRoot(Namespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#", ElementName = "Description")]
    public class BasicEntity
    {
        [XmlElement(Namespace = "http://s.opencalais.com/1/pred/", ElementName = "name")]
        public string Name { get; set; }
        [XmlAttribute("about", Namespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#")]
        public string Uri { get; set; }
    }

The name element is parsed correctly but the about attribute isn't. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about c#

Related posts about xml-deserialization