Projecting Objects to XML
Introduction to Object-XML Projections
[Back] [Next]
Go to:

This book describes how to project Caché objects to XML and how to control that projection to XML elements, attributes, and types.

This chapter introduces how to project objects to XML and explains why you might want to do this.
For information on XML standards supported in Caché, see Standards Supported by Caché in Using Caché XML Tools.
The Basics
The phrase projecting an object to XML means defining how that object can be used as an XML document. To project an object to XML, you add %XML.Adaptor to the superclass list of the class that defines the object, as well as any other object classes used by that class, with minor exceptions.
This activity is also called defining the XML projection of the class that defines the object or XML-enabling that class.
How It Works
When you define the XML projection for a class:
Then, if the default projection is not suitable for your needs, you edit the XML-related parameters in your class as needed.
Projection Options
The XML projection for a given class determines how instances of that class correspond to XML documents and vice versa. For example:
You can control the XML projection in many ways, including the following:
Most of these parameters affect all the scenarios in which you use the XML-enabled class. A few parameters apply in certain scenarios; this book notes these exceptions.
Related Tools in Caché
When you define the XML projection for a class, you have access to a large set of Caché tools, which are suitable for many practical applications. You can use these tools to work with your class in any of the following ways:
Caché provides additional tools for working with XML documents, including arbitrary XML documents that do not correspond to Caché classes. These tools include support for DOM, XPath, and XSLT.
Caché uses the Caché SAX Parser to validate and parse inbound and outbound XML documents (SAX means “Simple API for XML”). The Caché SAX Parser is a built-in SAX XML validating parser using the standard Xerces library. Caché SAX communicates with a Caché process using a high-performance, in-process call-in mechanism. You can fine-tune the parser or provide your own custom SAX interface classes.
For information on using any of the XML tools described here, see Using Caché XML Tools.
For information on web services and clients, see Creating Web Services and Web Clients in Caché.
Possible Applications for XML Documents
You can use XML documents in a variety of practical applications, including: