PSVI

json+psvi

element = {“element” : [ [{PSVI}, attributes…] , content…]}
attributes… = [ {attribute:[{PSVI},value]},…]

{“!–“:”comment“}
{“?PITarget“:”Processing Instruction“}
{“![CDATA[“:”Character Data“}
{“!DOCTYPE”:[{“Name”:”Name”,“ExternalID”:”ExternalID“,”intSubset”:”intSubset“}

This describes a generic approach to representing XML in JSON.
The benefit of this approach is that the document order of content is preserved,
with attributes always in the first position of each elements content array.
This is important for document models.
This also preserves the document order of attributes,
which makes it easier to compare documents.

This approach builds upon json+xml,
by introducing json+metadata for attributes in addition to elements.
Attributes are metadata about the element & its content.
PSVI information is metadata about each element or attribute.

Elements and their attributes are represented thus
{ “element-name” : [ [{element-PSVI}, {attribute:[{attribute-PSVI},value]},…], content …] }

An empty element with no attributes is :
{ “element-name” : [ [{element-PSVI}] ] }

An element which contains an empty text node is thus:
{ “element-name” : [ [{element-PSVI}], “” ] }

The remainder is as for json+xml.