Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Maintaining a subset of a schema

From: Boris Kolpackov <boris@-------------.--->
To: Andy Den Tandt <andydt@-------.-->
Date: 8/3/2007 11:31:00 AM
Hi Andy,

Andy Den Tandt <andydt@e...> writes:

> <a u='0'>
>    <b v='1'>
>        <c w='2'/>
>    </b>
> </a>
>
> and the same but without the a/b@v attribute
> <a u='0'>
>    <b>
>        <c w='2'/>
>    </b>
> </a>
>
> The c-element can be shared. It's obvious that b is a separate type. But
> the type for a also needs to change!

I don't think there is a way to achieve what you want without
syntactic changes to your XML documents except for maintaining
two separate schemas (perhaps you can factor out and reuse some
common types that are the same for both vocabularies). Or maybe
you could use the redefine construct (I personally prefer to
stay away from that beast).

If you are willing to change your XML vocabulary then you can
can use XML Schema polymorphism (either xsi:type or substitution
groups). You would define a base type for the 'b' element (say,
b_base_t) which does not contain the 'v' attribute. Then you would
define b_t by adding the 'v' attribute to b_base_t. Using the
xsi:type approach your first XML document would look like this:

<a u='0'>
   <b v='1' xsi:type="b_t">
       <c w='2'/>
   </b>
</a>

With substitution groups you can embed the type information into
element names, e.g.:

<a u='0'>
   <b v='1'>
       <c w='2'/>
   </b>
</a>

<a u='0'>
   <basic_b>
       <c w='2'/>
   </basic_b>
</a>


hth,
-boris

-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding

From Webb.Roberts@g... Fri Aug 03 14:29:00 2007
Received: from lisa.w3.org ([128.30.52.41])
	by frin


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