[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Basic XMLSchema questions

  • From: Brett McLaughlin <bmclaugh@a...>
  • To: Alan Santos <asantos@o...>, xml-dev@i...
  • Date: Wed, 05 Jan 2000 15:30:16 -0600

basic type of questions
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@i...
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
> To unsubscribe, mailto:majordomo@i... the following message;
> unsubscribe xml-dev
> To subscribe to the digests, mailto:majordomo@i... the following message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa@i...)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.