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

534Re: [json] A heavy-weight alternative to JSON : JSONML (a standard for fun)

Expand Messages
  • Justin Day
    Oct 11, 2006
    • 0 Attachment
      ---------- Forwarded message ----------
      From: Mert Sakarya <mertsakarya@...>
      Date: Oct 11, 2006 3:34 PM
      Subject: [json] A heavy-weight alternative to JSON : JSONML (a standard for
      fun)
      To: json@yahoogroups.com

      Today, I thought of an XML representation for JSON and I came up with
      something like;

      //Sample JSONML xml file
      <?xml version="1.0" encoding="UTF-8"?>
      <Object xmlns=http://jsonml.org/1.0 xmlns:xsi="
      http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://jsonml.org/1.0
      JSONML.xsd">
      <Property Name="SimpleProperty">Any Text Here</Property>
      <Property Name="EmptyProperty"/>
      <Property Name="ObjectProperty">
      <Object>
      <Property Name="AnotherObjectProperty">value</Property>
      </Object>
      </Property>
      <Property Name="ArrayProperty">
      <Array>
      <Item>A text Item</Item>
      <Item>
      <Array>
      <Item>Jagged Array Item</Item>
      </Array>
      </Item>
      <Item>
      <Object>
      <Property Name="Property">An object in an array.</Property>
      </Object>
      </Item>
      </Array>
      </Property>
      <Property Name="Property1">Any Text Here</Property>
      </Object>

      //The xsd schema definition for JSONML (JSONML.xsd)
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="
      http://jsonml.org/1.0"
      targetNamespace=http://jsonml.org/1.0elementFormDefault="qualified">
      <xs:element name="Object" type="BaseObjectType"/>
      <xs:element name="Property" type="BasePropertyType" />
      <xs:element name="Array" type="BaseArrayType"/>
      <xs:element name="Item" type="BasePropertyType"/>

      <xs:complexType name="BaseArrayType">
      <xs:sequence>
      <xs:element ref="Item" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      </xs:complexType>
      <xs:complexType name="BasePropertyType" mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="Object"/>
      <xs:element ref="Array"/>
      </xs:choice>
      </xs:complexType>
      <xs:complexType name="BaseObjectType">
      <xs:sequence>
      <xs:element ref="Property" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="Name" use="optional"/>
      </xs:complexType>
      </xs:schema>

      I hope, the indentation and fonts are displayed well on this message,
      because it took five (or more) minutes to format this message on Hotmail. I
      just realized that, I could type this message on some editor and paste
      later. Duh!

      Regards,
      Mert
      __________________________________________________________
      Share your special moments by uploading 500 photos per month to Windows Live
      Spaces
      http://clk.atdmt.com/MSN/go/msnnkwsp0100000001msn/direct/01/?href=http://spaces.live.com/signup.aspx

      [Non-text portions of this message have been removed]




      [Non-text portions of this message have been removed]
    • Show all 3 messages in this topic