Chapter 16. XML and Java
In this chapter, you examine how XML and Java work together. In some ways XML and Java are excellent bedfellows; they're both children of the 1990s and fit in well with modern concepts of Internet and Web-based application architectures, and they both have a solid foundation in Unicode. When it comes to the details, however, there's sometimes a mismatch: For example, the mapping from XML Schema data types to classes in the Java class library is less than perfect.
Java and XML can interact in many different ways. This chapter takes a bottom-up approach, starting with the lowest-level interfaces and working steadily upward. The most important interfaces are covered in detail elsewhere in this book, so this chapter gives more of an overview: a comparative study of the different interfaces, explaining their capabilities and their strengths and weaknesses. Its goal is to enable you to choose the right interface for the job at hand without necessarily providing a detailed reference for each class and method.
At the lowest level, Java applications can read and write lexical XML, that is, XML represented in character form with angle-bracket markup. Reading lexical XML is called parsing; writing lexical XML is called serialization (although that term is overloaded, unfortunately). The first section of the chapter discusses how a Java application can interact with a parser and a serializer.
The next level up is the construction of tree-based representations of XML documents ...
Get Professional XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.