Chapter 7. Constructing XML

Introduction

In Chapter 3, you learned how to access XML that exists outside the query and navigate over it. In this chapter, you will learn how to construct XML directly in a query. Constructing XML is useful for several purposes, including creating a new result shape (transformation), representing temporary intermediate data structures (composition), and organizing data into conceptual groups (views).

XQuery has expressions for constructing all seven of the well-known XML node kinds: element, attribute, text, document, comment, processing-instruction, and namespace. For all of these node kinds, XQuery supports two different construction expressions: one with a syntax similar to XML, and an alternate XQuery syntax primarily ...

Get XQuery: The XML Query Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.