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

Re: org.json.JSONML.java

Expand Messages
  • Stephen M. McKamey
    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
    Message 1 of 18 , Aug 1, 2008
    • 0 Attachment
      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]
      >
    • Fang Yidong
      Why JSoda? No way to me ... :-) ... -- JSON: Action in AJAX! JSON - http://www.json.org JSON.simple - http://www.json.org/java/simple.txt
      Message 2 of 18 , Aug 1, 2008
      • 0 Attachment
        Why JSoda? No way to me ... :-)

        --- Douglas Crockford <douglas@...>:

        > --- 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.
        >
        >
        > The similarity between JSONML Object Form and JSoda
        > is completely
        > coincidental.
        >
        > Your jsoda license it limited to the use of your
        > code. I am not using
        > your code. I have never looked at your code. If you
        > had secured a
        > trademark on JSoda, you might be able to control the
        > way people can
        > use the term. There is no way you can compel anyone
        > to use your term.
        >
        > What you do with your hat is your business.
        >
        >



        --
        JSON: Action in AJAX!

        JSON - http://www.json.org
        JSON.simple - http://www.json.org/java/simple.txt



        ___________________________________________________________
        雅虎邮箱,您的终生邮箱!
        http://cn.mail.yahoo.com/
      • Kyle Alan Hale
        Point(s) well taken. Especially the idea of applying Chomskyan classifications to these subsets. However, some further clarifications: * I neither want to
        Message 3 of 18 , Aug 1, 2008
        • 0 Attachment
          Point(s) well taken. Especially the idea of applying Chomskyan
          classifications to these subsets. However, some further clarifications:

          * I neither want to "get famous" nor bash others, especially Doug. I
          agree that we're all here to build upon each others' ideas to more
          effectively solve our day-to-day problems.
          * The goal of JSoda is to provide a syntax that JsonML lacks. To
          paraphrase you: JsonML may suit your needs but it didn't meet some of
          the requirements which went into the design of JSoda.
          * Doug was mistaken about the terms of the licensing; it also covers
          the documentation, which includes the syntax. As Doug made quite
          clear, I have no real control over the use of JSoda; in fact, the
          license clearly promotes the free use and implementation of these
          ideas. One can't protect an idea, only a product. However, it should
          be noted that intellectual property laws are effective whether
          registered or not, and ignorance of pre-existing intellectual property
          does not exempt one from those laws.

          My only goal in responding to Doug's original post was to clarify that
          his Object Form isn't JsonML, as your site will confirm with its
          very clear grammar form. If it is to be an alternate syntax for
          JsonML, then let's make it that way, officially, and I'll swallow my
          hat. In that case, I offer a ready-to-go DOM builder for the
          JsonML/JSoda syntax: http://jsoda.info/JSoda.toDOM

          In the mean time, I'll update http://jsoda.info/ to reflect your point
          on these subsets as languages, and to trim other unnecessary fluff,
          including anything that could be construed as bashing. I like to
          write in a fairly relaxed style, but I can see how some points on the
          site could be misconstrued. I apologize for that.

          --- In json@yahoogroups.com, "Stephen M. McKamey" <jsonml@...> wrote:
          >
          > 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]
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.