Oracle® Fusion Middleware Programming XML for Oracle WebLogic Server 11g Release 1 (10.3.6) Part Number E13724-04 |
|
|
PDF · Mobi · ePub |
This section describes the contents and organization of this guide—Programming XML for Oracle WebLogic Server.
This document is a resource for software developers who design and develop applications that include XML processing.
The topics in this document are relevant during the design and development phases of a software project. The document also includes topics that are useful in solving application problems that are discovered during test and pre-production phases of a project.
Although this document does include administration and monitoring information useful to developers who want to test their applications in a development environment, the document does not address production-phase administration, monitoring, or performance tuning topics XML topics. For links to WebLogic Server® documentation and resources for these topics, see Related Documentation.
It is assumed that the reader is familiar with Web technologies, XML, XSLT, the Java programming language, and the Servlet and JSP APIs of the Java EE specification. This document emphasizes the value-added features provided by WebLogic Server XML and key information about how to use WebLogic Server features and facilities to get an application that performs XML processing up and running.
This document is organized as follows:
This chapter, Chapter 1, "Introduction and Roadmap," introduces the organization of this guide and the features of WebLogic Server XML.
Chapter 2, "XML Overview," provides an overview of XML technology and the WebLogic Server XML subsystem.
Chapter 3, "Developing XML Applications with WebLogic Server," describes how to process XML documents from within a WebLogic Server application using XML APIs and tools. The main processing tasks include parsing an existing XML document, generating a new XML document, and transforming a XML document into another format.
Chapter 4, "Using the Streaming API for XML (StAX)," describes in detail how to use the Streaming API for XML (StAX) in your Java applications to parse and generate an XML document.
Chapter 5, "Using Advanced XML APIs," describes how to use additional XML APIs to do more advanced tasks, such as performing XPath matching against an XML document.
Chapter 6, "XML Programming Best Practices," describes some best practices to follow when creating Java applications that process XML documents.
Chapter 7, "XML Programming Techniques," describes specific programming techniques for tasks such as using message-driven beans and JMS queues with XML documents, and so on.
Chapter 8, "XML Application Scoping," describes how to configure parsers, transformers, and external entities for a particular Enterprise application.
Chapter 9, "Administering WebLogic Server XML," describes the Administration Console XML Registry and how to perform XML configuration tasks.
Appendix A, "XML Reference," provides pointers to specifications and application programming interfaces supported by the XML software.
Appendix B, "Using the WebLogic XML Streaming API (Deprecated)," describes how to use the deprecated WebLogic XML Streaming API. The topic is included in this guide for legacy reasons only; you should not use this API for new applications. Instead you should use StAX, described in Chapter 4, "Using the Streaming API for XML (StAX)."
This document contains XML-specific design and development information.
For comprehensive guidelines for developing, deploying, and monitoring WebLogic Server applications, see the following documents:
Developing Applications for Oracle WebLogic Server is a guide to developing WebLogic Server components (such as Web applications and EJBs) and applications.
Getting Started With JAX-WS Web Services for Oracle WebLogic Server is a guide to developing Web Services that are deployed and run on WebLogic Server.
Deploying Applications to Oracle WebLogic Server is the primary source of information about deploying WebLogic Server applications.
For related information about XML outside the scope of this document, see links listed in Learning More About XML and Appendix A, "XML Reference."
In addition to this document, Oracle provides a variety of code samples for XML developers. The examples and tutorials illustrate WebLogic Server XML in action, and provide practical instructions on how to perform key XML development tasks.
Oracle recommends that you run some or all of the XML examples before programming your own application that processes XML.
WebLogic Server optionally installs API code examples in WL_HOME
\samples\server\examples\src\examples
, where WL_HOME
is the top-level directory of your WebLogic Server installation. You can start the examples server, and obtain information about the samples and how to run them from the WebLogic Server Start menu.
For a comprehensive listing of the new WebLogic Server features introduced in this release, see What's New in Oracle WebLogic Server.
WebLogic Server consolidates XML technologies applicable to WebLogic Server and XML applications based on WebLogic Server. The WebLogic Server XML subsystem allows customers to use standard parsers, the WebLogic FastParser, XSLT transformers, and DTDs and XML Schemas to process and convert XML files.
The following topics, which describe the features included in the WebLogic Server XML subsystem, are presented in this section:
WebLogic Server uses, by default, the XML parser that is included in the JDK Version 5.0.
You can also use any other XML parser of your choice by using the Administration Console to configure it in the XML Registry. You can configure a single instance of WebLogic Server to use one parser for a particular application and use another parser for a different application.
For information about parsing XML documents, see Parsing XML Documents.
The default parser in Versions 8.1and previous of WebLogic Server was one that was based on Apache's Xerces parser and whose package name started with weblogic.apache.xerces.*
. In Version 9.1 of WebLogic Server, this parser has been deprecated. Instead, the default parser is the same one that is shipped in JDK 5.0.
For backward compatibility, the weblogic.apache.xerces.*
parser is still available in Version 9.1 of WebLogic Server, although it is deprecated and Oracle highly recommends you do not use it since it will not be available in future versions. If, however, you need to temporarily continue using this parser, you must use the Administration Console to configure a parser other than the default for your WebLogic Server instance by updating, or creating, a new XML Registry and setting the default implementation classes for SAX and DOM parser factory interfaces, as indicated in Table 1-1.
Table 1-1 Default Implementation Classes for SAX and DOM Parser Factory Interfaces
Parser Factory Interface | Implementation Class |
---|---|
DOM (DocumentBuilderFactory) |
weblogic.apache.xerces.jaxp.DocumentBuilderFactoryImpl |
SAX (SAXParserFactory) |
weblogic.apache.xerces.jaxp.SAXParserFactoryImpl |
For information about creating an XML Registry, see Chapter 9, "Administering WebLogic Server XML."
WebLogic Server uses, by default, the XML transformer that is included in the JDK Version 5.0.
You can also use any other XML transformer of your choice by using the Administration Console to configure it in the XML Registry. You can configure a single instance of WebLogic Server to use one transformer for a particular application and use another transformer for a different application.
For more information about transforming XML documents, see Transforming XML Documents.
WebLogic Server includes an implementation of the Streaming API for XML (StAX).
For more information, see Chapter 4, "Using the Streaming API for XML (StAX)."
The WebLogic XPath API contains all of the classes required to perform XPath matching against a document represented as a DOM
, an XMLInputStream
, or an XMLOutputStream
.
For more information, see Using the WebLogic XPath API.
Java API for XML Processing (JAXP) 1.2 is a Java-standard, parser-independent API for XML. For more information on JAXP, see What Is JAXP?.
Note:
WebLogic Server uses the XML Registry, accessed through the Administration Console, to plug in parsers and transformers. This is different from the JAXP 1.2 specification which specifies the use of system properties to plug in parsers and transformers.The Java API for XML Registries (JAXR) API, described at http://java.sun.com/webservices/jaxr/
, provides a uniform and standard Java API for accessing different kinds of registries, in particular XML registries used in Web Service applications.
For more information, see Using the Java API for XML Registries (JAXR) API.
WebLogic Server supports the following special Servlet attributes:
org.xml.sax.HandlerBase
org.xml.sax.helpers.DefaultHandler
org.w3c.dom.Document
Calling the setAttribute
(for SAX parsing) and getAttribute
(for DOM parsing) methods on a ServletRequest
object with the preceding attributes will parse any given XML document.
For more information, see Parsing XML Documents in a Servlet.
The JSP tag library provides a simple tag that enables access to the default XSLT transformer from within a Java Server Page (JSP) running on WebLogic Server. Currently, this tag supports the default XSLT transformer only; you cannot use the tag to transform an XML document from within a JSP using a different transformer.
The JSP tag library is included in xmlx-tags.jar
, which is installed when you install your WebLogic Server distribution.
For more information, see Using the JSP Tag to Transform XML Data.
The XML Registry simplifies administration and configuration tasks by separating these tasks from the XML application. Use the Administration Console to configure the parsers and transformers for an instance of WebLogic Server.
For more information, see XML Parser and Transformer Configuration Tasks.
WebLogic XML supports external entity resolution through the XML Registry. For more information, see External Entity Configuration Tasks.
WebLogic Server does not support switching the server's DOM and SAX interfaces using the endorsed standards override mechanism.
An endorsed standard is a Java API defined through a standards process other than the Java Community Process (JCP). For more information, see Endorsed Standards Override Mechanism at http://download.oracle.com/javase/6/docs/technotes/guides/standards/
.
To learn more about XML, see the following online courses and tutorials. Appendix A, "XML Reference," provides links to additional information.
A Technical Introduction to XML, available at http://www.xml.com/pub/a/98/10/guide0.html
XML Authoring Tutorial, available at http://www.xml.com/pub/r/32
Working with XML and Java, available at http://java.sun.com/xml/tutorial_intro.html
Tutorials for using the Java 2 platform and XML technology, available at http://developerlife.com/
XML, Java, and the Future of the Web, available at http://www.xml.com/pub/a/w3j/s3.bosak.html
Chapter 17 of The XML Bible: XSL Transformations, available at http://metalab.unc.edu/xml/books/bible/updates/14.html
XSL Tutorial by Miloslav Nic, available at http://zvon.vscht.cz/HTMLonly/XSLTutorial/Books/Book1/index.html
SAX 2.0: The Simple API for XML, available at http://www.saxproject.org/
Document Object Model (DOM), available at http://www.w3.org/DOM/