- From: Venkateswar Wunnava <wvsvenkat@worldnet.att.net>
- Date: Tue, 12 Jun 2001 02:37:33 -0400 (EDT)
- To: <wason@mindspring.com>, "Jeff Rafter" <jeffrafter@definedweb.com>
- Cc: <xmlschema-dev@w3.org>
That is a good suggestion Tom. But I suppose XMLSpy is doing more ingenuine check above and beyond what XMLSchema Spec., stipulates. I suppose XMLScema specificatoin should have given a way to specify one of the global elements as root element in the form of a constraint, (some thing, XMLSpy is trying to infer). I personally do not like to hang around more than one global elements within a Schema unless I cannot do away with it. Particularly, because I do not want my Parser to punt on me by validating an instance that has a particular global element as a root element while I really did not intend to make it one, which, can be solved by a mechanism to specify one of those global elements as root element. I do not understand why this piece is being left so loose in the spec., while all possible forms of neat mechanisms have been provided in XMLSchema specification. Is there any specific reason for doing that, which I am missing? Best Regards, Venkateswar. ----- Original Message ----- From: "Tom Wason" <wason@mindspring.com> To: "Jeff Rafter" <jeffrafter@definedweb.com>; "Venkateswar Wunnava" <wvsvenkat@worldnet.att.net> Cc: <xmlschema-dev@w3.org> Sent: Monday, June 11, 2001 1:53 PM Subject: RE: Global Vs Root Element. > Jeff-- > > I agree with you in concept, as a schema may be a fragment. However (ah > yes, however...), a general rule to use is that: > > The root element can directly or indirectly contain all of the other > elements in the schema (presuming this is a complete schema). > > Therefore, the only "true" root element in this schema is <paragraph>. > Indeed, if you create a new XML instance with XML Spy, it will automatically > create an XML instance in which the root is <paragraph>. > > If you wanted to make all of the elements potentially root elements, you > could add the <paragraph> element to the complexType's <choice> list. > > --Tom > > Thomas D. Wason > e-Learning & Meta-Data Consultant > +1 919.839.8187 > wason@mindspring.com > http://www.twason.com > 1421 Park Drive > Raleigh, North Carolina 27605 USA > > < -----Original Message----- > < From: xmlschema-dev-request@w3.org > < [mailto:xmlschema-dev-request@w3.org]On Behalf Of Jeff Rafter > < Sent: Monday, June 11, 2001 12:42 PM > < To: Venkateswar Wunnava > < Cc: xmlschema-dev@w3.org > < Subject: Re: Global Vs Root Element. > < > < > < > < Typically when referring to root elements you are referring to the > < first/outer element within an XML document (aka XML instance). > < For example: > < > < <?xml version="1.0" encoding="UTF-8"?> > < <root> > < <child/> > < </root> > < > < The element <root> is the root element. Global elements are referring to > < the element definitions within a schema document that appear as direct > < children of the <schema> element. Within the schema definition > < there can be > < many global elements: > < > < <xsd:schema xmlns="paragraph" targetNamespace="paragraph" > < xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" > < elementFormDefault="qualified"> > < <xsd:element name="paragraph" type="paraType"/> > < <xsd:element name="bold" type="paraType"/> > < <xsd:element name="italic" type="paraType"/> > < <xsd:element name="underlined" type="paraType"/> > < ... > < <xsd:schema> > < > < (Quoting Tom Wason's recent example). In this sample the elements > < paragraph, bold, italic and underline are all global. Any of these can be > < used in an XML document as the root (however there is still only one root > < element per XML document). > < > < So the following XML documents would all be okay: > < > < <?xml version="1.0" encoding="UTF-8"?> > < <paragraph xmlns='paragraph'> > < This is some <bold>text</bold> > < </paragraph> > < > < <?xml version="1.0" encoding="UTF-8"?> > < <bold xmlns='paragraph'> > < This is some text > < </bold> > < > < <?xml version="1.0" encoding="UTF-8"?> > < <italic xmlns='paragraph'> > < This is some <bold>text</bold> > < </italic> > < > < In each of these documents a different global element was used as the root > < element in an XML instance. > < > < Hope this helps, > < Jeff Rafter > < Defined Systems > < http://www.defined.net > < XML Development and Developer Web Hosting > < > < ----- Original Message ----- > < From: "Venkateswar Wunnava" <wvsvenkat@worldnet.att.net> > < To: <xmlschema-dev@w3.org> > < Sent: Sunday, June 10, 2001 11:44 AM > < Subject: Global Vs Root Element. > < > < > < Hi, > < > < I am not too familiar with XML. Can some one tell me what is the > < difference > < between Global Elements and Root Elements. From what I understand from > < XMLSchema specification, we cannot impose any cardinality constraints on > < Global Elements. They can occur with multiple instances as top level > < elements. I am confused how they are different from Root Element, > < which can > < be only one element. Thanks in advance. > < > < Best Regards, > < > < Venkateswar. > < > < > < >
Received on Tuesday, 3 July 2001 08:51:14 UTC