وبلاگ بلیان

Java XML and JSON : Document Processing for Java SE

معرفی کتاب «Java XML and JSON : Document Processing for Java SE» نوشتهٔ Presh Talwalkar و Jeff Friesen، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2019. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

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 Learn** * Master 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. Table of Contents 5 About the Author 11 About the Technical Reviewer 12 Acknowledgments 13 Introduction 14 Part I: Exploring XML 16 Chapter 1: Introducing XML 17 What Is XML? 17 Language Features Tour 19 XML Declaration 19 Elements and Attributes 21 Character References and CDATA Sections 24 Namespaces 26 Comments and Processing Instructions 31 Well-Formed Documents 31 Valid Documents 32 Document Type Definition 33 XML Schema 40 Summary 48 Chapter 2: Parsing XML Documents with SAX 49 What Is SAX? 49 Exploring the SAX API 50 Obtaining a SAX 2 Parser 50 Touring XMLReader Methods 51 Setting Features and Properties 54 Touring the Handler and Resolver Interfaces 56 Touring ContentHandler 56 Touring DTDHandler 58 Touring ErrorHandler 59 Touring EntityResolver 59 Touring LexicalHandler 60 Demonstrating the SAX API 61 Creating a Custom Entity Resolver 73 Summary 79 Chapter 3: Parsing and Creating XML Documents with DOM 80 What Is DOM? 80 A Tree of Nodes 81 Exploring the DOM API 84 Obtaining a DOM Parser/Document Builder 84 Parsing and Creating XML Documents 86 Demonstrating the DOM API 90 Parsing an XML Document 90 Creating an XML Document 95 Working with Load and Save 98 Loading an XML Document into a DOM Tree 99 Configuring a Parser 103 Filtering an XML Document While Parsing 109 Saving a DOM Tree to an XML Document 113 Working with Traversal and Range 115 Performing Traversals 115 Performing Range Operations 120 Summary 124 Chapter 4: Parsing and Creating XML Documents with StAX 126 What Is StAX? 126 Exploring StAX 127 Parsing XML Documents 128 Parsing Documents with Stream-Based Readers 129 Parsing Documents with Event-Based Readers 133 Creating XML Documents 138 Creating Documents with Stream-Based Writers 139 Creating Documents with Event-Based Writers 143 Summary 151 Chapter 5: Selecting Nodes with XPath 152 What Is XPath? 152 XPath Language Primer 152 Location Path Expressions 153 General Expressions 156 XPath and DOM 158 Advanced XPath 167 Namespace Contexts 167 Extension Functions and Function Resolvers 169 Variables and Variable Resolvers 174 Summary 177 Chapter 6: Transforming XML Documents with XSLT 178 What Is XSLT? 178 Exploring the XSLT API 179 Demonstrating the XSLT API 183 Going Beyond XSLT 1.0 and XPath 1.0 192 Downloading and Testing SAXON-HE 9.9 192 Playing with SAXON-HE 9.9 193 Summary 196 Part II: Exploring JSON 197 Chapter 7: Introducing JSON 198 What Is JSON? 198 JSON Syntax Tour 199 Demonstrating JSON with JavaScript 201 Validating JSON Objects 206 Summary 213 Chapter 8: Parsing and Creating JSON Objects with mJson 215 What Is mJson? 215 Obtaining and Using mJson 216 Exploring the Json Class 216 Creating Json Objects 217 Learning About Json Objects 223 Navigating Json Object Hierarchies 233 Modifying Json Objects 235 Validation 242 Customization via Factories 245 Summary 252 Chapter 9: Parsing and Creating JSON Objects with Gson 253 What Is Gson? 253 Obtaining and Using Gson 254 Exploring Gson 254 Introducing the Gson Class 255 Parsing JSON Objects Through Deserialization 258 Customized JSON Object Parsing 263 Creating JSON Objects Through Serialization 268 Customized JSON Object Creation 271 Learning More About Gson 277 Annotation Types 277 Exposing and Hiding Fields 278 Changing Field Names 282 Versioning 283 Contexts 286 Generics Support 289 Type Adapters 297 Conveniently Associating Type Adapters with Classes and Fields 303 Summary 308 Chapter 10: Extracting JSON Values with JsonPath 309 What Is JsonPath? 309 Learning the JsonPath Language 310 Obtaining and Using the JsonPath Library 314 Exploring the JsonPath Library 316 Extracting Values from JSON Objects 316 Using Predicates to Filter Items 319 Inline Predicates 319 Filter Predicates 325 Custom Predicates 327 Summary 331 Chapter 11: Processing JSON with Jackson 333 What Is Jackson? 333 Obtaining and Using Jackson 334 Working with Jackson’s Basic Features 335 Streaming 335 Stream-Based Parsing 336 Stream-Based Generation 340 Tree Model 344 Reading a JSON Document into a Tree 344 Creating a Tree and Writing It to a JSON Document 348 Data Binding 350 Simple Data Binding 351 Full Data Binding 354 Working with Jackson’s Advanced Features 360 Annotation Types 360 Read-Only Annotation Types 361 JsonSetter 361 JsonAnySetter 364 JsonCreator and JsonProperty 366 JacksonInject 368 JsonDeserialize 371 Write-Only Annotation Types 373 JsonInclude 374 JsonGetter 376 JsonAnyGetter 379 JsonPropertyOrder 381 JsonRawValue 383 JsonValue 385 JsonSerialize 387 Read-Write Annotation Types 390 JsonIgnore and JsonIgnoreProperties 390 JsonIgnoreType 394 JsonAutoDetect 397 Custom Pretty Printers 400 Factory, Parser, and Generator Features 408 Summary 412 Chapter 12: Processing JSON with JSON-P 414 What Is JSON-P? 414 JSON-P 1.0 414 JSON-P 1.1 417 Obtaining and Using JSON-P 419 Working with JSON-P 1.0 420 Working with the Object Model API 420 Working with the Streaming Model API 427 Working with JSON-P 1.1’s Advanced Features 432 JSON Pointer 433 JSON Patch 440 JSON Merge Patch 449 Editing/Transformation Operations 456 Java SE 8 Support 458 Summary 465 Part III: Appendixes 467 Appendix A: Answers to Exercises 468 Chapter 1: Introducing XML 468 Chapter 2: Parsing XML Documents with SAX 473 Chapter 3: Parsing and Creating XML Documents with DOM 481 Chapter 4: Parsing and Creating XML Documents with StAX 493 Chapter 5: Selecting Nodes with XPath 500 Chapter 6: Transforming XML Documents with XSLT 504 Chapter 7: Introducing JSON 508 Chapter 8: Parsing and Creating JSON Objects with mJson 510 Chapter 9: Parsing and Creating JSON Objects with Gson 513 Chapter 10: Extracting JSON Values with JsonPath 517 Chapter 11: Processing JSON with Jackson 518 Chapter 12: Processing JSON with JSON-P 522 Index 526 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 Learn Master 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. "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."--Provided by publisher Front Matter ....Pages i-xviii Front Matter ....Pages 1-1 Introducing XML (Jeff Friesen)....Pages 3-34 Parsing XML Documents with SAX (Jeff Friesen)....Pages 35-65 Parsing and Creating XML Documents with DOM (Jeff Friesen)....Pages 67-112 Parsing and Creating XML Documents with StAX (Jeff Friesen)....Pages 113-138 Selecting Nodes with XPath (Jeff Friesen)....Pages 139-164 Transforming XML Documents with XSLT (Jeff Friesen)....Pages 165-183 Front Matter ....Pages 185-185 Introducing JSON (Jeff Friesen)....Pages 187-203 Parsing and Creating JSON Objects with mJson (Jeff Friesen)....Pages 205-242 Parsing and Creating JSON Objects with Gson (Jeff Friesen)....Pages 243-298 Extracting JSON Values with JsonPath (Jeff Friesen)....Pages 299-322 Processing JSON with Jackson (Jeff Friesen)....Pages 323-403 Processing JSON with JSON-P (Jeff Friesen)....Pages 405-457 Front Matter ....Pages 459-459 Answers to Exercises (Jeff Friesen)....Pages 461-518 Back Matter ....Pages 519-528
دانلود کتاب Java XML and JSON : Document Processing for Java SE