简体   繁体   中英

deserialize XML into object using the xsd.exe gernerated .cs file

I have a myXML.xml file. I used xsd.exe to generate and myXMLClass.cs class files which contains many partial classes.

Now, I want to use this myXMLClass.cs class and retrieve all the nodes/attributes/values/data using my original myXML.XML file. But, how can I do this because of myXMLClass.cs has so many partial classes?

eg. I want to do deserializing using TypeOf myXMLClass like like this. But, myXMLClass contains many partial classes.

XmlSerializer serializer = new XmlSerializer(typeof(myXMLClass??));

Thank you

Update:

Also, I am having problem with obtaining the "code" and "description" of this tag that has this kind of setup.

<HitCode code="4" description="CONSUMER DECLARATION" />

Again, my goal is to retrieve "code" and "description" of this tage.

I ended up ditching the XSD.EXE generated .CS class.

I decided to make my own object class which resemble the XML schema and it works.

@Seminda Thank you for the suggestion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM