Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Another XML Schema one: Named local declarations, whar are their contents? [Thread Next] Re: Another XML Schema one: Named local declarations, whar are their contents?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>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
