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]
Fwd: [xml-dev] Best options for converting JSON to XML

---------- Forwarded message ----------
From: Dimitre Novatchev <dnovatchev@gmail.com>
Date: Sun, Nov 10, 2013 at 9:02 AM
Subject: Re: [xml-dev] Best options for converting JSON to XML
To: David Lee <dlee@calldei.com>


On Sun, Nov 10, 2013 at 6:59 AM, David Lee <dlee@calldei.com> wrote:
> Thus the robust and simple way to solve this is to use an XML structure like (or some variation of)
>
> { "a json name" : 1 }                ->
>
> <object>
>     <member name="a json name">< value type="Number">123</value></<member>
> </object>
>
> This is very reliable but by its very nature is *always going to be schema valid* !!!
> ( atleast with XSD or RNG ... schematron might be able to do something with this)
> Because the structure itself was designed to be schema valid no matter what JSON you throw at it.
> All you are validating is the output XML structure, not the JSON data.
> You could make up a new schema  but common schema vocabularies cant do much useful with the above,
> e.g. you cant easily indicate
>
> "For every member element with an attribute named 'name' with a value "a json name" it must have a single child
> element "value" with a "type" attribute  with the value "Number" and its text contents must follow the constraints of xs:decimal
>
> This is difficult or impossible to express in common XML schema languages
> (I think you could do it in schematron though ... painfully,  maybe WC3 schema 1.1 with assertions ?)

    not(member[@name='a json name']
        [value[2]
       or
        @type ne 'Number'
       or
        not(value castable as xs:decimal)
        ]
       )

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.


[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