XML technology can be used to represent structured information. This pattern helps determine when XML is an appropriate solution.
When data in a system needs to be imported or exported, it needs some type of representation. There are many possible representations for example: Comma Separated Values, Java Object Serialization, Proprietary Binary Formats, HTML, CORBA IIOP Streams, RDBMS tables, and of course XML. Choosing the proper representation for the data can be difficult.
XML can be an appropriate choice when one or more of the following is needed:
- Content needs to be separate from its formatting.
- Data is shared between computers, applications or organizations.
- Human readable representation is needed.
- Readily available tools and resources.
There are some situations where XML may not be a good choice, among them is systems where:
- Terseness is important.
- In a homogeneous environment.
There are many forces to take into account when considering a data representation. Among the ones that XML can provide are simplicity, openness, extensibility, interoperability, and a technology with proven use.
Use XML for data representations.
It is impossible to have a complete discussion of the factors involved in make the decision of a data representation in the space of a single pattern, but it can try to provide some pointers.
All other patterns in this language depend on first using this pattern, because they assume that XML is being used.
There are many places where XML is being used successfully. Here is a small sampling of them.
- Data syndication. XML has been popular in this area, and several XML languages have been developed for this purpose.
- Data exchange protocols for transport of messages from one system to another across a network.
- Configuration files
- Test Scripting
- Log files
The LOGML specification is designed to describe log reports of web servers
- Web content management
Wireless Application Data (WAP)
For more information:
Simon St. Laurent's Essay -
Why XML? .
A whitepaper by Bob Schloss
Ten best bets for XML applications