OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: [relax-ng] DOM Abstract Schemas revisited


I believe that it is in fact possible to map RELAX NG schemas to
the DOM Abstract Schema (AS) model, with a *very* small number of
extensions, perhaps only one. I have written an RNX schema for a
serialization of the AS model as of 2002-01-14: see below.

The root element is an ASModel, which contains ASElementDecls,
ASAttributeDecls, ASNotationDecls, AsEntityDecls, ASContentModels
(all of which are empty), and subordinate
ASModels (it is not clear what the purpose of these is).

There is a minor restriction on this serialization.  Technically,
objectNames have to be unique only within types, but
the serialization will not work unless they are unique across
the entire model.

*However, it is significant that in ASModels, there can be
an arbitrary number of ASElementDecls with the same
localName and namespaceURI, provided they have distinct
objectNames.*  Therefore, a pattern like "element foo {
element bar {attribute baz {"1"}}, element bar {attribute baz {"2"}}}
is perfectly feasible, because the two instances of "element bar"
can be modeled by separate ASElementDecls with separate
ASAttrDecls containing different values.  The value of
objectName does not affect validation, so they can be
arbitrary and therefore distinct.

The only features of RNG that do not seem to be well modeled
are name classes, data exceptions, and interleave.  Lists are also
not modeled, though they exist in both XML Schema and RNG.
To add interleave would require only a new legal value for the
listOperator attribute of ASContentModels.

Lists and data exceptions would require some extension to the ASDataType
interface (modeled as "types" below) to give it attributes, not
just constants.  Failing this, they could just be classified
as "otherSimple".

Name classes would be a significant extension, probably involving
nameClass attributes for ASElementDecls and ASAttributeDecls,
and a new ASNameClass object that can handle wildcards,
choices, and exceptions.

I propose that the TC write a comment on the current AS WD in
the interests of extending it to handle RNG.

Note: A minor extension to the datatype library, returning a numeric
value from the ASDataType constants given a datatype name,
would make it possible for an RNG implementation of AS to
work with arbitrary libraries.


# RNX schema for serialized DOM Abstract Schemas of 2002-01-14
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"

universal =
	attribute objectName {xsd:ID},
	attribute localName {xsd:NCName},
	attribute namespaceURI {xsd:anyURI},
	attribute prefix {xsd:NCName}

model = element ASModel {
	universal,
	attribute namespaceAware {xsd:boolean},
	attribute usage {
		"internalSubset" | "externalSubset" | "notUsed"}
	attribute container {xsd:boolean}
	attribute location {xsd:anyURI},
	attribute hint {string},	# public ID, etc.
	elementDecl*, attributeDecl*, notationDecl*,
	entityDecl*, contentModel*, model*
	}

type =
	"string" | "notation" | "ID" | "IDREF" | "IDREFS" |
	"ENTITY" | "ENTITIES" | "NMTOKEN" | "NMTOKENS" |
	"boolean" | "float" | "double" | "decimal" | "hexBinary" |
	"base64Binary" | "anyURI" | "QName" | "duration" | "dateTime" |
	"date" | "time" | "gyearMonth" | "gYear" | "gMonthDay" |
	"gDay" | "gMonth" | "integer" | "Name" | "NCName" |
	"normalizedString" | "token" | "language" | "nonPositiveInteger"
	"negativeInteger" | "long" | "int" | "short" | "byte" |
	"nonNegativeInteger" | "unsignedLong" | "unsignedInt" |
	"unsignedShort" | "unsignedByte" | "positiveInteger" |
	"otherSimple" | "complex"

elementDecl = element ASElementDecl {
	universal,
	attribute contentType =
		{"empty" | "any" | "mixed" | "elements" | "simple"}
	attribute attributeDecls = {xsd:IDREFS},
	attribute contentModel = {xsd:IDREF},
	attribute elementType = {type},
	attribute strictMixedContent = {xsd:boolean}
	}

contentModel = element ASContentModel {
	universal,
	attribute listOperator =
		{"choice" | "sequence" | "all" | "none"}
	attribute maxOccurs {xsd:unsignedLong},
	attribute minOccurs {xsd:unsignedLong},
	attribute subModels {xsd:IDREFS}
	}

attributeDecl = element ASAttributeDecl {
	universal,
	attribute dataType = {type},
	attribute dataValue = {string},
	attribute defaultType =
		{"none" | "default" | "fixed" | "required"},
	attribute enumAttr {string},
	attribute ownerElements {xsd:IDREFS}
	}	

externalId =
	attribute systemID {xsd:anyURI},
	attribute publicID {string}

entityDecl = element ASEntityDecl {
	universal,
	externalId,
	attribute entityType {"internal" | "external"},
	attribute entityValue {string}
	}

notationDecl = element ASNotationDecl {
	universal,
	externalId
	}

start = model


-- 
John Cowan <jcowan@reutershealth.com>     http://www.reutershealth.com
I amar prestar aen, han mathon ne nen,    http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith.  --Galadriel, _LOTR:FOTR_



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC