Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Another XML Schema one: Named local declarations, whar are their contents?

From: Tjerk Wolterink <tjerk@------------------.--->
To: NULL
Date: 9/4/2005 11:49:00 AM
Soren Kuula wrote:
> Hi, if I do:
> 
 > [cut]



The ref attribute of <xsd:element refers to
another element.

The name attribute of xsd:element declares the name of the element.


so:

<xsd:element name="a">

refers to

<a></a>  ( we did not specify type)



<xsd:element ref="a"> is a referention to element whose name is a.

So they are equal.


The ref attribute is here because know you don't have to define 
elements more than one time.

Example:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="tree">
	<xsd:complexType>
	<xsd:sequence>
	 <xsd:element ref="branch"/>
	</xsd:sequence>
	</xsd:complexType>
</xsd:element>

<xsd:element name="branch">
	<xsd:complexType>
	<xsd:choice>
	   <xsd:element ref="branch" maxOccurs="unbounded"/>
	   <xsd:element ref="leaf" maxOccurs="unbounded"/>
	</xsd:choice>
	</xsd:complexType>
</xsd:element>

<xsd:element name="leaf" type="xsd:string">
</xsd:element>

</xsd:schema>



Example document: (generated):
PS, i dont know why the leafs are between <!-- -->
:


<tree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="Untitled1.xsd">
     <branch>
         <branch>
             <branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch><!--
                 <leaf>string</leaf>-->
             </branch>
             <branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch><!--
                 <leaf>string</leaf>-->
             </branch><!--
             <leaf>string</leaf>-->
         </branch>
         <branch>
             <branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch><!--
                 <leaf>string</leaf>-->
             </branch>
             <branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch>
                 <branch><!--
                     <leaf>string</leaf>-->
                 </branch><!--
                 <leaf>string</leaf>-->
             </branch><!--
             <leaf>string</leaf>-->
         </branch><!--
         <leaf>string</leaf>-->
     </branch>
</tree>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent