[
Lists Home |
Date Index |
Thread Index
]
- From: Brett McLaughlin <bmclaugh@algx.net>
- To: Alan Santos <asantos@odi.com>, xml-dev@ic.ac.uk
- Date: Wed, 05 Jan 2000 15:30:16 -0600
Brett McLaughlin wrote:
>
> Alan Santos wrote:
> >
> > Thanks for the quick response Brett.
> >
> > In the example below, I understand the point of <datatype>,
> > but what is <type> getting us? Don't you have the same thing without it?
>
> Nope. This:
>
> > > <element name="myElement">
> > > <element name="nestedElement" type="string" />
> > > <element name="anotherNestedElement" type="string" />
> > > <attribute name="isPrimary">
> > > <datatype content="empty" />
> > > </attribute>
> > > <attribute name="focus">
> > > <datatype content="NMTOKENS">
> > > <enumeration value="Java" />
> > > <enumeration value="C" />
> > > <enumeration value="XML" />
> > > </datatype>
> > > </attribute>
> > > </element>
>
> is mucho illegal. Remember that XML Schema will be handled by SAX,
> which is sequential. So SAX must know _ahead_ of time that it is going
> to be dealing with a compound type. That way it can know to allow
> multiple element definitions within another definition.
>
> Without the <type> construct, SAX would have to "magically" know when
> nested element definitions are legal and when they are not... I know
> there are other good reasons, too, although I'm too tired to think of
> them... sorry.. ;-)
Dah! I'm asleep today... the reason you need <type> is because you can
specify explicit named types:
<type name="myType">
<element name="nestedElement" type="string" />
<element name="anotherNestedElement" type="integer" />
</type>
<element name="myElement" type="myType" />
There is no way without the <type> element construct to specify a name
for a non-primitive data type without really blowing away any idea of
congruity across the element space. So we have the "type" element.
Make sense?
-Brett
>
> -Brett
>
> >
> > > for example:
> > >
> > > <element name="myElement">
> > > <type>
> > > <element name="nestedElement" type="string" />
> > > <element name="anotherNestedElement" type="string" />
> > > <attribute name="isPrimary">
> > > <datatype content="empty" />
> > > </attribute>
> > > <attribute name="focus">
> > > <datatype content="NMTOKENS">
> > > <enumeration value="Java" />
> > > <enumeration value="C" />
> > > <enumeration value="XML" />
> > > </datatype>
> > > </attribute>
> > > </type>
> > > </element>
> > >
> >
> > > Your schema is one-to-one with a Java class? This wouldn't be a good
> > > idea, unless I'm misunderstanding your intent. Maybe your _XML_ is
> > > based on a class, and it specifies the class, but then multiple XML docs
> > > (therefore multiple classes) all use the same Schema.
> > >
> >
> > The _XML_ contains instances. But felt it was more appropriate within the
> > schema document. (Or some other xml instance document)
> >
> > Why do you feel it is a poor decision?
> > Am I abusing the intent of an XML Schema in a horrible manner?
> > Perhaps XMI is a better option for my needs?
> >
> > > Why not? What's the difference in your mind? If you can define an
> > > infinite number of types, and define an infinite number of elements with
> > > any defined type, how is that not flexible?
> >
> > Sorry, it is flexible, it just means more work for me, and users of my
> > application.
> >
> > Now we need two elements when we wish to add a new type to the schema
> > (unless I'm missing something else)
> >
> > (e.g. <element name="xxxReference"/>
> > <element name="xxx"/>)
> >
> > thanks,
> > alan
>
> xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
> To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
> unsubscribe xml-dev
> To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|