Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML Schema - 1 Element, Different Attributes, Can One Create Multiple Types?

From: "Neil Smith [MVP Digital Media]" <neil@------.--->
To: NULL
Date: 7/2/2009 9:47:00 AM
On Wed, 1 Jul 2009 15:35:54 -0700 (PDT), MaggotChild
<hsomob1999@y...> wrote:

>On Jul 1, 7:57 am, "Neil Smith [MVP Digital Media]" <n...@nospam.com>
>wrote:
>> Hm I've had a think about this, and it's not obvious that XSD contains
>> the feature you want (referencing the content of an attribute to
>> determine the validation rule required)
>>
>> So it seems you may have to use a 2-pass approach.
>>
>> A way to consider it with XSL, would be to validate your primary
>> document structure first. Then transforming the doc to include
>> xsi:type based on each matching Detail node's Name attribute; and
>> finally validating using the xsi:type specified
>
>The problem is that cost is a required element.
>
><Detail Name="Cost" Value="25.99"/>
>
>becomes, say
>
><Detail Name="Cost" Value="25.99" xsi:type="Cost"/>
>
>How do I say a certain XSI type is required? I don't think I can.


A guy in a comment right at the bottom of this page
http://norman.walsh.name/2004/01/29/trainwreck
referred to a preceding comment stating XML schema or DTD can't do
this (a step matching your proposal) but RelaxNG can.

I don't know much about RelaxNG though.

It seems from the little I know about Schematron, that you may just be
able to embed the schematron rules in the XSD, then post-process
(again a second step) using a Schematron processor - I know there's a
class to do this I've seen written in PHP4 but not (so far) ported to
PHP5 or 6.

HTH
Cheers - Neil
------------------------------------------------
Digital Media MVP : 2004-2009
http://mvp.support.microsoft.com/mvpfaqs


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