W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2001

Antwort: Re: Global Vs Root Element.

From: <Holger.Joukl@LBBW.de>
Date: Fri, 6 Jul 2001 11:55:06 +0200
Message-Id: <200107060939.LAA28121@bank.de>
To: ijs@decisionsoft.com
Cc: xmlschema-dev@w3.org

Hi,
one (beginner´s :-) question:
Are you allowed to put in the <attribute name=...> in element content?

-- snip------------------------------------------------------------
<group name="fooStyleX">
  <element name="foo">
    <attribute name="some_attr">
  </element>
</group>


or similar with the <group...> as element content:

--snip----------------------------
<element name="doc">
  <element name="a">
    <group ref="fooStyleX" />
  </element>


Or are you just leaving out some anonymous complexType "wrappers"
around this content? (Maybe that´s what you mean with "pseudo XSDL")

As I understand the Rec, element content is restricted to:

"(annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))"

Greetings
  Holger


_________________________

Holger Joukl
LBBW
2342 Z - IT/Org II Handel
Tel. +49 (711) 124 - 7078
_________________________


                                                                                                                                             
                    Ian Stokes-Rees                                                                                                          
                    <ijs@decisionsoft.        An:     Venkateswar Wunnava <wvsvenkat@worldnet.att.net>, wason@mindspring.com, Jeff Rafter    
                    com>                      <jeffrafter@definedweb.com>, xmlschema-dev@w3.org                                              
                    Gesendet von:             Kopie:                                                                                         
                    xmlschema-dev-requ        Thema:  Re: Global Vs Root Element.                                                            
                    est@w3.org                                                                                                               
                                                                                                                                             
                                                                                                                                             
                    06.07.01 11:02                                                                                                           
                                                                                                                                             
                                                                                                                                             




I have just realised that another side effect of using groups to wrap
single
elements allows one to have multiple elements with the same name made
available for referencing.  Imagine:

<doc>
 <a>
  <foo some_attr="..."/>
 </a>
 <b>
  <foo another_attr="..."/>
 </b>
 <c>
  <foo some_attr="..."/>
 </c>
</doc>

You may want the first and third "foo" to be the same and be placed inside
"a"
and "c" as references, however also place the second "foo" inside "b" by
reference.  This could be achieved by creating (as always, in pseudo XSDL):

<group name="fooStyleX">
  <element name="foo">
    <attribute name="some_attr">
  </element>
</group>

<group name="fooStyleY">
  <element name="foo">
    <attribute name="another_attr">
  </element>
</group>

<element name="doc">
  <element name="a">
    <group ref="fooStyleX" />
  </element>

  <element name="b">
    <group ref="fooStyleY" />
  </element>

  <element name="c">
    <group ref="fooStyleX" />
  </element>
</element>

Ian Stokes-Rees wrote:
>
> [I missed the first part of this thread, so appologies for any repeated
> information]
> [actually terminology discussion is in the second part of this email]
>
> Global Elements
> ---------------
> Global elements refer to elements defined as the immediate children of
the
> <schema> element in an XSDL document (a schema definition document).
These
> have three purposes:
>
> 1) to define elements which can be used be reference (i.e. <element
> ref="some_global_element" />) _within_ other element, group, or type
> definitons; and,
> 2) to define elements which can be legal document elements in instance
> documents; and,
> 3) to define elements which can be used in instance documents where the
> document's schema specifies <any> element may exist.
>
> If you wish to define an element to be used only for <element ref="..."/>
> purposes, the exact same semantics can be achieved by dropping this
element in
> a <group> element (I cannot take credit for this -- it was suggested to
me on
> this list some months ago).  The following pseudo XML/XSDL gives the
general
> idea:
>
> Instance:
>   <globalEle>
>     <refEle>
>   </globalEle>
>
> Schema Before:
>   <element name="refEle" type="myType" />
>   <element name="globalEle" >
>     <element ref="refEle" />
>   </element>
>
> After:
>   <group name="refEle">
>     <element name="refEle" type="myType" />
>   </group>
>   <element name="globalEle" >
>     <group ref="refEle" />
>   </element>
>
> With the first schema, the following document would be schema valid:
>
> <refEle />
>
> But this would not be legal with the second schema.  The only issue then
to
> decide on is the naming convention for the group.  There is no name
collision
> since groups are in a different space from global element names, so this
gives
> the "appearance" of an element ref to "refEle".  I am still undecided
about
> how "nice" it is to do this (have groups and elements with the same
name).  It
> may not be unreasonable if restricted to _only_ these circumstances.

--
Ian Stokes-Rees                       DecisionSoft Ltd.
Telephone: +44-1865-203192            http://www.decisionsoft.com




______________________________________________________________________


--------------------------------------------------------------------------------------------
Bitte beachten Sie, dass der Inhalt dieser E-Mail einschließlich eventuell
angehängter Dokumente vertraulich ist. Falls Sie nicht der angegebene
Empfänger sind oder falls diese E-Mail irrtümlich an Sie adressiert wurde,
dürfen Sie die E-Mail und eventuell angehängte Dokumente weder öffnen,
lesen, kopieren, verbreiten noch ihren Inhalt in irgendeiner Weise nutzen.
Bitte verständigen Sie den Absender sofort und löschen Sie Die E-Mail
sodann.

Die Sicherheit von Übermittlungen per E-Mail kann nicht garantiert werden.
Per E-Mail übermittelte Informationen können abgefangen oder geändert
werden, verloren gehen oder zerstört werden, verspätet oder unvollständig
ankommen, oder Viren enthalten. Der Absender übernimmt daher keine Gewähr
für Irrtümer oder Auslassungen jeder Art im Inhalt sowie sonstige Risiken,
die auf die Übermittlung per E-Mail zurückzuführen sind. Falls Sie eine
Bestätigung wünschen, fordern Sie bitte den Inhalt der E-Mail als Hardcopy
an.


This e-mail and any attached files are confidential. If you are not the
named addressee or if this transmission has been addressed to you in error,
any disclosure, reproduction, copying, distrubtion, or other dissemination
or use of this communication is prohibited. If you have received this
transmission in error please notify the sender immediately and then delete
this e-mail.

E-mail transmission cannot be guaranteed to be secure or free from error as
information could be intercepted, corrupted, lost, destroyed, arrive late
or incomplete, or contain viruses. The sender therefore does not accept
liability for any errors or omissions in the contents of this message or
any other of such risks which arise as a result of e-mail transmission. If
verification is required, please request a hard copy version.
---------------------------------------------------------------------------------------------
Received on Friday, 6 July 2001 05:57:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:22 GMT