GithubHelp home page GithubHelp logo

xmlson's Introduction

XMLSON

Because XML is too bulky and JSON has crappy library support.

Dude Did You Just Invent Your Own Object Notation What Is Wrong With You?

No way, man. XMLSON isn't an object notation -- it's a stuper-simple object model which you can use to produce stuper-simple JSON and stuper-simple XML.

But Will It Support Like XSchemaNamespacey Local-URI Extension 23A.4FG?

Oh, hells no. XMLSON is not a fancy thing -- it is like a ruler or a crowbar or a rock with a nice sharp point. It is for doing a simple thing: producing humane JSON and XML without having to write two whole damn adapters for each thing.

Ok So When You Said Simple Earlier Like What Did You Mean?

You only gotta keep track of like three things.

  • A document is the top-level deal. It has a name. It has members.
  • An array is a list of things. It has a name. It has members. It can be a member, but not of itself, because that's stupid.
  • An object is a map of things. It has a name. It has properties, which are just things -- strings, numbers, booleans, nulls, objects, or arrays -- with names. It can be a member, but not of itself because dude we just went over that.

Ok In The Main That Is A Simple Thing But I Bet The Output Looks Like Total Butt

No way. The whole point of keeping it stuper-simple is to make sure the same set of objects can be used to produce humane JSON and XML.

Take this set of objects:

XmlsonDocument doc = new XmlsonDocument("recipe");

XmlsonObject info = new XmlsonObject("info");
info.addProperty("name", "How To Not Cook An Egg");
info.addProperty("author", "M.F.K. Fisher");

doc.add(info);

XmlsonArray ingredients = new XmlsonArray("ingredients");
ingredients.add(new XmlsonObject("ingredient").addProperty("name", "1 egg"));
ingredients.add(new XmlsonObject("ingredient").addProperty("name", "a French dude"));

doc.add(ingredients);

It'll produce this JSON:

{
    "info": {
        "name": "How To Not Cook An Egg",
        "author": "M.F.K. Fisher"
    },
    "ingredients": [
        {
            "name": "1 egg"
        },
        {
            "name": "a French dude"
        }
    ]
}

And this XML:

<?xml version="1.0"?>
<recipe>
    <info>
        <name>How To Not Cook An Egg</name>
        <author>M.F.K. Fisher</author>
    </info>
    <ingredients>
        <ingredient>
            <name>1 egg</name>
        </ingredient>
        <ingredient>
            <name>a French dude</name>
        </ingredient>
    </ingredients>
</recipe>

None of these things suck to parse or deal with once parsed.

Well Ok Then I Suppose You Have Convinced Me Of The Merit Of This Thing

Good talk.

xmlson's People

Contributors

codahale avatar

Stargazers

 avatar

Watchers

 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.