[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
When is it appropriate/good to format data as XML?
- From: "Costello, Roger L." <costello@mitre.org>
- To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Fri, 22 Feb 2019 18:06:26 +0000
Hi Folks,
Clearly the marketplace does not believe that XML is appropriate/good for every type of data.
Consider:
- Although there is an XML format for image data (SVG), most images in use today are not formatted as XML/SVG. Most images are formatted as binary JPEG, GIF, PNG, etc. files.
Why is that?
Why is it that there is far more usage of JPEG than SVG?
Is it simply because an XML-encoding of image data is too huge? Is size the reason? Or is there more to it?
The JPEG standard was defined prior to XML. There existed JPEG parsers and tools well before there existed XML parsers and tools. Perhaps the reason that JPEG was never supplanted by XML is simply because of inertia - it would have taken too much effort and expense to replace the existing JPEG toolset?
Wikipedia says that XML "defines a set of rules for encoding documents."
Perhaps image data is not document-oriented; is that why most images are not in the XML format?
Note: I am not clear what it means for data to be (or not be) document-oriented.
XML-formatted data can be beautiful.
Binary-formatted data can also be beautiful.
Scenario: There exists data about a person's name and date of birth (DOB). The data consists of an ASCII string representing the person's name and an ISO 8601 date-time string value representing the DOB. We may wrap the text data in tags to produce XML such as this:
<Person>
<Name>John Doe</Name>
<DOB>2000-02-06T20:13:35</DOB>
</Person>
Alternatively, the data might consist of a 4-byte integer representing the person's DOB in number of seconds since Epoch and a null-terminated ASCII string representing the person's name. The name and DOB can be compactly represented in binary with this series of hex digits:
4A 6F 68 6E 20 44 6F 65 00 EF D5 9D 38
You might argue that this series of hex digits is not readable, but to a machine it can be very readable (processable).
Both formats are beautiful.
With DFDL (Data Format Description Language) we have tremendous agility in converting binary to XML and vice versa.
When is it appropriate/good to format data as XML?
When is it *not* appropriate/good to format data as XML?
/Roger
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]