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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Notations for datatypes

[ Lists Home | Date Index | Thread Index ]

Hi Jonathan,

> Rick Jelliffe reminded me in private email that he had proposed notations
> to the W3C XML Schema WG as a way of declaring data types. Let me ask a few 
> questions about a notation-based design for declaring datatypes:
>
> 1. How do you declare the types of attributes?

I asked that question too. You can't do it with notations in XML.
Arjun Ray supplied the SGML answer:

---
> Not in XML.  But it's possible in SGML, using the DATA declared value.
> 
>   <!ATTLIST foo
>             bar  DATA baz  #IMPLIED
>             >
> 
> where the DATA keyword is followed by the name of a declared notation.  
---

> 2. How do you define common libraries of data types using notations
> that are shared across schemas?
>
> 3. How would using a syntax based on notations simplify the design
> of the schema language as a whole - what difference would it make?

I think, from the adversarial way in which you put your questions,
that you've jumped to some unwarranted conclusions about my
motivations for exploring how DTDs could declare W3C XML Schema data
types. Just to explain: I've recently been using RELAX NG with W3C XML
Schema data types and then using Trang to automatically convert that
schema into a DTD. When you do that conversion, you lose the
information about the types of elements (and attributes). I was
wondering whether NOTATIONs could be a way of preserving that
information in the DTD, which would help round-trip conversions.

What I was thinking is that we could have a regular scheme for
NOTATION public identifiers, using the namespace URI of the data type
with a fragment identifier indicating the name of the data type. (This
would only work for namespaces that didn't use fragment identifiers
themselves, I guess, but they're thankfully rare.) Sounds like this
would be a feasible scheme for preserving element types.

But your questions have got me thinking. The main distinction, I
think, between a notation-based mechanism and the mechanism in W3C XML
Schema is that in the former data types can be indicated through an
identifier rather than through a reference to their definition. That's
powerful (for simple data types) because it decouples the method used
to define the data type from the method used to define the element or
attribute that uses the data type.

It means that a data type could be defined in many ways -- with a
simple type definition in a W3C XML Schema schema; with a Java class
that implements a particular type-definition API that we can invent;
through a natural language definition in a spec such as those for the
W3C XML Schema primitive types and so on.

In terms of simplifying the schema language, it would mean that the
schema language could take the same step as RELAX NG has made, and
concentrate on how to define element/attribute structures, enabling it
to reuse the work that's gone into defining data types elsewhere.

Actually, though, I think I'm being unfair to W3C XML Schema, because
it is half way there. You can already use data types from libraries
that haven't been defined using W3C XML Schema if you import the
namespace for those libraries but don't specify a schemaLocation. It
would be even better if you could specify a schemaLocation but it
didn't have to be a W3C XML Schema schema, but I think that if W3C XML
Schema made that change, it would really have to have a special kind
of import for data type libraries, in the same way that RELAX NG does.

*Complex* data types are another matter entirely, as usual.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS