XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] How to represent mixed content in JSON and JSONSchema?

On Thu, 2018-07-12 at 18:23 +0800, Henry Luo wrote:
> JSON does not have a standard way of representing mixed content.
> Different applications come up with different conventions to encode
> that.

Yes. We saw this also back in Perl days, with some XML libraries using
a mix of an array for contents and a hash for attributes, and some
doing different things depending on whether there were multiple
elements with the same name and/or mixed content. XML::Twig is an
example that can be soewhat configured.

> 
> If you don't mind go beyond JSON syntax, I've invented a new
> notation 
> Mark (http://marknotation.org/),
> which can easily represent both JSON, and XML/HTML data.
> And each XML/HTML element is represented with just 1 JS object.

If you're going to do extend JSON, why not allow
  {
    sku: "123456789",
    name: "argyle socks",
    item.fabric: "organic fair-traded happily-grown thistle",
    item.colour: "orange",
    <description><p>hese organic socks really pop,
      with their <bold>super-bright</bold> orange and
      blue stripes and their sharp thistle spikes.</p>
      <p>Commonly sold with our <itemref
sku="83728372">SockLock</itemref> patented technology.</p>     
    </description>
  }

Liam


-- 
Liam Quin - W3C
web slave for https://www.fromoldbooks.org/ with fabulous vintage
art and fascinating texts to read.
Click here to have the slave tickled.


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS