Java XML and JSON (eBook)

(Autor)

eBook Download: PDF
2016 | 1st ed.
XX, 284 Seiten
Apress (Verlag)
978-1-4842-1916-4 (ISBN)

Lese- und Medienproben

Java XML and JSON - Jeff Friesen
Systemvoraussetzungen
36,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
This book describes the popular XML and JSON data-interchange languages. You'll explore each language and learn how to parse/create XML-based documents and parse JSON-based documents via various Java APIs. You will also learn how XML and JSON are applied and used in AJAX (and AJAJ), Android, Big Data, and Web Services contexts, all from the Java perspective.

Each chapter ends with select exercises designed to challenge your grasp of the chapter's content. An appendix provides the answers to these exercises. A second appendix presents a list of developer questions about XML and JSON along with my answers to these questions.


What you'll learn
  • How to use Java, JSON and XML together to build services, big data
  • How to use XML; parse XML documents with SAX, DOM, StAX; selecting nodes with XPath; and transform XML documents with XSLT
  • What is JSON and how to explore parsing JSON content with Google GSON, Jackson, Quick JSON
  • How to roll your own JSON APIs
  • How to use XML and JSON with Ajax, Android, big data and web services

Who this book is for

This book is for intermediate or advanced Java programmers/developers.



Jeff Friesen is a freelance tutor and software developer with an emphasis on Java (and now Android). In addition to authoring Learn Java for Android Development and co-authoring Android Recipes -- Jeff has written numerous articles on Java and other technologies for JavaWorld, informIT, Java.net, DevSource and more.


Java XML and JSON is your one-stop guide to mastering the XML metalanguage and JSON data format along with significant Java APIs for parsing and creating XML/JSON documents (and more). The first six chapters focus on XML along with the SAX, DOM, StAX, XPath, and XSLT APIs. The remaining four chapters focus on JSON along with the mJson, GSON, and JsonPath 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.WhatYou'll LearnMaster the XML languageLearn how to validate XML documentsLearn how to parse XML documents with the SAX, DOM, and StAX APIsLearn how to create XML documents with the DOM and StAX APIsLearn how to extract values from XML documents with the XPath APILearn how to transform XML documents with the XSLT APIMaster the JSON formatLearn how to validate JSON documentsLearn how to parse and create JSON documents with the mJson and Gson APIsLearn how to extract values from JSON documents with the JsonPath APIWho This Book Is ForIntermediate or advanced Java programmers/developers.

Jeff Friesen is a freelance tutor and software developer with an emphasis on Java (and now Android). In addition to writing Learn Java for Android Development and co-writing Android Recipes -- Jeff has written numerous articles on Java and other technologies for JavaWorld, informIT, Java.net, DevSource and more.

Contents at a Glance 6
Contents 8
About the Author 14
About the Technical Reviewer 16
Acknowledgments 18
Introduction 20
Chapter 1: Introducing XML 22
What Is XML? 22
Language Features Tour 24
XML Declaration 24
Elements and Attributes 26
Character References and CDATA Sections 28
Namespaces 29
Comments and Processing Instructions 34
Well-Formed Documents 35
Valid Documents 36
Document Type Definition 36
XML Schema 42
Summary 49
Chapter 2: Parsing XML Documents with SAX 50
What Is SAX? 50
Exploring the SAX API 51
Obtaining a SAX 2 Parser 51
Touring XMLReader Methods 52
Setting Features and Properties 55
Touring the Handler and Resolver Interfaces 56
Touring ContentHandler 56
Touring DTDHandler 59
Touring ErrorHandler 59
Touring EntityResolver 60
Touring LexicalHandler 60
Demonstrating the SAX API 61
Creating a Custom Entity Resolver 70
Summary 75
Chapter 3: Parsing and Creating XML Documents with DOM 77
What Is DOM? 77
A Tree of Nodes 78
Exploring the DOM API 81
Obtaining a DOM Parser/Document Builder 81
Parsing and Creating XML Documents 83
Demonstrating the DOM API 87
Summary 94
Chapter 4: Parsing and Creating XML Documents with StAX 95
What Is StAX? 95
Exploring StAX 96
Parsing XML Documents 97
Parsing Documents with Stream-Based Readers 98
Parsing Documents with Event-Based Readers 101
Creating XML Documents 105
Creating Documents with Stream-Based Writers 105
Creating Documents with Event-Based Writers 109
Summary 115
Chapter 5: Selecting Nodes with XPath 116
What Is XPath? 116
XPath Language Primer 116
Location Path Expressions 117
General Expressions 120
XPath and DOM 122
Advanced XPath 129
Namespace Contexts 129
Extension Functions and Function Resolvers 130
Variables and Variable Resolvers 134
Summary 137
Chapter 6: Transforming XML Documents with XSLT 138
What Is XSLT? 138
Exploring the XSLT API 139
Demonstrating the XSLT API 142
Summary 151
Chapter 7: Introducing JSON 152
What Is JSON? 152
JSON Syntax Tour 153
Demonstrating JSON with JavaScript 156
Validating JSON Objects 159
Summary 166
Chapter 8: Parsing and Creating JSON Objects with mJson 167
What Is mJson? 167
Obtaining and Using mJson 168
Exploring the Json Class 168
Creating Json Objects 169
Learning About Json Objects 173
Navigating Json Object Hierarchies 181
Modifying Json Objects 183
Validation 188
Customization via Factories 191
Summary 196
Chapter 9: Parsing and Creating JSON Objects with Gson 197
What Is Gson? 197
Obtaining and Using Gson 198
Exploring GSon 198
Introducing the Gson Class 199
Parsing JSON Objects Through Deserialization 201
Customized JSON Object Parsing 203
Creating JSON Objects Through Serialization 208
Customized JSON Object Creation 210
Learning More About Gson 215
Annotations 215
Exposing and Hiding Fields 216
Changing Field Names 219
Versioning 220
Contexts 222
Generics Support 225
Type Adapters 231
Conveniently Associating Type Adapters with Classes and Fields 236
Summary 240
Chapter 10: Extracting JSON Values with JsonPath 241
What Is JsonPath? 241
Learning the JsonPath Language 242
Obtaining and Using the JsonPath Library 245
Exploring the JsonPath Library 246
Extracting Values from JSON Objects 247
Using Predicates to Filter Items 250
Inline Predicates 250
Filter Predicates 252
Custom Predicates 254
Summary 257
Appendix A: Answers to Exercises 258
Chapter 1: Introducing XML 258
Chapter 2: Parsing XML Documents with SAX 263
Chapter 3: Parsing and Creating XML Documents with DOM 268
Chapter 4: Parsing and Creating XML Documents with StAX 275
Chapter 5: Selecting Nodes with XPath 278
Chapter 6: Transforming XML Documents with XSLT 281
Chapter 7: Introducing JSON 284
Chapter 8: Parsing and Creating JSON Objects with mJson 286
Chapter 9: Parsing and Creating JSON Objects with Gson 289
Chapter 10: Extracting JSON Property Values with JsonPath 293
Index 295

Erscheint lt. Verlag 15.6.2016
Zusatzinfo XX, 284 p. 10 illus., 7 illus. in color.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Programmiersprachen / -werkzeuge Java
Informatik Programmiersprachen / -werkzeuge XML
Mathematik / Informatik Informatik Web / Internet
Schlagworte Android • Big Data • Dom • Java • JavaScript • JSON • Mobile • Web • XML
ISBN-10 1-4842-1916-3 / 1484219163
ISBN-13 978-1-4842-1916-4 / 9781484219164
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 4,7 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Einführung, Ausbildung, Praxis

von Christian Ullenboom

eBook Download (2023)
Rheinwerk Computing (Verlag)
37,43
Moderne GUIs für RIAs und Java-Applikationen

von Ralph Steyer

eBook Download (2022)
Springer Fachmedien Wiesbaden (Verlag)
42,99