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

org.json.JSONML.java

Expand Messages
  • Douglas Crockford
    JsonML is an isomorphic transformation between JSON and XML. With this transformation, JSON is able to encode XML document structures. The Array Form
    Message 1 of 18 , Jul 22, 2008
    • 0 Attachment
      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"
      }
    • Mark Joseph
      How do you deal with XML namespaces? Remember namespaces can appear for the node name and for the attributes of a node. Best, Mark P6R, Inc On Wed, 23 Jul 2008
      Message 2 of 18 , Jul 22, 2008
      • 0 Attachment
        How do you deal with XML namespaces?
        Remember namespaces can appear for the node name and for
        the attributes of a node.

        Best,
        Mark
        P6R, Inc


        On Wed, 23 Jul 2008 02:54:53 -0000
        "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"
        > }
        >

        -------------------------
        Mark Joseph, Ph.D.
        President and Secretary
        P6R, Inc.
        http://www.p6r.com
        408-205-0361
        Fax: 831-476-7490
        Skype: markjoseph_sc
        IM: (Yahoo) mjoseph8888
        (AIM) mjoseph8888
      • Douglas Crockford
        ... The text in the tagNames and attribute names is quoted.
        Message 3 of 18 , Jul 22, 2008
        • 0 Attachment
          --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
          > How do you deal with XML namespaces?

          The text in the tagNames and attribute names is quoted.
        • Mark Joseph
          Just so I understand your stuff resolves the XML namespace prefix (like P6R:tagName ) to the URI http://www.p6r...:tagName , right? Because the URI is the
          Message 4 of 18 , Jul 23, 2008
          • 0 Attachment
            Just so I understand your stuff resolves the XML
            namespace prefix (like "P6R:tagName") to the URI
            "http://www.p6r...:tagName", right? Because the URI is
            the real
            namespace name.

            Best,
            Mark

            On Wed, 23 Jul 2008 06:18:04 -0000
            "Douglas Crockford" <douglas@...> wrote:
            > --- In json@yahoogroups.com, "Mark Joseph" <mark@...>
            >wrote:
            >> How do you deal with XML namespaces?
            >
            > The text in the tagNames and attribute names is quoted.
            >

            -------------------------
            Mark Joseph, Ph.D.
            President and Secretary
            P6R, Inc.
            http://www.p6r.com
            408-205-0361
            Fax: 831-476-7490
            Skype: markjoseph_sc
            IM: (Yahoo) mjoseph8888
            (AIM) mjoseph8888
          • Douglas Crockford
            ... It transforms into { tagName : P6R:tagName } or [ P6R:tagName ] and back.
            Message 5 of 18 , Jul 23, 2008
            • 0 Attachment
              --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
              > Just so I understand your stuff resolves the XML
              > namespace prefix (like "P6R:tagName") to the URI
              > "http://www.p6r...:tagName", right? Because the URI is
              > the real
              > namespace name.

              It transforms <P6R:tagName> into {"tagName":"P6R:tagName"} or
              ["P6R:tagName"] and back.
            • Mark Joseph
              Sorry I am just not getting this. The prefix, in my example is P6R , but the prefix needs to be replaced by its matching URI. So the P6R:tagName in an
              Message 6 of 18 , Jul 24, 2008
              • 0 Attachment
                Sorry I am just not getting this. The prefix, in my
                example is "P6R", but the prefix needs to be replaced by
                its matching URI. So the "P6R:tagName" in an XML
                processor
                gets replaced as "URI:tagName" since the prefix is not
                really important. So is that expansion done in JSONML?

                Best,
                Mark


                On Thu, 24 Jul 2008 05:35:53 -0000
                "Douglas Crockford" <douglas@...> wrote:
                > --- In json@yahoogroups.com, "Mark Joseph" <mark@...>
                >wrote:
                >> Just so I understand your stuff resolves the XML
                >> namespace prefix (like "P6R:tagName") to the URI
                >> "http://www.p6r...:tagName", right? Because the URI is
                >> the real
                >> namespace name.
                >
                > It transforms <P6R:tagName> into
                >{"tagName":"P6R:tagName"} or
                > ["P6R:tagName"] and back.
                >

                -------------------------
                Mark Joseph, Ph.D.
                President and Secretary
                P6R, Inc.
                http://www.p6r.com
                408-205-0361
                Fax: 831-476-7490
                Skype: markjoseph_sc
                IM: (Yahoo) mjoseph8888
                (AIM) mjoseph8888
              • Douglas Crockford
                ... If you need that transformation, you should do the replacement before calling JSONML. I don t understand why you would want to encode JSON names with the
                Message 7 of 18 , Jul 24, 2008
                • 0 Attachment
                  --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                  > The prefix, in my
                  > example is "P6R", but the prefix needs to be replaced by
                  > its matching URI. So the "P6R:tagName" in an XML
                  > processor
                  > gets replaced as "URI:tagName" since the prefix is not
                  > really important. So is that expansion done in JSONML?

                  If you need that transformation, you should do the replacement before
                  calling JSONML. I don't understand why you would want to encode JSON
                  names with the URI form.
                • Stephen M. McKamey
                  The reasoning for the URI form is that the prefix form is only an alias for the URI form. The prefix alias can be made to be anything whereas the true
                  Message 8 of 18 , Jul 24, 2008
                  • 0 Attachment
                    The reasoning for the URI form is that the prefix form is only an
                    alias
                    for the URI form. The prefix alias can be made to be anything
                    whereas
                    the true namespace is the URI. Therefore to actually encode the
                    entire
                    namespaced tag or attribute name (without the associated namespace
                    lookup context) it would need to include the full URI rather than the
                    prefix.

                    --- In json@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
                    >
                    > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
                    > > The prefix, in my
                    > > example is "P6R", but the prefix needs to be replaced by
                    > > its matching URI. So the "P6R:tagName" in an XML
                    > > processor
                    > > gets replaced as "URI:tagName" since the prefix is not
                    > > really important. So is that expansion done in JSONML?
                    >
                    > If you need that transformation, you should do the replacement
                    before
                    > calling JSONML. I don't understand why you would want to encode JSON
                    > names with the URI form.
                    >
                  • Atif Aziz
                    Like XML 1.0, JsonML does not need to care about namespaces. In XML 1.0, a colon (:) is a perfectly valid character in the element name. XML namespaces is
                    Message 9 of 18 , Jul 24, 2008
                    • 0 Attachment
                      Like XML 1.0, JsonML does not need to care about namespaces. In XML 1.0, a colon (:) is a perfectly valid character in the element name. XML namespaces is nothing more than a standardized convention and interpretation of element and attributes names. Some XML parsers allow you to turn namespace handling on or off. Likewise, a JsonML encoder can look at XML without any regard for namespaces though the story could vary for a decoder. Here's an example. Suppose the following XML:

                      <root xmlns:ns1="http://www.example.com/ns1"
                      xmlns:ns2="http://www.example.com/ns2">
                      <child />
                      <ns1:child />
                      <ns2:child />
                      </root>

                      In JsoML, this would become:

                      [
                      "root",
                      {
                      "xmlns:ns1": "http://www.example.com/ns1",
                      "xmlns:ns2": "http://www.example.com/ns2"
                      },
                      ["child"],
                      ["ns1:child"],
                      ["ns2:child"]
                      ]

                      A JsonML decoder can decide to deliver the element and attribute names verbatim without any special interpretation of colon (:) in JSON object member names. If the user cares about URI + local name then he or she can put/pipe the XML delivered by the JsonML decoder through an XML parser implementation that will interpret and expose those properties. That's the approach Jayrock currently takes:

                      http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/JsonML/JsonMLEncoder.cs
                      http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/JsonML/JsonMLDecoder.cs

                      - Atif


                      From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of Mark Joseph
                      Sent: Thursday, July 24, 2008 10:08 AM
                      To: json@yahoogroups.com
                      Subject: Re: [json] Re: org.json.JSONML.java


                      Sorry I am just not getting this. The prefix, in my
                      example is "P6R", but the prefix needs to be replaced by
                      its matching URI. So the "P6R:tagName" in an XML
                      processor
                      gets replaced as "URI:tagName" since the prefix is not
                      really important. So is that expansion done in JSONML?

                      Best,
                      Mark

                      On Thu, 24 Jul 2008 05:35:53 -0000
                      "Douglas Crockford" <douglas@...> wrote:
                      > --- In json@yahoogroups.com, "Mark Joseph" <mark@...>
                      >wrote:
                      >> Just so I understand your stuff resolves the XML
                      >> namespace prefix (like "P6R:tagName") to the URI
                      >> "http://www.p6r...:tagName", right? Because the URI is
                      >> the real
                      >> namespace name.
                      >
                      > It transforms <P6R:tagName> into
                      >{"tagName":"P6R:tagName"} or
                      > ["P6R:tagName"] and back.
                      >

                      -------------------------
                      Mark Joseph, Ph.D.
                      President and Secretary
                      P6R, Inc.
                      http://www.p6r.com
                      408-205-0361
                      Fax: 831-476-7490
                      Skype: markjoseph_sc
                      IM: (Yahoo) mjoseph8888
                      (AIM) mjoseph8888
                    • Mark Joseph
                      So when I read the original email about JSONML it was so that any XML document could be encoded. And sorry without namespaces that is not going to work very
                      Message 10 of 18 , Jul 25, 2008
                      • 0 Attachment
                        So when I read the original email about JSONML it was so
                        that any XML document could be encoded. And sorry
                        without namespaces that is not going to work very well.
                        Any XML tool, and we build several, that does not support
                        namespaces these days is not going to be used by anyone
                        doing serious work. So I suggest that the JSON group does
                        not ignore namespaces but figures out how to deal with
                        them,

                        Best,
                        Mark
                        P6R, Inc


                        On Thu, 24 Jul 2008 23:22:28 +0200
                        Atif Aziz <atif.aziz@...> wrote:
                        > Like XML 1.0, JsonML does not need to care about
                        >namespaces. In XML 1.0, a colon (:) is a perfectly valid
                        >character in the element name. XML namespaces is nothing
                        >more than a standardized convention and interpretation of
                        >element and attributes names. Some XML parsers allow you
                        >to turn namespace handling on or off. Likewise, a JsonML
                        >encoder can look at XML without any regard for namespaces
                        >though the story could vary for a decoder. Here's an
                        >example. Suppose the following XML:
                        >
                        > <root xmlns:ns1="http://www.example.com/ns1"
                        > xmlns:ns2="http://www.example.com/ns2">
                        > <child />
                        > <ns1:child />
                        > <ns2:child />
                        > </root>
                        >
                        > In JsoML, this would become:
                        >
                        > [
                        > "root",
                        > {
                        > "xmlns:ns1": "http://www.example.com/ns1",
                        > "xmlns:ns2": "http://www.example.com/ns2"
                        > },
                        > ["child"],
                        > ["ns1:child"],
                        > ["ns2:child"]
                        > ]
                        >
                        > A JsonML decoder can decide to deliver the element and
                        >attribute names verbatim without any special
                        >interpretation of colon (:) in JSON object member names.
                        >If the user cares about URI + local name then he or she
                        >can put/pipe the XML delivered by the JsonML decoder
                        >through an XML parser implementation that will interpret
                        >and expose those properties. That's the approach Jayrock
                        >currently takes:
                        >
                        > http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/JsonML/JsonMLEncoder.cs
                        > http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/JsonML/JsonMLDecoder.cs
                        >
                        > - Atif
                        >
                        >
                        >From: json@yahoogroups.com [mailto:json@yahoogroups.com]
                        >On Behalf Of Mark Joseph
                        > Sent: Thursday, July 24, 2008 10:08 AM
                        > To: json@yahoogroups.com
                        > Subject: Re: [json] Re: org.json.JSONML.java
                        >
                        >
                        > Sorry I am just not getting this. The prefix, in my
                        > example is "P6R", but the prefix needs to be replaced by
                        > its matching URI. So the "P6R:tagName" in an XML
                        > processor
                        > gets replaced as "URI:tagName" since the prefix is not
                        > really important. So is that expansion done in JSONML?
                        >
                        > Best,
                        > Mark
                        >
                        > On Thu, 24 Jul 2008 05:35:53 -0000
                        > "Douglas Crockford" <douglas@...> wrote:
                        >> --- In json@yahoogroups.com, "Mark Joseph" <mark@...>
                        >>wrote:
                        >>> Just so I understand your stuff resolves the XML
                        >>> namespace prefix (like "P6R:tagName") to the URI
                        >>> "http://www.p6r...:tagName", right? Because the URI is
                        >>> the real
                        >>> namespace name.
                        >>
                        >> It transforms <P6R:tagName> into
                        >>{"tagName":"P6R:tagName"} or
                        >> ["P6R:tagName"] and back.
                        >>
                        >
                        > -------------------------
                        > Mark Joseph, Ph.D.
                        > President and Secretary
                        > P6R, Inc.
                        > http://www.p6r.com
                        > 408-205-0361
                        >Fax: 831-476-7490
                        > Skype: markjoseph_sc
                        > IM: (Yahoo) mjoseph8888
                        > (AIM) mjoseph8888
                        >

                        -------------------------
                        Mark Joseph, Ph.D.
                        President and Secretary
                        P6R, Inc.
                        http://www.p6r.com
                        408-205-0361
                        Fax: 831-476-7490
                        Skype: markjoseph_sc
                        IM: (Yahoo) mjoseph8888
                        (AIM) mjoseph8888
                      • Stephen M. McKamey
                        I definitely agree. XML w/o namespaces is virtually useless these days. There is nothing about the format of JsonML that inhibits namespaces. Implementations
                        Message 11 of 18 , Jul 25, 2008
                        • 0 Attachment
                          I definitely agree. XML w/o namespaces is virtually useless these
                          days.

                          There is nothing about the format of JsonML that inhibits
                          namespaces. Implementations either need to support some storage of
                          the prefix/namespace aliasing (as Atif is showing) or be able to
                          resolve the namespaces and use the fully qualified node names (as
                          Mark is asking for). It seems that both are valid, just as they are
                          in XML.

                          Ignoring or dropping namespaces is not a good idea.

                          --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                          >
                          > So when I read the original email about JSONML it was so
                          > that any XML document could be encoded. And sorry
                          > without namespaces that is not going to work very well.
                          > Any XML tool, and we build several, that does not support
                          > namespaces these days is not going to be used by anyone
                          > doing serious work. So I suggest that the JSON group does
                          > not ignore namespaces but figures out how to deal with
                          > them,
                          >
                          > Best,
                          > Mark
                          > P6R, Inc
                          >
                          >
                          > On Thu, 24 Jul 2008 23:22:28 +0200
                          > Atif Aziz <atif.aziz@...> wrote:
                          > > Like XML 1.0, JsonML does not need to care about
                          > >namespaces. In XML 1.0, a colon (:) is a perfectly valid
                          > >character in the element name. XML namespaces is nothing
                          > >more than a standardized convention and interpretation of
                          > >element and attributes names. Some XML parsers allow you
                          > >to turn namespace handling on or off. Likewise, a JsonML
                          > >encoder can look at XML without any regard for namespaces
                          > >though the story could vary for a decoder. Here's an
                          > >example. Suppose the following XML:
                          > >
                          > > <root xmlns:ns1="http://www.example.com/ns1"
                          > > xmlns:ns2="http://www.example.com/ns2">
                          > > <child />
                          > > <ns1:child />
                          > > <ns2:child />
                          > > </root>
                          > >
                          > > In JsoML, this would become:
                          > >
                          > > [
                          > > "root",
                          > > {
                          > > "xmlns:ns1": "http://www.example.com/ns1",
                          > > "xmlns:ns2": "http://www.example.com/ns2"
                          > > },
                          > > ["child"],
                          > > ["ns1:child"],
                          > > ["ns2:child"]
                          > > ]
                          > >
                          > > A JsonML decoder can decide to deliver the element and
                          > >attribute names verbatim without any special
                          > >interpretation of colon (:) in JSON object member names.
                          > >If the user cares about URI + local name then he or she
                          > >can put/pipe the XML delivered by the JsonML decoder
                          > >through an XML parser implementation that will interpret
                          > >and expose those properties. That's the approach Jayrock
                          > >currently takes:
                          > >
                          > >
                          http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/Jso
                          nML/JsonMLEncoder.cs
                          > >
                          http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/Jso
                          nML/JsonMLDecoder.cs
                          > >
                          > > - Atif
                          > >
                          > >
                          > >From: json@yahoogroups.com [mailto:json@yahoogroups.com]
                          > >On Behalf Of Mark Joseph
                          > > Sent: Thursday, July 24, 2008 10:08 AM
                          > > To: json@yahoogroups.com
                          > > Subject: Re: [json] Re: org.json.JSONML.java
                          > >
                          > >
                          > > Sorry I am just not getting this. The prefix, in my
                          > > example is "P6R", but the prefix needs to be replaced by
                          > > its matching URI. So the "P6R:tagName" in an XML
                          > > processor
                          > > gets replaced as "URI:tagName" since the prefix is not
                          > > really important. So is that expansion done in JSONML?
                          > >
                          > > Best,
                          > > Mark
                          > >
                          > > On Thu, 24 Jul 2008 05:35:53 -0000
                          > > "Douglas Crockford" <douglas@...> wrote:
                          > >> --- In json@yahoogroups.com, "Mark Joseph" <mark@>
                          > >>wrote:
                          > >>> Just so I understand your stuff resolves the XML
                          > >>> namespace prefix (like "P6R:tagName") to the URI
                          > >>> "http://www.p6r...:tagName", right? Because the URI is
                          > >>> the real
                          > >>> namespace name.
                          > >>
                          > >> It transforms <P6R:tagName> into
                          > >>{"tagName":"P6R:tagName"} or
                          > >> ["P6R:tagName"] and back.
                          > >>
                          > >
                          > > -------------------------
                          > > Mark Joseph, Ph.D.
                          > > President and Secretary
                          > > P6R, Inc.
                          > > http://www.p6r.com
                          > > 408-205-0361
                          > >Fax: 831-476-7490
                          > > Skype: markjoseph_sc
                          > > IM: (Yahoo) mjoseph8888
                          > > (AIM) mjoseph8888
                          > >
                          >
                          > -------------------------
                          > Mark Joseph, Ph.D.
                          > President and Secretary
                          > P6R, Inc.
                          > http://www.p6r.com
                          > 408-205-0361
                          > Fax: 831-476-7490
                          > Skype: markjoseph_sc
                          > IM: (Yahoo) mjoseph8888
                          > (AIM) mjoseph8888
                          >
                        • Tatu Saloranta
                          ... Me three. Most recent xml parsers have started dropping support for non-namespace documents, too, essentially considering XML Namespaces to be integral
                          Message 12 of 18 , Jul 25, 2008
                          • 0 Attachment
                            On Fri, Jul 25, 2008 at 10:19 AM, Stephen M. McKamey <jsonml@...> wrote:
                            > I definitely agree. XML w/o namespaces is virtually useless these
                            > days.
                            >

                            Me three. Most recent xml parsers have started dropping support for
                            non-namespace documents, too, essentially considering XML Namespaces
                            to be integral part of core xml processing.

                            Of course, I really hope that the current craze of trying to use json
                            via xml tools will die soon and we will have good "native" json
                            processing systems above parser/generator level; but until then
                            conversions should be done properly.

                            -+ Tatu +-
                          • Atif Aziz
                            ... An encoder can quite dumbly format an XML document into JsonML without explicitly dealing with namespaces (provided that the XML API provides access to
                            Message 13 of 18 , Jul 25, 2008
                            • 0 Attachment
                              > XML w/o namespaces is virtually useless these days.
                              > Ignoring or dropping namespaces is not a good idea.

                              Definitely. I wasn't trying to question the merits of namespaces. My point was pretty much what you stated more clearly here:

                              > There is nothing about the format of JsonML that inhibits
                              > namespaces.

                              An encoder can quite "dumbly" format an XML document into JsonML without explicitly dealing with namespaces (provided that the XML API provides access to the QName and does not hide so-designated namespace declarations when you enumerate over attributes) and no information would be lost. In this sense, the encoder is acting like a pass-through and simply mapping XML nodes into JSON values as per JsonML transformation rules. All that would matter is that the input XML is well-formed though not necessarily valid. This should answer the question raised earlier, "So is that expansion done in JSONML?" The expansion is not and does not need to be done in the encoded JsonML.

                              A decoder implementation, on the other hand, has two API choices. Either it can directly support the abstractions introduced by XML namespaces via its API or it can delegate that work to a downstream and existing XML API. It's a detail of the implementation rather than the format.


                              From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of Stephen M. McKamey
                              Sent: Friday, July 25, 2008 7:20 PM
                              To: json@yahoogroups.com
                              Subject: [json] Re: org.json.JSONML.java

                              I definitely agree. XML w/o namespaces is virtually useless these
                              days.

                              There is nothing about the format of JsonML that inhibits
                              namespaces. Implementations either need to support some storage of
                              the prefix/namespace aliasing (as Atif is showing) or be able to
                              resolve the namespaces and use the fully qualified node names (as
                              Mark is asking for). It seems that both are valid, just as they are
                              in XML.

                              Ignoring or dropping namespaces is not a good idea.

                              --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                              >
                              > So when I read the original email about JSONML it was so
                              > that any XML document could be encoded. And sorry
                              > without namespaces that is not going to work very well.
                              > Any XML tool, and we build several, that does not support
                              > namespaces these days is not going to be used by anyone
                              > doing serious work. So I suggest that the JSON group does
                              > not ignore namespaces but figures out how to deal with
                              > them,
                              >
                              > Best,
                              > Mark
                              > P6R, Inc
                              >
                              >
                              > On Thu, 24 Jul 2008 23:22:28 +0200
                              > Atif Aziz <atif.aziz@...> wrote:
                              > > Like XML 1.0, JsonML does not need to care about
                              > >namespaces. In XML 1.0, a colon (:) is a perfectly valid
                              > >character in the element name. XML namespaces is nothing
                              > >more than a standardized convention and interpretation of
                              > >element and attributes names. Some XML parsers allow you
                              > >to turn namespace handling on or off. Likewise, a JsonML
                              > >encoder can look at XML without any regard for namespaces
                              > >though the story could vary for a decoder. Here's an
                              > >example. Suppose the following XML:
                              > >
                              > > <root xmlns:ns1="http://www.example.com/ns1"
                              > > xmlns:ns2="http://www.example.com/ns2">
                              > > <child />
                              > > <ns1:child />
                              > > <ns2:child />
                              > > </root>
                              > >
                              > > In JsoML, this would become:
                              > >
                              > > [
                              > > "root",
                              > > {
                              > > "xmlns:ns1": "http://www.example.com/ns1",
                              > > "xmlns:ns2": "http://www.example.com/ns2"
                              > > },
                              > > ["child"],
                              > > ["ns1:child"],
                              > > ["ns2:child"]
                              > > ]
                              > >
                              > > A JsonML decoder can decide to deliver the element and
                              > >attribute names verbatim without any special
                              > >interpretation of colon (:) in JSON object member names.
                              > >If the user cares about URI + local name then he or she
                              > >can put/pipe the XML delivered by the JsonML decoder
                              > >through an XML parser implementation that will interpret
                              > >and expose those properties. That's the approach Jayrock
                              > >currently takes:
                              > >
                              > >
                              http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/Jso
                              nML/JsonMLEncoder.cs
                              > >
                              http://svn.berlios.de/svnroot/repos/jayrock/trunk/src/Jayrock.Json/Jso
                              nML/JsonMLDecoder.cs
                              > >
                              > > - Atif
                              > >
                              > >
                              > >From: json@yahoogroups.com [mailto:json@yahoogroups.com]
                              > >On Behalf Of Mark Joseph
                              > > Sent: Thursday, July 24, 2008 10:08 AM
                              > > To: json@yahoogroups.com
                              > > Subject: Re: [json] Re: org.json.JSONML.java
                              > >
                              > >
                              > > Sorry I am just not getting this. The prefix, in my
                              > > example is "P6R", but the prefix needs to be replaced by
                              > > its matching URI. So the "P6R:tagName" in an XML
                              > > processor
                              > > gets replaced as "URI:tagName" since the prefix is not
                              > > really important. So is that expansion done in JSONML?
                              > >
                              > > Best,
                              > > Mark
                              > >
                              > > On Thu, 24 Jul 2008 05:35:53 -0000
                              > > "Douglas Crockford" <douglas@...> wrote:
                              > >> --- In json@yahoogroups.com, "Mark Joseph" <mark@>
                              > >>wrote:
                              > >>> Just so I understand your stuff resolves the XML
                              > >>> namespace prefix (like "P6R:tagName") to the URI
                              > >>> "http://www.p6r...:tagName", right? Because the URI is
                              > >>> the real
                              > >>> namespace name.
                              > >>
                              > >> It transforms <P6R:tagName> into
                              > >>{"tagName":"P6R:tagName"} or
                              > >> ["P6R:tagName"] and back.
                              > >>
                              > >
                              > > -------------------------
                              > > Mark Joseph, Ph.D.
                              > > President and Secretary
                              > > P6R, Inc.
                              > > http://www.p6r.com
                              > > 408-205-0361
                              > >Fax: 831-476-7490
                              > > Skype: markjoseph_sc
                              > > IM: (Yahoo) mjoseph8888
                              > > (AIM) mjoseph8888
                              > >
                              >
                              > -------------------------
                              > Mark Joseph, Ph.D.
                              > President and Secretary
                              > P6R, Inc.
                              > http://www.p6r.com
                              > 408-205-0361
                              > Fax: 831-476-7490
                              > Skype: markjoseph_sc
                              > IM: (Yahoo) mjoseph8888
                              > (AIM) mjoseph8888
                              >
                            • Kyle Alan Hale
                              I d like some clarification: the tagName/childNodes syntax is the key difference between Stephen s JSONML and my alternative, JSoda
                              Message 14 of 18 , Aug 1, 2008
                              • 0 Attachment
                                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]
                              • Douglas Crockford
                                ... 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
                                Message 15 of 18 , Aug 1, 2008
                                • 0 Attachment
                                  --- 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.
                                • 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 16 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 17 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 18 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.