Chapter 5 Exchanging data with databases supporting XML
Generating SQL/XML queries
SQL/XML is an XML extension of the Structured Query Language. With SQL/XML, you retrieve relational data using extended SQL syntax, and produce a result using XML. SQL/XML is made of five main functions:
♦XMLELEMENT: to edit an element with a name, a list of attributes (optional) and a list of values (optional)
♦XMLATTRIBUTES: to edit a list of attributes with names and values
♦XMLAGG: to edit in multiple rows a concatenation of elements, from a single XML value corresponding to a single column
♦XMLCONCAT: to edit in the same row a concatenation of elements, from several XML values corresponding to several columns
♦XMLFOREST: to edit in the same row a concatenation of elements, from several SQL values corresponding to several columns. The name and value of a column become the name and value of an element
An XML model allows you to generate SQL/XML queries for global elements, whatever the targeted XML language (XSD, DTD or XDR). You need first to map an XML model to a PDM, then to attach the SQL/XML extended model definition to the mapped XML model.
The best way to map an XML model to a PDM is to use the XML Builder Wizard from a PDM. The generated XML model is automatically mapped to the PDM and linked with the SQL/XML extended model definition. If need be, you can still modify the mapping through the Mapping page of elements and complex types property sheets.
For more information on the XML Builder Wizard, see Generating an XML model via the XML Builder Wizard, in chapter Generating from a PDM, in the PDM User’s Guide.
Generated SQL/XML queries cannot be parameterized.
Caution
The following procedure assumes you have an XML model open in the workspace and mapped to a PDM.
To generate SQL/XML queries:
1< If the SQL/XML extended model definition is already attached to the XML model, go to step 6 > Select Model→Extended Model Definitions.
XSM User's Guide | 249 |