Basic XMLSchema questions
Brett McLaughlin
bmclaugh at algx.net
Wed Jan 5 21:14:18 GMT 2000
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.. ;-)
-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 at 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 at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list