Skip navigation

Choosing XML for the Right Reasons

XML is an extremely useful and exciting new technology for IT professionals. It's often a good solution for difficult data problems, and it's a great way to organize data in a document that you can then move to any format on any platform. But in some cases, XML isn't the best solution.

Because of the increased hype about XML, programmers often fall into the trap of thinking that they need to use XML for everything in their programs. You need to analyze your decision to use XML data, just as you analyze other parts of your applications to determine, for example, which patterns or algorithms to use. This decision isn't easy to make.

In general, XML is the right choice when you need to

  • Share enterprise data. Using XML is a great way to share data because it eliminates application dependencies.
  • Transfer transient data. XML is easy to transfer across the Internet.
  • Collect and work with meta data. If you're cataloging Web content, for example, XML enables easier Web searches.
  • Conduct client-side rendering of Web pages with Extensible Style Language (XSL). This approach can relieve some of the burden from your Web server.

In general, XML is NOT the best choice for

  • Updating, storing, and retrieving large amounts of data on disk. These tasks best suit a relational database management system (RDBMS).
  • Working with internal data structures that aren't exposed to outside applications. Iterating through XML is much slower than iterating through an ADO Recordset object, and the ADO Recordset object has a slightly easier programming model than the XML Document Object Model (XMLDOM).
  • Use as an argument in a method call. XML isn't always a bad choice in this case. The main drawback is that you need to instantiate an object (XMLDOM) inside the method to access the XML fields and records. You might find it simpler to pass in a multidimensional array, ADO Recordset object (which is self-marshalling), a string, or even a user data type (UDT) or structure (in C programming).

Overall, I'm a big advocate of using XML because it can make your applications more robust and interactive with other applications without the need to rewrite code. But don't rely on XML for every data-transfer task. You still need to design your applications carefully and do prototyping before you try to use XML everywhere.

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish