Sign in to follow this  

[.net] XML serialization question

Recommended Posts

I'm trying to serialize a class, and I want the resulting XML to look like this (actual element and attribute names aren't that important, I'm just interested in the structure):
    <someArray someAttribute = "something">
        <blah>something else</blah>
If I didn't need that someAttribute stuck in there this would be trivial, since someArray could just be an actual array in a class called root. But I cannot figure out any way to produce XML that looks like that, with the attribute added. Any clues?

Share this post

Link to post
Share on other sites
This link seems like it has what you are looking for.

Particularily the attribute called XmlAttribute.

You might want to group your array up into a class or struct with your array in to get this to work.

Sorry, if this wasn't more help. I like to do this kind of thing the hard way and write this kind of thing using the XmlDocument and XPathDocument classes along with custom code to read and write the values.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this