Creating an XML Table or View

Some DBMS support tables and views of XML type.

An XML table is used to store an XML document, it does not contain columns. It is possible to associate this table with an XML schema registered in a relational database, in this case the schema is used to validate the XML document stored in the table.

If you select the XML type in the Type list, the Column tab disappears and the following additional properties appear in the table property sheet:

Property

Description

Schema

Allows you to enter the target namespace or the name of an XML model. The schema must be registered in the database to be used for validating XML documents. You can:

  • type a user-defined schema name

  • click the Select a registered schema button to connect to a database and select a registered schema

If you select an element from an XML model open in the PowerDesigner workspace, the Schema property is automatically initialized with the XML model target namespace. Note that this schema must also be registered in the database to be used for validating XML documents

Element

Allows you to select a root element in the XML document. You can:

  • type a user-defined element name

  • click the Select an element button to select an element from the XML models open in the workspace or from the schema registered in the database

  1. Right-click the Table category in the Browser and select New.

    The property sheet of a new table is displayed.

  2. Type a table name and a table code.
  3. In the Type list, select XML.

    The Columns tab disappears and the Schema and Element boxes appear in the lower part of the General tab.

  4. In the Schema box, type the target namespace or name of an XML model or use the Select a registered schema button to select among the registered schema in a selected database.
  5. In the Element box, type the name of the root element of the selected schema.


  6. Click OK.