Java XML and JSON

Document Processing for Java SE

About this book

Use this guide to master the XML metalanguage and JSON data format along with significant Java APIs for parsing and creating XML and JSON documents from the Java language. New in this edition is coverage of Jackson (a JSON processor for Java) and Oracle’s own Java API for JSON processing (JSON-P), which is a JSON processing API for Java EE that also can be used with Java SE. This new edition of Java XML and JSON also expands coverage of DOM and XSLT to include additional API content and useful examples.All examples in this book have been tested under Java 11. In some cases, source code has been simplified to use Java 11’s var language feature. The first six chapters focus on XML along with the SAX, DOM, StAX, XPath, and XSLT APIs. The remaining six chapters focus on JSON along with the mJson, GSON, JsonPath, Jackson, and JSON-P APIs. Each chapter ends with select exercises designed to challenge your grasp of the chapter's content. An appendix provides the answers to these exercises.

Who This Book Is ForIntermediate and advanced Java programmers who are developing applications that must access data stored in XML or JSON documents. The book also targets developers wanting to understand the XML language and JSON data format.

Advertisement

Table of Contents

Frontmatter

Exploring XML

Frontmatter

Applications commonly use XML documents to store and exchange data. XML defines rules for encoding documents in a format that is both human-readable and machine-readable. Chapter 1 introduces XML, tours the XML language features, and discusses well-formed and valid documents.

Exploring JSON

Frontmatter

Many applications communicate by exchanging JSON objects instead of XML documents. Chapter 7 introduces JSON, tours its syntax, demonstrates JSON in a JavaScript context, and shows how to validate JSON objects in the context of JSON Schema.