[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: {mark} - a new simple notation that unifies JSON and XML

  • From: John Cowan <johnwcowan@gmail.com>
  • To: Henry Luo <henry@perpetuatech.net>
  • Date: Thu, 25 Jan 2018 12:18:52 -0500

Re:  {mark} - a new simple notation that unifies JSON and XML
I agree with Eliot that without a proper representation of mixed content no new format can  subsume XML.  I would urge you to look at FtanML by Michael Kay and friends at <https://www.balisage.net/Proceedings/vol10/html/Kay01/BalisageVol10-Kay01.html> for something that truly does subsume both JSON and XML; though it is not 100% syntactically compatible with either, its syntax is easy to learn.  In addition, it comes with its own powerful schema and transformation languages.  Here's the famous purchase order example, with mixed content enclosed in |...| (it is also valid to use «...» instead, which is harder to type but makes nested mixed content easier to see):

<purchaseOrder 
   orderDate="1999-10-20" 
   shipTo = <country="US" [
      <name "Alice Smith">
      <street "123 Maple Street">
      <city "Mill Valley">
      <state "CA">
      <zip 90952>
   ]>
   billTo = <country="US" [
      <name "Robert Smith">
      <street "8 Oak Avenue">
      <city "Old Town">
      <state "PA">
      <zip 95819>
   ]>
   comment = |<emph |Hurry|>, my lawn is going wild|
   items = [
      <  partNum="872-AA"
         productName="Lawnmower"
         quantity=1
         USPrice=148.95
         comment=|Confirm this is <strong |electric|>|
      >
      <  partNum="926-AA"
         productName="Baby Monitor"
         quantity=1
         USPrice=39.98
         shipDate="1999-05-21"
      >
   ]
>

And here's the corresponding schema:

 <org_ftanml_schema [
  <import "ftan_calendar.ftg">
  <types
   purchaseOrderType = 
     <element form=<purchaseOrder 
                      shipTo=<addressType>
                      billTo=<addressType>
                      comment=<nullable<text elements=<inlineType>>>
                      items=<occurs=[1,] <itemType>>
     >
   addressType = 
     <element form=<  country=<eq="US">
                      <seq [ <element form=<name <string>>>,
                             <element form=<street <string>>>,
                             <element form=<city <string>>>,
                             <element form=<state <string>>>,
                             <element form=<zip <number>>>]>
     >
   itemType =
     <element form=<  partNum=<SKUType>
                      productName=<string>
                      quantity=<number ge=1 lt=100 step=1>
                      USPrice=<number ge=0 step=0.01>
                      comment=<nullable<text elements=<inlineType>>>
                      shipDate=<nullable<org_ftanml_calendar_dateType>>
                   >
     >
   inlineType = 
     <element elemName=<enum=["ital", "bold"]> 
              form=<<inlineType>>
     > 
   SKUType = <string pattern="\[#\d{3}-[A-Z]{2}#]">  
  >   
]>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.