An ORM framework for XML

I am always bound to write an XML serializer classes to save data to disk in my different applications that use XML files as a structured info storage.

Is there a tool that you can feed an example of an XML structure and it will generate a c-sharp class to work with such xml structure?

For example I want to work with XML store of "projects"

<projectsInfo>
    <projectTypes>
        <Type>super</Type>
        <Type>best</Type>
    </projectTypes>

    <projects>
        <project>
              <name>One</name>
              <p-type>best</p-type>
        </project>
    </projects>    
</projectsInfo>

And it would generate a Linq-to-XML enabled class to add/remote types and projects instances.

Maybe this is already a commonly solved solution I am just not aware of, or everyone is using a build-in XML serialization of memory objects?

Answers


c# has the XmlSerializer class that is designed to serialise objects to XML files. You can simply annotate your class with various attributes to format the XML. (eg [XmlElement],[XmlAttribute] etc.)


If you have an XSD you can generate it with the xsd.exe that you open in the visual studio command line.

More info: http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.71).aspx

This will auto generate classes from an XSD, and it can generate an XSD from an XML.


You can generate classes/schema based on your xml file using the XSD utility provided with visual studio. Once you have the class, you can use the XmlSerializer to serialzie / deserialize files into instances of class. LINQ will work with any property within the class which implements IEnumerable<T> (any collection). With .net 4 you can also use the dynamic keyword, to build a dynamic xml wrapper, but im not sure its too comfortable / usefull


Need Your Help

How to create multidimensional array with name of columns in PDO

php mysql arrays multidimensional-array pdo

I have this query and I would like to create multidimensional array. I tried this:

Screen resolution java code

java gwt

I would like to know how to fix the browser resolution for a pc of settings 1280X720 so that the web application developed in java using gwt doesnt looked stretched.I have tried