Skip to main content

Über dieses Buch

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.

What You'll LearnMaster the XML language
Create, validate, parse, and transform XML documents
Apply Java’s SAX, DOM, StAX, XPath, and XSLT APIs
Master the JSON format for serializing and transmitting data
Code against third-party APIs such as Jackson, mJson, Gson, JsonPath
Master Oracle’s JSON-P API in a Java SE context

Who This Book Is For
Intermediate 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.



Exploring XML


Chapter 1. Introducing XML

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.
Jeff Friesen

Chapter 2. Parsing XML Documents with SAX

Java provides several APIs for parsing XML documents. The most basic of these APIs is SAX, which is the focus of Chapter 2.
Jeff Friesen

Chapter 3. Parsing and Creating XML Documents with DOM

SAX can parse XML documents but cannot create them. In contrast, DOM can parse and create XML documents. Chapter 3 introduces you to DOM.
Jeff Friesen

Chapter 4. Parsing and Creating XML Documents with StAX

Java also includes the StAX API for parsing and creating XML documents. Chapter 4 introduces you to StAX.
Jeff Friesen

Chapter 5. Selecting Nodes with XPath

Java includes an XPath API for simplifying access to a DOM tree’s nodes. Chapter 5 introduces you to XPath.
Jeff Friesen

Chapter 6. Transforming XML Documents with XSLT

Along with SAX, DOM, StAX, and XPath, Java includes the XSLT API, for transforming XML documents. Chapter 6 introduces you to XSLT.
Jeff Friesen

Exploring JSON


Chapter 7. Introducing JSON

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.
Jeff Friesen

Chapter 8. Parsing and Creating JSON Objects with mJson

Many third-party APIs are available for parsing and creating JSON objects. Chapter 8 explores one of the simplest of these APIs: mJson.
Jeff Friesen

Chapter 9. Parsing and Creating JSON Objects with Gson

Gson is another API for parsing and creating JSON objects. Chapter 9 explores the latest version of this open-source Google product.
Jeff Friesen

Chapter 10. Extracting JSON Values with JsonPath

XPath is used to extract values from XML documents. JsonPath performs this task for JSON documents. Chapter 10 introduces you to JsonPath.
Jeff Friesen

Chapter 11. Processing JSON with Jackson

Jackson is a popular suite of APIs for parsing and creating JSON objects (and more). Chapter 11 explores the latest version of this “best JSON parser for Java.”
Jeff Friesen

Chapter 12. Processing JSON with JSON-P

JSON-P is an intriguing API because it was originally considered for inclusion in Java SE, but was made available to Java EE instead. Chapter 12 explores JSON-P.
Jeff Friesen



Appendix A. Answers to Exercises

Each of Chapters 1 through 12 closes with an “Exercises” section that tests your understanding of the chapter’s material. The answers to those exercises are presented in this appendix.
Jeff Friesen


Weitere Informationen

Premium Partner

BranchenIndex Online

Die B2B-Firmensuche für Industrie und Wirtschaft: Kostenfrei in Firmenprofilen nach Lieferanten, Herstellern, Dienstleistern und Händlern recherchieren.



Best Practices für die Mitarbeiter-Partizipation in der Produktentwicklung

Unternehmen haben das Innovationspotenzial der eigenen Mitarbeiter auch außerhalb der F&E-Abteilung erkannt. Viele Initiativen zur Partizipation scheitern in der Praxis jedoch häufig. Lesen Sie hier  - basierend auf einer qualitativ-explorativen Expertenstudie - mehr über die wesentlichen Problemfelder der mitarbeiterzentrierten Produktentwicklung und profitieren Sie von konkreten Handlungsempfehlungen aus der Praxis.
Jetzt gratis downloaden!