Loading ...
Sorry, an error occurred while loading the content.

1143Re: org.json.JSONML.java

Expand Messages
  • Stephen M. McKamey
    Aug 1, 2008
      Kyle,

      I think it is important to note that what we are trying to do here is
      foster innovation and build upon each other's ideas to produce a
      better set of tools to perform our projects and day jobs. If it is
      just your hope to get famous by bashing others, good luck to you.
      (However, I suggest you beware of going against Crockford!)

      JSoda may suit your needs but it didn't meet some of the requirements
      which went into the design of JsonML. (In fact the first couple
      revisions of the JsonML grammar looked nearly identical.) JsonML
      isn't limited to purely XHTML, even though it does that very well. It
      is meant to be a round-trip-able format between valid JSON and any
      valid XML fragment. Key considerations were two-way conversion and
      compactness of form.

      JsonML *wasn't* meant to be the way that everything that *could* be
      expressed in XML *should* be expressed in JSON. This is the point
      that I believe Crockford was stating when he started this thread.
      Both "object form", as Crockford calls it, and JsonML ("document
      form") are useful for different purposes. Just because you've named
      an obvious object model doesn't necessarily mean people will jump out
      of their seats to use it.

      I hope that this makes the situation clearer,
      Stephen

      BTW, I think Noam Chomsky
      (http://en.wikipedia.org/wiki/Chomsky_hierarchy) would have an issue
      with your "Not a Language!"
      (http://jsoda.info/JSoda+is#not+a+language) argument. Formal Language
      / Automata Theory doesn't limit the use of the word "language" to mean
      "programming language". As such, JSON and JsonML are both languages
      with explicit grammars. Off topic, but this bugs me every time I
      click over to your site to remind myself what JSoda is.


      --- In json@yahoogroups.com, "Kyle Alan Hale" <kylealanhale@...> wrote:
      >
      > I'd like some clarification: the tagName/childNodes syntax is the key
      > difference between Stephen's JSONML and my alternative, JSoda
      > <http://jsoda.info/ <http://jsoda.info/> >. In fact, your "Object Form"
      > example is a perfect example of a JSoda object. Was this intentional,
      > or a coincidence? Intentional or not, I'd prefer that you didn't refer
      > to such syntax as JSONML, since the lack of such syntax is the sole
      > reason why I created JSoda. To my knowledge, JSoda predates this new
      > "Object Form". If that's true, I'd appreciate compliance with the JSoda
      > license: <http://jsoda.info/License <http://jsoda.info/License> >. I'll
      > eat my hat before I let JSoda be referred to as JSONML.
      >
      > To give some background, I posted JSoda last year as an alternative to
      > JSONML. As I have been using it over the last year, I have realized
      > that JSONML has a smaller size than JSoda, and so is more fit for
      > storage or transmission. Actually, the end result of the realization
      > was that XHTML is much smaller than either, so I use it for storage of
      > DOM representations.
      >
      > However, I still feel that JSoda's syntax is much more suited as a
      > format for a DOM builder than JSONML, because of the use of the tagName
      > and childNodes properties, leading to (in my opinion) a much more
      > intuitively nested XHTML representation.
      >
      > Read more about how to use JSoda as a format for a DOM builder here:
      > <http://jsoda.info/Object.toDOM <http://jsoda.info/Object.toDOM> >, and
      > about JSoda syntax here: <http://jsoda.info/JSoda+is#simple
      > <http://jsoda.info/JSoda+is#simple> >.
      >
      > --- In json@yahoogroups.com, "Douglas Crockford" <douglas@> wrote:
      > >
      > > JsonML is an isomorphic transformation between JSON and XML. With this
      > > transformation, JSON is able to encode XML document structures. The
      > > Array Form represents a node as an array whose first slot is the
      > > tagName and second slot optionally contains an object of attributes.
      > > The remaining slots contain the node's children.
      > >
      > > So
      > >
      > > <div id="demo" class="JSONML"><p>JSONML is a transformation
      > > between<b>JSON</b>and<b>XML</b>that preserves ordering of document
      > > features.</p><p>JSONML can work with JSON arrays or JSON
      > > objects.</p><p>Three<br/>little<br/>words</p></div>
      > >
      > > is equivalent to
      > >
      > > [
      > > "div",
      > > {
      > > "class": "JSONML",
      > > "id": "demo"
      > > },
      > > [
      > > "p",
      > > "JSONML is a transformation between",
      > > [
      > > "b",
      > > "JSON"
      > > ],
      > > "and",
      > > [
      > > "b",
      > > "XML"
      > > ],
      > > "that preserves ordering of document features."
      > > ],
      > > [
      > > "p",
      > > "JSONML can work with JSON arrays or JSON objects."
      > > ],
      > > [
      > > "p",
      > > "Three",
      > > ["br"],
      > > "little",
      > > ["br"],
      > > "words"
      > > ]
      > > ]
      > >
      > > I added the Object Form to JSONML.java. It represents a node as an
      > > object. The node's attributes are the object's properties. The
      > > "tagName" property is the tagName, and the "childNodes" property is an
      > > array of objects.
      > >
      > > {
      > > "childNodes": [
      > > {
      > > "childNodes": [
      > > "JSONML is a transformation between",
      > > {
      > > "childNodes": ["JSON"],
      > > "tagName": "b"
      > > },
      > > "and",
      > > {
      > > "childNodes": ["XML"],
      > > "tagName": "b"
      > > },
      > > "that preserves ordering of document features."
      > > ],
      > > "tagName": "p"
      > > },
      > > {
      > > "childNodes":
      > > ["JSONML can work with JSON arrays or JSON objects."],
      > > "tagName": "p"
      > > },
      > > {
      > > "childNodes": [
      > > "Three",
      > > {"tagName": "br"},
      > > "little",
      > > {"tagName": "br"},
      > > "words"
      > > ],
      > > "tagName": "p"
      > > }
      > > ],
      > > "class": "JSONML",
      > > "id": "demo",
      > > "tagName": "div"
      > > }
      > >
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Show all 18 messages in this topic