You are previewing Processing XML documents with Oracle JDeveloper 11g.
O'Reilly logo
Processing XML documents with Oracle JDeveloper 11g

Book Description

Creating, validating, and transforming XML documents with Oracle's IDE

  • Will get the reader developing applications for processing XML in JDeveloper 11g quickly and easily

  • Self-contained chapters provide thorough, comprehensive instructions on how to use JDeveloper to create, validate, parse, transform, and compare XML documents.

  • The only title to cover XML processing in Oracle JDeveloper 11g, this book includes information on the Oracle XDK 11g APIs.

  • Packed with example code and detailed commentary, the book is fully illustrated with functional step-by-step examples.

In Detail

XML is an open standard for creating markup languages and exchanging structured documents and data over the Internet. JDeveloper 11g presents an effective, quick, and easy-to-use means of processing XML documents.

Inspired by the author's previous XML articles for the Oracle community, this expanded hands-on tutorial guides newcomers and intermediate users through JDeveloper 11g and XML document development. It offers up-to-date information on working with the latest version of JDeveloper, and brand new information on JAXB 2.0 support in JDeveloper 11g. Filled with illustrations, explanatory tables, and comprehensive instructions, this book walks the reader through the wide assortment of JDeveloper's capabilities.

Oracle's JDeveloper 11g is an Integrated Development Environment that provides a visual and declarative approach to application development. Over the course of 14 chapters, readers will get hands-on with JDeveloper as the comprehensive and self-contained tutorials provide clear instruction on the key XML tasks that JDeveloper can accomplish.

Filled with practical information and illustrated examples, this book shows the reader how to create, parse, and store XML documents quickly, as well as providing step-by-step instructions on how to construct an XML schema and use the schema to validate an XML document.

Oracle's XML Developer Kit (XDK) offers a set of components, tools, and utilities for developing XML-based applications, and developers will find the detailed XDK coverage invaluable. Later chapters are given over to using XPath, transforming XML with XSLT, and using the JSTL XML Tag Library.

Moving through the book, a chapter on the JAXB 2.0 API shows you how to bind, marshal and unmarshal XML documents, before we finally delve into comparing XML documents, and converting them into PDF and Excel formats. In all, this book will enable the reader to gain a good and wide-ranging understanding of what JDeveloper has to offer for XML processing.

Table of Contents

  1. Processing XML documents with Oracle JDeveloper 11g
  2. Credits
  3. About the Author
  4. About the Reviewers
  5. Preface
    1. What this book covers
    2. What you need for this book
    3. Who is this book for?
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code for the book
      2. Errata
      3. Piracy
      4. Questions
      5. Copyright credit
  6. 1. Creating and Parsing an XML Document
    1. Setting the environment
    2. Generating an XML document
      1. Creating the factory
      2. Creating the DOM document object
      3. Creating the root element
      4. Constructing the DOM document
      5. Outputting the DOM document
      6. Running the Java application
    3. Parsing an XML document with the DOM API
      1. Creating the factory
      2. Creating a DOM document object
      3. Outputting the XML document components' values
      4. Running the Java application
    4. Parsing an XML document with the SAX API
      1. Creating the factory
      2. Parsing the XML document
      3. Running the Java application
    5. Summary
  7. 2. Creating an XML Schema
    1. An overview of XML Schema
      1. Root element
      2. Element component
      3. SimpleType component
      4. ComplexType component
    2. Setting the environment
    3. Creating an XML schema
    4. Registering an XML schema
    5. Creating an XML document from the XML schema
    6. Summary
  8. 3. XML Schema Validation
    1. JDeveloper built-in schema validation
    2. Schema validation in XDK 11g
    3. Setting the environment
    4. Schema validation with XSDValidator
      1. Creating a schema validator
      2. Setting the error handler
      3. Validating the XML document
      4. Running the Java application
    5. Schema validation with a SAX parser
      1. Creating a SAX parser
      2. Setting the error handler
      3. Validating the XML document
      4. Running the Java application
    6. Schema validation with a DOM parser
      1. Creating a DOM parser
      2. Setting the error handler
      3. Parsing the XML document
      4. Running the Java application
    7. Summary
  9. 4. XPath
    1. What is XPath?
    2. XPath support in Oracle XDK 11g
    3. Setting the environment
    4. XPath search
      1. Selecting nodes with absolute location paths
      2. Selecting nodes with relative location paths
      3. Selecting namespace nodes
    5. Selecting nodes with XPath API
      1. Creating the DOM parser
      2. Method selectSingleNode(String)
      3. Method selectNodes(String)
      4. Method selectSingleNode(String,NSResolver)
      5. Method selectNodes(String,NSResolver)
      6. Running the Java application
    6. Summary
  10. 5. Transforming XML with XSLT
    1. What we will cover in this chapter
    2. Setting the environment for XSLT transformation
    3. Transforming an XML document
      1. Parsing the XML document
      2. Creating the TransformerFactory
      3. Creating the Transformer
      4. Running the application
    4. XSLT extension functions
      1. Setting the environment for XSLT extension functions
      2. Creating the stylesheet containing the extension functions
        1. Instantiating Java classes
        2. Parsing the XML
        3. Storing Java results in XSLT—non-static method
        4. Storing Java results in XSLT—static method
        5. Modifying attributes
        6. Modifying element text
        7. Stylesheet with extension functions
      3. Processing the extension functions
    5. Summary
  11. 6. JSTL XML Tag Library
    1. Overview of the JSTL XML tag library
    2. Setting the environment
    3. Parsing with the JSTL XML tag library
    4. Transforming with the JSTL XML tag library
    5. Summary
  12. 7. Loading and Saving XML with DOM 3.0 LS
    1. Background
    2. The API
    3. Setting the environment
    4. Loading an XML document
      1. Creating the LSParser
      2. Adding event handling
      3. Parsing the XML document
    5. Saving an XML document
      1. Creating a document object
      2. Creating an LSSerializer
      3. Outputting the document object
    6. Filtering an XML document
      1. Filtering the input
      2. Filtering the output
    7. Summary
  13. 8. Validating an XML Document with DOM 3 Validation
    1. Setting the environment
    2. Constructing and validating an XML document
      1. Parsing XML document and setting XML schema
      2. Global elements
      3. The catalog element
      4. Adding journal attributes
      5. Adding article attributes
      6. Adding article subelements
      7. Adding a journal element
      8. Validating a document
      9. Running the DOM 3 Validation application
      10. XDK 11g limitations
    3. Summary
  14. 9. JAXB 2.0
    1. Setting the environment
    2. Compiling an XML schema
    3. Marshalling an XML document
    4. Unmarshalling an XML document
    5. Mapping Java to XML using annotations
    6. Summary
  15. 10. Comparing XML Documents
    1. Setting the environment
    2. Comparing XML documents with the XMLDiff class
      1. Parsing the XML files
      2. Comparing the XML files
      3. Generating an XSLT stylesheet
      4. Running the Java application
    3. Summary
  16. 11. Converting XML to PDF
    1. Setting the environment
    2. Converting XML to XSL-FO
    3. Parsing the XML document
      1. Generating the XSL-FO document
    4. Converting XSL-FO to PDF
      1. Creating the FOP driver
      2. Generating the PDF document
      3. Running the Java application
    5. Summary
  17. 12. Converting XML to MS Excel
    1. Setting the environment
    2. Converting an XML document to an Excel spreadsheet
      1. Creating a spreadsheet
      2. Parsing the XML document
      3. Adding XML data to the spreadsheet
      4. Outputting the spreadsheet
      5. Running the Java application
    3. Converting an Excel spreadsheet to an XML document
      1. Creating the XML document
      2. Parsing the Excel spreadsheet
      3. Constructing the XML DOM tree
      4. Running the Java application
    4. Summary
  18. 13. Storing XML in Oracle Berkeley DB XML
    1. Installing Oracle Berkeley DB XML
    2. Using the command shell
      1. Adding XML documents
      2. Querying XML documents with XQuery
      3. Modifying XML documents
      4. Replacing/deleting XML document nodes
    3. Using the Berkeley DB XML API in JDeveloper
      1. Setting the environment
      2. Creating a container
      3. Adding XML documents
      4. Querying XML documents with XQuery
      5. Modifying XML documents
      6. Updating/renaming in XML documents
    4. Summary
  19. 14. Oracle XML Publisher
    1. Setting the environment
    2. FO Processor Engine
    3. XSL-FO Utility
    4. PDF Document Merger
    5. Data Engine
    6. Summary