E-Book, Englisch, 300 Seiten
FRIESEN Java XML and JSON
1. ed
ISBN: 978-1-4842-1916-4
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
E-Book, Englisch, 300 Seiten
ISBN: 978-1-4842-1916-4
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
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 learnHow 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.
Autoren/Hrsg.
Weitere Infos & Material
1;Contents at a Glance;6
2;Contents;8
3;About the Author;14
4;About the Technical Reviewer;16
5;Acknowledgments;18
6;Introduction;20
7;Chapter 1: Introducing XML;22
7.1;What Is XML?;22
7.2;Language Features Tour;24
7.2.1;XML Declaration;24
7.2.2;Elements and Attributes;26
7.2.3;Character References and CDATA Sections;28
7.2.4;Namespaces;29
7.2.5;Comments and Processing Instructions;34
7.3;Well-Formed Documents;35
7.4;Valid Documents;36
7.4.1;Document Type Definition;36
7.4.2;XML Schema;42
7.5;Summary;49
8;Chapter 2: Parsing XML Documents with SAX;50
8.1;What Is SAX?;50
8.2;Exploring the SAX API;51
8.2.1;Obtaining a SAX 2 Parser;51
8.2.2;Touring XMLReader Methods;52
8.2.2.1;Setting Features and Properties;55
8.2.3;Touring the Handler and Resolver Interfaces;56
8.2.3.1;Touring ContentHandler;56
8.2.3.2;Touring DTDHandler;59
8.2.3.3;Touring ErrorHandler;59
8.2.3.4;Touring EntityResolver;60
8.2.3.5;Touring LexicalHandler;60
8.3;Demonstrating the SAX API;61
8.4;Creating a Custom Entity Resolver;70
8.5;Summary;75
9;Chapter 3: Parsing and Creating XML Documents with DOM;77
9.1;What Is DOM?;77
9.2;A Tree of Nodes;78
9.3;Exploring the DOM API;81
9.3.1;Obtaining a DOM Parser/Document Builder;81
9.3.2;Parsing and Creating XML Documents;83
9.4;Demonstrating the DOM API;87
9.5;Summary;94
10;Chapter 4: Parsing and Creating XML Documents with StAX;95
10.1;What Is StAX?;95
10.2;Exploring StAX;96
10.2.1;Parsing XML Documents;97
10.2.1.1;Parsing Documents with Stream-Based Readers;98
10.2.1.2;Parsing Documents with Event-Based Readers;101
10.2.2;Creating XML Documents;105
10.2.2.1;Creating Documents with Stream-Based Writers;105
10.2.2.2;Creating Documents with Event-Based Writers;109
10.3;Summary;115
11;Chapter 5: Selecting Nodes with XPath;116
11.1;What Is XPath?;116
11.2;XPath Language Primer;116
11.2.1;Location Path Expressions;117
11.2.2;General Expressions;120
11.3;XPath and DOM;122
11.4;Advanced XPath;129
11.4.1;Namespace Contexts;129
11.4.2;Extension Functions and Function Resolvers;130
11.4.3;Variables and Variable Resolvers;134
11.5;Summary;137
12;Chapter 6: Transforming XML Documents with XSLT;138
12.1;What Is XSLT?;138
12.2;Exploring the XSLT API;139
12.3;Demonstrating the XSLT API;142
12.4;Summary;151
13;Chapter 7: Introducing JSON;152
13.1;What Is JSON?;152
13.2;JSON Syntax Tour;153
13.3;Demonstrating JSON with JavaScript;156
13.4;Validating JSON Objects;159
13.5;Summary;166
14;Chapter 8: Parsing and Creating JSON Objects with mJson;167
14.1;What Is mJson?;167
14.1.1;Obtaining and Using mJson;168
14.2;Exploring the Json Class;168
14.2.1;Creating Json Objects;169
14.2.2;Learning About Json Objects;173
14.2.3;Navigating Json Object Hierarchies;181
14.2.4;Modifying Json Objects;183
14.2.5;Validation;188
14.2.6;Customization via Factories;191
14.3;Summary;196
15;Chapter 9: Parsing and Creating JSON Objects with Gson;197
15.1;What Is Gson?;197
15.1.1;Obtaining and Using Gson;198
15.2;Exploring GSon;198
15.2.1;Introducing the Gson Class;199
15.2.2;Parsing JSON Objects Through Deserialization;201
15.2.2.1;Customized JSON Object Parsing;203
15.2.3;Creating JSON Objects Through Serialization;208
15.2.3.1;Customized JSON Object Creation;210
15.2.4;Learning More About Gson;215
15.2.4.1;Annotations;215
15.2.4.1.1;Exposing and Hiding Fields;216
15.2.4.1.2;Changing Field Names;219
15.2.4.1.3;Versioning;220
15.2.4.2;Contexts;222
15.2.4.3;Generics Support;225
15.2.4.4;Type Adapters;231
15.2.4.4.1;Conveniently Associating Type Adapters with Classes and Fields;236
15.3;Summary;240
16;Chapter 10: Extracting JSON Values with JsonPath;241
16.1;What Is JsonPath?;241
16.2;Learning the JsonPath Language;242
16.3;Obtaining and Using the JsonPath Library;245
16.4;Exploring the JsonPath Library;246
16.4.1;Extracting Values from JSON Objects;247
16.4.2;Using Predicates to Filter Items;250
16.4.2.1;Inline Predicates;250
16.4.2.2;Filter Predicates;252
16.4.2.3;Custom Predicates;254
16.5;Summary;257
17;Appendix A: Answers to Exercises;258
17.1;Chapter 1: Introducing XML;258
17.2;Chapter 2: Parsing XML Documents with SAX;263
17.3;Chapter 3: Parsing and Creating XML Documents with DOM;268
17.4;Chapter 4: Parsing and Creating XML Documents with StAX;275
17.5;Chapter 5: Selecting Nodes with XPath;278
17.6;Chapter 6: Transforming XML Documents with XSLT;281
17.7;Chapter 7: Introducing JSON;284
17.8;Chapter 8: Parsing and Creating JSON Objects with mJson;286
17.9;Chapter 9: Parsing and Creating JSON Objects with Gson;289
17.10;Chapter 10: Extracting JSON Property Values with JsonPath;293
18;Index;295




