How do I make a serialization class for this?

Posted by chobo2 on Stack Overflow See other posts from Stack Overflow or by chobo2
Published on 2010-05-03T23:53:34Z Indexed on 2010/05/04 1:18 UTC
Read the original article Hit count: 258

Filed under:
|
|
|

I have something like this (sorry for the bad names)

<root xmlns="http://www.domain.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.Domain.com Schema.xsd>
  <product></product>
  <SomeHighLevelElement>
     <anotherElment>
          <lowestElement> </lowestElement>
     </anotherElment>
  </SomeHighLevelElement>
</root>

I have something like this for my class

public class MyClass
{
    public MyClass()
    {
        ListWrapper= new List<UserInfo>();
    }


    public string product{ get; set; }


    public List<SomeHighLevelElement> ListWrapper{ get; set; }


}

public class SomeHighLevelElement
{

    public string lowestElement{ get; set; }
}

But I don't know how to write the code for the "anotherElement" not sure if I have to make another wrapper around it.

Edit

I know get a error in my actual xml file. I have this in my tag

xmlns="http://www.domain.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.Domain.com Schema.xsd

Throws an exception on the root line saying there was a error with this stuff. So I don't know if it is mad at the schemaLocation since I am using local host right now or what.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xml-serialization