Giter Club home page Giter Club logo

xmltocs's Introduction

XML To C#

Ideally you will run this tool once to examine your XML and the output will be a C# Code that you can use in your application.

w3schools XML Samples

Sample #1

<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>

The result will be:

return new XElement("note",
    new XElement("to", "Tove"),
    new XElement("from", "Jani"),
    new XElement("heading", "Reminder"),
    new XElement("body", "Don't forget me this weekend!"));

Sample #2

<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
    <name>Belgian Waffles</name>
    <price>$5.95</price>
    <description>
   Two of our famous Belgian Waffles with plenty of real maple syrup
   </description>
    <calories>650</calories>
</food>
<food>
    <name>Strawberry Belgian Waffles</name>
    <price>$7.95</price>
    <description>
    Light Belgian waffles covered with strawberries and whipped cream
    </description>
    <calories>900</calories>
</food>
<food>
    <name>Berry-Berry Belgian Waffles</name>
    <price>$8.95</price>
    <description>
    Belgian waffles covered with assorted fresh berries and whipped cream
    </description>
    <calories>900</calories>
</food>
<food>
    <name>French Toast</name>
    <price>$4.50</price>
    <description>
    Thick slices made from our homemade sourdough bread
    </description>
    <calories>600</calories>
</food>
<food>
    <name>Homestyle Breakfast</name>
    <price>$6.95</price>
    <description>
    Two eggs, bacon or sausage, toast, and our ever-popular hash browns
    </description>
    <calories>950</calories>
</food>
</breakfast_menu>

The result will be:

new XElement("breakfast_menu",
    new XElement("food",
        new XElement("name", "Belgian Waffles"),
        new XElement("price", "$5.95"),
        new XElement("description", "Two of our famous Belgian Waffles with plenty of real maple syrup"),
        new XElement("calories", "650"))
    ,
    new XElement("food",
        new XElement("name", "Strawberry Belgian Waffles"),
        new XElement("price", "$7.95"),
        new XElement("description", "Light Belgian waffles covered with strawberries and whipped cream"),
        new XElement("calories", "900"))
    ,
    new XElement("food",
        new XElement("name", "Berry-Berry Belgian Waffles"),
        new XElement("price", "$8.95"),
        new XElement("description", "Belgian waffles covered with assorted fresh berries and whipped cream"),
        new XElement("calories", "900"))
    ,
    new XElement("food",
        new XElement("name", "French Toast"),
        new XElement("price", "$4.50"),
        new XElement("description", "Thick slices made from our homemade sourdough bread"),
        new XElement("calories", "600"))
    ,
    new XElement("food",
        new XElement("name", "Homestyle Breakfast"),
        new XElement("price", "$6.95"),
        new XElement("description", "Two eggs, bacon or sausage, toast, and our ever-popular hash browns"),
        new XElement("calories", "950"))
);

xmltocs's People

Contributors

jaider avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.