Download presentation
Presentation is loading. Please wait.
Published byMervyn Bradley Modified over 8 years ago
1
An OO schema language for XML SOX W3C Note 30 July 1999
2
What is SOX ? z A schema language for defining y the syntactic structure y the partial semantics … of XML document types z Based on an Object-Oriented approach (Java) z Developed by Commerce One
3
Why using SOX instead of DTD ? SOX is an efficient alternative to XML DTDs z provide the same services plus… z SOX schemas are written in XML y easier to read and to write y can be managed using XML management tools z an extensive and extensible set of datatypes z embedded documentation z extensive use of namespaces z OO features: reusability, polymorphism, inheritance
4
What is an XML schema ? z A set of definitions providing a structured way of organizing data z Defines structure rules using y element type definitions y datatype definitions y namespace references z ~.h file XML document ~.cpp file z Characterized by an URI
5
Element type definitions z Defines the basic structures found in an XML doc z Close to classes in Java z Tags in XML document ~ instances z Created using keyword elementtype
6
Element type definitions Characterized by z A name: unique identifier in a given schema z A comment: HTML text z A collection of attributes z A model y defines structure and composition of an element of that type y empty, string, element, sequence, choice
7
Element type definitions This defines the paragraph element
8
Empty content model z The element contains no data z Useful when y element is optional but its presence significant y all the data is contained in the attributes
9
String content model z Element contains only data, no other element z Useful for simple structure containing only data z String can be of any datatype I love XML !
10
Element content model z Content restricted to be only of one type of element z datatype or other element type z Occurrence: ?, +, *, (N,M)
11
Sequence content model z Content expressed as a sequence of elements z Element, sequence or choice z Useful to ensure that data appear in a given order
12
Choice model content z lists a number of elements, sequences or choices z Only one of the options appears in the instance This is a string in a choice
13
Attributes z Used to describe an element or its content z has a “is a” relation to content nested element: “has a” relation z ~ attributes of a class in Java
14
Attributes Characterized by z A name: unique identifier in a given schema z A comment: HTML text z A type: intrinsic or user-defined element type z A presence specification element: required, implied, default, fixed
15
Creating new attribute types z Either derived from intrinsic type or from another user-defined type z Created via keyword attdef z 3 operators: y enumeration y scalar y varchar
16
Creating new attribute types Red Blue
17
Namespaces z Each schema exists in a namespace z Can use definitions from other namespaces y Import the external namespaces in the schema y ~ Libraries in Java y Indicates original namespace using xmlns y append prefix to the name of imported attribute and element types
18
Namespaces <namespace prefix="containers" namespace= "urn:x-commerceone:document:Container.sox$1.0"/> […] […] <other:AluminumCan xmlns:other= "urn:x-commerceone:document:Container.sox$1.0"> […]
19
Inheritance z Element type inherits structure from another type y can add new structures using append y can add new attributes z Sequence, element and empty models only z Can extend types from other namespaces z Uses keyword extend
20
Inheritance
21
Polymorphism z An element type specifies a specific type in its content z An subtype of this type is used instead 15 11:23 Matrix
22
How does it work ? z All SOX schemas conforms to the same DTD “schema.dtd” z Everything is converted into Java Beans y Reusing definitions is easy y Enable robust distributed schema management
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.