Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - ID and IDREF >Thread Next - Re: ID and IDREF Re: ID and IDREFTo: NULL Date: 12/2/2007 2:30:00 PM
geoff wrote:
> Why does this not work:
>
> <billTo id="addr-1">
> <company>The Skateboard Warehouse</company>
> <street>One Warehouse Park</street>
> <street>Building 17</street>
> <city>Boston</city>
> <state>MA</state>
> <postalCode>01775</postalCode>
> </billTo>
>
> <shipTo href="addr-1"/>
>
> . . . billTo and shipTo are defined as the same in the schema and I included
> the following in the schema definition:
>
> <xsd:attribute name="id" type="xsd:ID"/>
> <xsd:attribute name="href" type="xsd:IDREF"/>
>
> . . . however, xml notepad says, 'the element shipTo has incomplete
> contents'. If I populate shipTo with the same info as billTo, it works fine
> but the referencing of billTo does not seem to work or is it a limitation of
> xml notepad?
If the schema for shipTo defines child elements then you have to include
those child elements literally. There is no way to include them using a
link mechanism, that is not how XSD schemas work.
All ID/IDREF allow you is to refer to other components for instance
<address id="addr1">
<company>The Skateboard Warehouse</company>
<street>One Warehouse Park</street>
<street>Building 17</street>
<city>Boston</city>
<state>MA</state>
<postalCode>01775</postalCode>
</address>
<billTo href="addr1"/>
<shipTo href="addr1"/>
but then the schema would not define child elements for billTo and
shipTo, it would just define the attribute and its type.
--
Martin Honnen
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
