Home arrow Java & J2EE arrow Integrating XML with J2EE

Integrating XML with J2EE

In this article, Martin Bond discusses XML and its associated APIs and standards, and how XML can be used to create flexible structured data that is inherently portable. This excerpt is from chapter (Day) 16 of Teach Yourself J2EE in 21 Days, second edition, by Martin Bond, et. al. (Sams, ISBN: 0672325586)

  1. Integrating XML with J2EE
  2. Benefits and Characteristics of XML
  3. Structure and Syntax of XML
  4. Structure of an XML Document
  5. Well-formed XML Documents
  6. Namespaces
  7. Element Type Declarations
  8. XML Schemas
  9. Parsing XML
  10. Parsing XML Using SAX
  11. Document Object Model (DOM) Parser
  12. Modifying a DOM Tree
  13. Java Architecture for XML Binding
  14. Summary
By: Sams Publishing
Rating: starstarstarstarstar / 23
November 16, 2004

print this article



bondToday, we take a bit of a departure from J2EE and its emphasis on programming elements to look at what is fast becoming the lingua franca of the Internet—the Extensible Markup Language (XML).

Throughout the book so far, you have seen many ways in which XML is used within J2EE applications to describe the structure and layout of the application. Today and tomorrow, you will study XML and its associated APIs and standards to gain a fuller understanding of how XML can be used to exchange data between different components in your applications.

Today, you will learn about

  • How XML has evolved from the need for platform-independent data exchange

  • The relationship between XML and both Standard Generalized Markup Language (SGML) and Hypertext Markup Language (HTML)

  • How to create well-formed and valid XML documents

  • The Java API for XML Processing (JAXP)

  • How to process XML documents with the Simple API for XML (SAX) and the Document Object Model (DOM)

  • How XML is used in the J2EE platform

This book is about J2EE, of which XML is just a component. To learn more about XML, take a look at Sams Teach Yourself XML in 21 Days, which covers everything you need to know about XML and related standards.

The Drive to Platform-Independent Data Exchange

Applications essentially consist of two parts—functionality described by the code and the data that is manipulated by the code. The in-memory storage and management of data is a key part of any programming language and environment. Within a single application, the programmer is free to decide how the data is stored and represented. Problems only start when the application must exchange data with another application.

One solution is to use an intermediary storage medium, such as a database, and standard tools, such as SQL and JDBC, to gain access to the data in such databases.

But what if the data is to be exchanged directly between two applications, or the applications cannot access the same database? In this case, the data must be encoded in some particular format as it is produced, so that its structure and contents can be understood when it is consumed. This has often resulted in the creation of application-specific data formats, such as binary data files (.dat files) or text-based configuration files (.ini, .rc, .conf, and so on), in which applications store their information.

Similarly, when exchanging information between applications, purpose-specific formats have arisen to address particular needs. Again, these formats can be text-based, such as HTML for encoding how to display the encapsulated data, or binary, such as those used for sending remote procedure calls. In either case, there tends to be a lack of flexibility in the data representation, causing problems when versions change or when data needs to be exchanged between disparate applications, frequently from different vendors.

XML was developed to address these issues. Because XML is written in plain text, and shares similarities with HTML but uses self-describing elements, XML provides a data encoding format that is

  • Generic

  • Simple

  • Flexible

  • Extensible

  • Portable

  • Human readable

  • And perhaps most importantly, license-free

This chapter is from Teach Yourself J2EE in 21 Days, second edition, by Martin Bond et. al. (Sams, 2004, ISBN: 0-672-32558-6). Check it out at your favorite bookstore today. Buy this book now.

>>> More Java & J2EE Articles          >>> More By Sams Publishing

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates


Dev Shed Tutorial Topics: