Home    |    Concepts   |   API   |   Samples
Concepts > XML > Basic Principles
XML Schemas

XML schemas define the elements and attributes that can appear in an XML document. They also define the order, number, and type of XML document along with other properties. Because they define the properties and content of an XML document, XML schemas are used to validate XML documents for conformance to a defined set of constraints.

Some database management systems (DBMS) provide functionality to validate an inserted XML document against a collection of registered XML schema documents. Depending on the DBMS implementation, the association of an XML schema to an XML column is done when the table containing the XML column is created or when an INSERT or UPDATE statement is executed on the table.

ArcSDE provides a set of API to create, delete, or update XML schemas in Oracle 11g, IBM DB2, and Microsoft SQL Server databases. DB2 and SQL Server allow you to define multiple XML schemas on an XML column. In Oracle databases, only one XML schema is allowed per XML column.

Once XML schemas are registered or created with a database client application, you can associate them with an XML column by calling the SE_xmlcolumninfo_set_schema() function. Additional APIs are available to create, update, and delete an XML schema. These APIs can be grouped into four categories.

  • XML Schema Functions: To create, update, and delete XML schema
  • XML Schema Info Functions: To set/get XML schema information
  • XML Schema Collection Functions: To set/get an XML schema collection
  • XML Schema Document Functions: To set/get an XML schema document

Each XML schema object has an XML schema collection object. A collection object can have one or more XML schema documents. An XML schema object has a schema name, schema property, and schema collection. An XML schema document object has an XML schema document, XML schema location, and XML schema document property.

Once an XML column is associated with a collection of XML schema documents, all inserted XML documents are validated against one of the schemas defined in the collection. The target namespace defined in the XML document determines the schema document that is used for validation. As mentioned, only DB2 and SQL Server provide the functionality to associate a collection of schemas with an XML column.

feedback | privacy | legal