Quick Summary of Manipulating XML Data with Java - dummies

Quick Summary of Manipulating XML Data with Java

By John Paul Mueller

You can use Java to read, write, and manipulate XML data as part of your application strategy. Read XML from disk to create data displays onscreen, or write XML to disk to save data in an organized manner without loss of context.

Here are the key points you need to remember about XML Data:

  • Reading an XML file from disk provides data to your application.

  • Your application must parse an XML file in order to convert it from text to an actual document.

  • The process for creating an XML document begins with a factory that creates an XML document builder, which is used to build the XML document.

  • To create an XML document, you must build it out of component objects such as Element and Text.

  • Each node in an XML document is appended to its parent, including element values, which are actually Text objects.

  • Saving an XML document as XML data means transforming it and then sending it to a file on disk.

Know this tech talk about XML data when working in Java:

  • element: A major division of data within an XML document. It consists of a start tag, an end tag, and everything between. An element commonly contains attributes, other elements, and a single value. However, an element can contain a wealth of other data types.

  • eXtensible Markup Language (XML): A markup language specifically designed to make it easy to transfer data between applications and disparate computer platforms. Even though XML relies on text as an underlying storage technology, it actually conveys considerable information about the context and properties of the data it transports.

  • node: Any discrete object within an XML document.

  • parse: The act of reading information from a source, interpreting it, and creating a new object from it as output. Parsing is one way to convert information from one type to another. In many cases, parsers read data in text format and create an intelligent object from it that can use the textual information in unique ways.

  • recursion: A programming technique where a method calls itself to break a complex task down into simpler pieces. The result of the simple task is then used to make completing the complex task possible. A recursive method must always include some means of escape so that the routine will exit once the task is simple enough.

  • value: The single text value between the start tag and end tag of an element that defines the content of that element. For example, when looking at <Name>Sally</Name>, the value is Sally.