Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XML Schema - 1 Element, Different Attributes, Can One Create Multiple Types? >Thread Next - Re: XML Schema - 1 Element, Different Attributes, Can One Create Multiple Types? Re: XML Schema - 1 Element, Different Attributes, Can One Create Multiple Types?To: NULL Date: 7/1/2009 3:36:00 PM On Jul 1, 7:57=A0am, "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=3D"Cost" Value=3D"25.99"/>
becomes, say
<Detail Name=3D"Cost" Value=3D"25.99" xsi:type=3D"Cost"/>
How do I say a certain XSI type is required? I don't think I can.
> Or transforming the doc to a more element based structure
> <Detail><Added>{value</Added></Detail> then validating the result of
> that transformation using the Element name as usual.
That might be the only way to say that a certain element is required.
Creating a new structure that wont replacing the existing one sucks,
but it seems to be the only option.
> In either case, it seems your input XML document is designed to
> frustrate validation even though its a simple structure - if you have
> any influence on the input document, I'd consider restructuring it.
Yes, the design is horrible. I change it.
Thanks
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
