Generating an SQL/XML Query File

SQL/XML is an XML extension of the Structured Query Language, which allows you to retrieve relational data using extended SQL syntax, and produce an XML result. You can generate SQL/XML queries for global elements in your XSM, whatever the targeted XML language (XSD, DTD or XDR).

SQL/XML has five main elements:
  • 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

You can generate an SQL/XML query file from an XSM if you have attached the SQL/XML extension file. These extensions are automatically linked to your XSM if you have created it from a PDM via the XML Builder Wizard (see Mapping Database Objects to an XML Schema Via the XML Builder Wizard). If need be, you can still modify the mapping through the Mapping tab of elements and complex types property sheets.

To manually enable the SQL/XML extensions in your model, select Model > Extensions, click the Import tool, select the SQL/XML file (on the General Purpose tab), and click OK to attach it.

Warning!   The following procedure assumes you have an XML model open in the workspace and mapped to a PDM. Generated SQL/XML queries cannot be parameterized.
  1. Select Tools > Generate SQL/XML Queries to open the Generation dialog box.
  2. Specify the directory in which to generate the file.
  3. Click the Selection tab and specify which of the global elements you want to generate queries from. A separate file will be generated for each global element selected.
  4. Click OK to begin the generation.

    The Result dialog box is displayed with the path of the query file selected.

  5. Click Edit to open the generated query file in your associated editor: