Experience with XML Schema Ashok Malhotra Schema Usage

  • Slides: 15
Download presentation

Experience with XML Schema Ashok Malhotra

Experience with XML Schema Ashok Malhotra

Schema Usage Ÿ Mapping XML Schema and XML documents controlled by the Schema to

Schema Usage Ÿ Mapping XML Schema and XML documents controlled by the Schema to object classes and instances. Ÿ Storing XML Schemas and documents in the database.

Mapping XML Schema to Object Classes Ÿ Choice Ÿ Derivation by Restriction Ÿ Facets

Mapping XML Schema to Object Classes Ÿ Choice Ÿ Derivation by Restriction Ÿ Facets Ÿ Derivation Control Ÿ Namespace Restrictions Ÿ Problems with Annotations

Mapping XML Schema to Object Classes - Choice Ÿ Choice allows variations in the

Mapping XML Schema to Object Classes - Choice Ÿ Choice allows variations in the content of an object. Ÿ No equivalent construct in Java. Ÿ Some languages support variant classes.

Mapping XML Schema to Object Classes Ÿ Derivation by restriction has no objectoriented equivalent.

Mapping XML Schema to Object Classes Ÿ Derivation by restriction has no objectoriented equivalent. Ÿ In the database, a restricted type is mapped to a dummy subtype with no additional fields. Restriction not enforced at SQL level. Ÿ Similarly, for datatypes, facets have no object-oriented equivalent. Ÿ Must be checked at runtime.

Mapping XML Schema to Object Classes – fixed, final, block, etc. Ÿ Fixed and

Mapping XML Schema to Object Classes – fixed, final, block, etc. Ÿ Fixed and final restrict derivation from elements. Ÿ Block restricts use of derived types where the parent type is expected. Ÿ Only final #all has a Java equivalent.

Mapping XML Schema to Object Classes – wildcard restrictions Ÿ Wildcards can be restricted

Mapping XML Schema to Object Classes – wildcard restrictions Ÿ Wildcards can be restricted to elements from a specific namespace. Ÿ No equivalent object-oriented concept. <complex. Type name=“test"> <sequence> <any namespace="http: //www. example. org"/> </sequence> </complex. Type>

Mapping XML Schema to Object Classes – problems with annotations Ÿ Can an annotation

Mapping XML Schema to Object Classes – problems with annotations Ÿ Can an annotation be added to a “ref” ? Ÿ If so, does it take precedence over an annotation of the entity referred to? Ÿ We assume annotations can be applied to a ‘ref’, and … Ÿ The annotation element on an attribute ref is associated with {Attribute Use}. Ÿ The annotation element on a model group ref or an element ref is associated with the {particle}.

Managing XML Schemas and documents in the database Ÿ Support is provided for the

Managing XML Schemas and documents in the database Ÿ Support is provided for the following tasks: – – – Registering XML Schemas. Validating XML documents against a registered XML Schema. Generating XML Schema from object classes. Generating a structured database mapping from XML Schemas during XML Schema registration. This includes generating SQL object types, collection types, and default tables, and capturing the mapping information using special attributes. Performing manipulation (DML) and queries on XML Schema-based XMLType tables. Automatically inserting data into default tables when schema-based XML instances are inserted into Oracle XML DB repository using FTP, HTTP/Web. DAV protocols and other languages.

Managing XML Schemas and documents in the database – Substitution groups Ÿ Instance data

Managing XML Schemas and documents in the database – Substitution groups Ÿ Instance data is stored in a column/table corresponding to the head element. Ÿ Additional information includes the actual element type. Ÿ Also includes, namespace prefixes, comments, PIs.

Managing XML Schemas and documents in the database – non-SQL datatypes Ÿ Datatypes that

Managing XML Schemas and documents in the database – non-SQL datatypes Ÿ Datatypes that cannot be represented in SQL are mapped to a VARCHAR 2 column. Ÿ This is also on option for datatypes that do map cleanly to SQL types e. g. integer. Ÿ Schema annotation can be used to specify storage option.

Managing XML Schemas and documents in the database – key/keyref Ÿ Not enforced at

Managing XML Schemas and documents in the database – key/keyref Ÿ Not enforced at SQL level but at the XML level. Ÿ Key/keyref apply within a document whereas, in most cases, such constraints are useful over a document collection.

Managing XML Schemas and documents in the database – wildcard with namespace exclusion Ÿ

Managing XML Schemas and documents in the database – wildcard with namespace exclusion Ÿ Cannot define a wildcard that allows elements not in a specified namespace and also allows the null namespace. Ÿ Needed to add proprietary extensions to handle this case.

Managing XML Schemas and documents in the database – redefine Ÿ Redefine is the

Managing XML Schemas and documents in the database – redefine Ÿ Redefine is the only XML Schema feature not supported. Ÿ No customer has asked for this, yet!