1 / 15

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 object classes and instances. Storing XML Schemas and documents in the database. Mapping XML Schema to Object Classes. Choice Derivation by Restriction Facets

deion
Download Presentation

Experience with XML Schema Ashok Malhotra

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Experience with XML Schema Ashok Malhotra

  2. 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.

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

  4. 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.

  5. Mapping XML Schema to Object Classes • Derivation by restriction has no object-oriented 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.

  6. 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.

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

  8. 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}.

  9. 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/WebDAV protocols and other languages.

  10. 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.

  11. Managing XML Schemas and documents in the database – non-SQL datatypes • Datatypes that cannot be represented in SQL are mapped to a VARCHAR2 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.

  12. 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.

  13. 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.

  14. 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!

More Related