Learn XQuery |
Home:Learn XQuery:XQuery Tutorial:An XQJ Tutorial An XQJ Tutorial: Introduction to the XQuery API for JavaThe XQuery API for Java (XQJ), currently in development under the Java Community Process as JSR 225, lets programmers use XQuery for XML processing and data integration applications, with full support for the Java Standard Edition (Java SE) and Java Enterprise Edition (Java EE) platforms. XQJ allows a Java program to connect to XML data sources, prepare and issue XQueries, and process the results as XML. This functionality is similar to that of JDBC, but the query language for XQJ is XQuery. Starting with a simple XQuery/XQJ version of the familiar "Hello World!" application, this tutorial teaches you the basics of XQJ. Then, in easy-to-follow chapters, it covers XQJ's more advanced features, from serializing query results, to XML Pipelines, and more. Table of ContentsPart I: An XQJ IntroductionUsing an XQuery/XQJ version of the familiar "Hello World!" application, this chapter introduces you to some of the similarities between XQJ and JDBC like datasources and connections, as well as some of the concepts that make XQJ different, including data models, typing, and error handling. Part II: Configuring XQJ ConnectionsAn XQJ application always starts with accessing an XQDataSource object. The XQDataSource interface encapsulates all the parameters and settings needed to create a session with a specific implementation, and eventually execute XQuery expressions and process results. This chapter describes how to work with the XQDataSource interface in an XQJ application. Part III: Querying Data from XML Files or Java XML APIsIn XQJ, XQExpression objects allow you to execute XQuery expressions. In this chapter of the XQJ Tutorial, you'll learn how to use XQExpression objects to query data, and how to use prepared queries to reduce expensive parsing and validation operations. Part IV: Processing ResultsIn XQuery, query evaluation results in a sequence. This chapter describes how to use the XQJ XQSequence object, which represents an XQuery sequence and a cursor to iterate over the sequence. Part V: Serializing ResultsThis chapter of the XQJ Tutorial shows you how to serialize query results as XML, and how to use HTML and XHTML output methods for results. Part VI: Manipulating Static ContextAn expression's static context — the default element namespace, default order for empty sequences, the base URI, and other information — can be accessed through the XQJ API. This chapter describes the static context in greater detail, and shows how to use XQJ to manipulate it. Part VII: XQuery Type SystemXQuery is a strongly typed language, with a type system based on XML Schema. This chapter describes how to use the XQSequenceType and XQItemType XQJ interfaces to interact with the XQuery type system. Part VIII: Binding External VariablesContinuing where Part III: Querying Data from XML Files or Java XML APIs leaves off, this chapter discusses the topic of binding variables in greater detail. Need to convert a Java object in your Java application into an XDM instance? XQJ defines this mapping and glues it all together. Part IX: Creating XDM InstancesXQJ offers functionality to create both XQSequence and XQItem objects, not as a result of a query execution, but rather as standalone XDM instances. Read this chapter and learn more about the flexibility of creating XDM instances outside query execution using XQJ. Part X: XML PipelinesAn XML pipeline is a sequence of XML processes, also called transformations; in a pipeline, the result of one transformation is passed as input to the next one. In this chapter, you'll learn how to create a pipeline of XQueries and how to integrate XQuery with JAXP-based XML processors. Part XI: Processing Large InputsSince XML became a standard in the late 90's, we have been taught that XML is a tree; and the most intuitive (and popular) representation of such a tree has been (and still is!) the Document Object Model (DOM). But the DOM has limitations, especially where performance and scalability are concerned. This chapter shows you how to take advantage of streaming processors, like the one available from DataDirect XQuery®. Part XII: XQJ ReferencesThe XQJ Tutorial introduces a number of technologies and techniques for developing XQuery applications using XQJ. We've compiled a short list of useful resources for those who want to do more self-guided exploration on XQJ and related topics. |
New Features in DataDirect XQuery®DataDirect XQuery® is now released! DataDirect XQuery® provides full update support for relational data, easy integration for Web Services, additional enhancements for performance and scalability and more! DataDirect XQuery® FeaturesWith tools for accessing relational data as XML, XML publishing, and full XML IDE support, to name a just a few, DataDirect XQuery® is loaded with these and other features that will make building your next data integration application a snap. Download your copy today and see for yourself! |





