|
XML |
JSON |
|
You need message validation |
You don't need Messages to be validated |
|
XML transfer is slower then
JSON since the file size is relatively compared to JSON. |
JSON is a good if you want to transmit data faster
from client to server, due to reduced file size |
|
You need to transform the XML i.e.
if using XSLT |
You're not transforming messages, or transforming
their de serialization is simple |
|
Your messages include a lot of marked-up text |
Your messages are mostly data, not marked-up text |
|
You need to interoperate with environments that
don't support JSON |
The messaging endpoints have good JSON tools |
|
Used when objective is to carry or store data |
Used when objective is to display the Data |
|
When there is no concern for reduced file/transfer
size. |
When there is a requirement for reduced
file/transfer size. |
|
Processing is slower since XML has
to be parsed with XML parser. |
Processing is faster since JSON can be parsed by a
standard JavaScript function. |
When to use Xml and when to use JSON
Difference between XML and JSON
|
XML |
JSON |
|
XML
is more verbose than JSON |
JSON is less
verbose than XML |
|
XML is tree based |
JSON’s data structure is a map |
|
Xml was designed to carry or store data. |
JSON was designed to carry and display data. |
|
Xml is based on SGML |
JSON is text based following Java Script Object Notation. |
|
Xml supports namespace |
JSON doesn’t support any namespace |
|
Xml supports comments |
JSON doesn’t supports comments. |
|
Xml supports Start and End Tags |
JSON doesn’t support End tags |
|
Xml doesn’t support array |
JSON supports array |
|
XML has to be parsed with XML parser. |
JSON can be parsed
by a standard JavaScript function. |
|
Parsing process - Fetch an XML
document Use the XML DOM to
loop through the document Extract values and
store in variables |
Parsing process - Fetch a JSON
string Parse the JSON
string |
|
Xml parsing is slower since DOM parsing is slower. |
JSON Parsing is faster since its based on format of Javascript
object. |
|
Xml message validation is supported using XML schemas |
JSON validation is supported using JSON Schema, but it is not
comprehensive compared to XSD |
|
Xml can be easily transformed using XSLT |
No Transformation is available. |
Difference between include and import elements in XML Schema - XSD with Example
In this post I will explore the difference between them and when to use what with simple examples and how we can use the same in BizTalk Server.
Include element - include refers to declarations or definitions that are from same namespace or a no target namespace.
XML Design Consideration – What Should be used XML Elements or Attributes - BizTalk Schema Design Consideration
How to get the root node name of an xml document /node name of any xml element using XPath name() function in Expression Shape BizTalk Server with Examples
Input XML
|
<OrderId>
<OrderRecord>
<Place>ALT</Place>
<Date>21-Aug-2011</Date>
</OrderRecord>
<OrderNo>123</OrderNo>
</OrderId>
|
i) name(/*)
Result: OrderId
|
ii) name(/*/*)
Result: OrderRecord
|
iii) name(/*/*[2])
Result: OrderId
|