© Object Centric Solutions, Inc
XML: Design and Practical Development
1.1 Introduction
into XML and XML-enabled applications.
1.2 DTD and
XML documents design
1.3 XML Parsers
and Modeling Tools
1.4 Processing
incoming XML documents
1.5 Generating
outgoing XML documents: data binding alternatives
Brief presentation on the subject history. HTML
limitations: fixed set of tags. XML
advantage: the language for expressing business semantics. Example to illustrate
the flavor of XML.
1. Logical DTD Design
1.1. Elements Instantiating
1.2. Introducing Application Basic Types
1.3. Inheritance Modeling
1.4. Association Modeling
1.5. Aggregation Modeling
1.6. Arrays
1.7. Versioning
1.8. Domain Values
1.9. Domain Values - Alternative Approach
1.10. Element or Attribute?
1.11. Sub-Type Aggregation Modeling
1.12. Naming Conventions
1.13. Out-dated Code
1.14. Case study: SQL Result Set
2. Physical DTD Design
2.1. Recommended XML Document Structure
2.2. DTD / XML Repository Recommended Structure
3. XML Design
3.1. Modular Structure - Internal
Entities
3.2. Modular Structure - External Entities
3.2. Namespaces
4. Templates
5. Development Life Cycle
6. Development Tools
XML Parsers comparison fact-sheet. Modeling Tools for DTD analysis: XML Authority , Near & Far Designer XML , XML documents Editor EXml , XML Spy.
DOM
APIs for parsing are based upon concept of Node. Each Node can be of one of the
following types: Document, Element, Entity, Text, Processing Instruction, etc.
Sun Tree-Walker algorithm traverses Nodes in LR-top-bottom order recursively.
Tree itself is constructed by invoking DOM parser.
Event-driven
parsing utilizes so-called SAX APIs. Events signaled: start of document, end of
document, start of element, end of element, array of characters, errors.
Effective parsing algorithm uses stack to store the path to the currently
processed element. Therefore, at any time the stack holds the only slots that
correspond to the current element and the elements above the current one.
SAX
parsing can be recommended when output objects can be constructed on
“no-look-back” fashion; on the contrary DOM APIs can be chosen when current
Node processing requires data from the Nodes followed the current one. SAX APIs
also are generally resulted in more memory-effective processing.
To
generate XML documents two things are required: “what” to bind –application
object model, and “how” to bind – the set of rules / constraints on binding
process. The rules themselves are represented in the form of XML Template
document, moreover, the Template is constructed the way that both, the Template
and output document, conform to the same document definition.
Alternative
approach may utilize the document definition itself as the knowledge base on
binding rules.
Another
promising alternatives are: (a) Sun’s object binding APIs (JAXB), and (b) W3
SOAP specification aimed for automatic object mapping onto “canonical” XML
document.
Special
programming technique discussion: Node customization by adding user-defined
data.
Oracle XML SQL Utility models XML document
elements as a collection of “nested” tables. Enclosed elements are modeled
through Oracle Object data-type. SQL-XML conversion constructs XML document by
one-to-one association between table referenced by Object data-type and nested
element. Reversed conversion, XML-SQL, might require either to amend data model
(convert it from relational into object-relational), or restructure original
XML document. In either case Utility does not store XML attributes.
IBM
DB2 XML Extender allows storing XML documents either as BLOB-like objects,
or as being decomposed into set of tables. The latter transformation, known as
XML collection, is defined by utilizing XSLT/XPath notations.
ObjectCentric
Solutions x-Persistence Utility stores XML documents as normalized tree-like
structures (raw tree data) and provides tools similar to DOM APIs to navigate
data by employing traditional SQL processing. Utility is built on top of Xerces
XML Parser and is aimed for cross-database usage.
XML Schema overcomes some modeling
limitations of XML Specification 1.0.
Schema introduces strong typing mechanism for both elements and
attributes. Here is the partial list of new modeling functionality introduced
in Schema: Subtypes derivation by restriction or extension; introduction of
Union and List; Fully controlled Mixed Context syntax; Re-usable Groups; Null
Values; Abstract Types. Schema is naturally integrated with XML Namespaces.
Discussion:
Current status of Schema-compliant parsers.
XPath, XSLT and XML Query
Language
XPath defines notation for XML elements addressing schema. This schema can be even applied if an element does not contain specially designated identifier. XPath syntax is employed by XSL Transformation to express rules for transforming original XML document into another one, output XML document. Transformation rules are specified in so-called XML style-sheet document. Thus, XSLT processor’s input is represented as a pair of <original XML document, Style-sheet>. For exercises it is recommended to use XT processor by James Clark (http://www.blnz.com/xt/index.html). XML transformation can be defined in recursive manner. Advanced features: selective processing, numbering, sorting.
Brief
tour into growing world of MLs includes examples of (a) forward rate agreement
definition in FpML; (b) simple algebraic
formula definition in MathML; (c) wireless
cellular phone setting application in WML.