[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Costello, Roger L." <costello@m...>
  • To: "xml-dev@l..." <xml-dev@l...>
  • Date: Mon, 15 Jun 2015 16:19:14 +0000

Hi Folks,

 

Common practice in XML design is to liberally sprinkle id attributes throughout the XML. Why? Because it facilitates intra-document linking (via the id-idref mechanism) and inter-document linking.

 

The following example shows the use of an id attribute to facilitate an intra-document reference:

 

 

JSON does not have attributes. The JSON Reference specification [1] defines a syntax for intra-document and inter-document references and it does not use anything like an id attribute. The above intra-document reference is expressed like this:

 

{ "$ref": "#/Library/BookCatalogue/Book" }

 

Lesson Learned: when converting XML to JSON you can safely drop all id attributes.

 

/Roger

 

[1] http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03

 



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


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member