Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

Understanding How XML and Java Interact

In the past, Java developers often had to use text files to transfer data between platforms, but text files suffer from a loss of context. The data is there, but what the data means is missing.

You have many different ways to store your data, but the majority of them are either unique to a particular platform or are implemented inconsistently across platforms.

The eXtensible Markup Language (XML), one of the better innovations when it comes to data storage, was developed in order to address this issue. XML provides the means to describe data in a way that none of the context or meaning is lost.

It’s important not to become overwhelmed by XML before you even get started using it. At its core, XML is simply a fancy sort of text file. So, when you read XML into your application, the underlying technology is simply reading a text file. The difference is in the way the text is interpreted. XML relies on tags — information between angle brackets (<>) — to describe the data contained within the text file.

So, on top of reading the file into the application as text, Java must also provide a means to interpret the data in order to obtain the meaning that the text contains. For example, an entry such as <Name>John</Name> could mean that the user’s name is John.

Java follows all the standards-based rules regarding XML. In addition, it implements these standards in the same way across all platforms that Java supports. Consequently, when you write an application that uses XML on your PC, the same code works in the same way on a Windows, a Macintosh, or a Linux system.

It’s this ability to move data anywhere and yet maintain the data context and meaning that makes XML such a great choice for data storage.

Even though Java often uses XML with disk-based files, XML is used in a considerable number of environments. For example, you can use XML to request information from other people or vendors using any of the methods that the other person or vendor supports (such as REpresentational State Transfer or REST for Web services).

XML is so useful that any book on Java has to at least tell you that the technology exists and that it’s relatively straightforward to use.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.