| Author |
XSD Variable Attributes of Complex type,
|
Hendrik Louw
Greenhorn
Joined: Mar 01, 2007
Posts: 5
|
|
Hi All. We are defining an XSD to expose to the outside world. Part of the XSD defines which product you have selected. Now my problem is that altho all our products have a set of standard attributes which are shared, they each also have a set of specific attributes. Now depending on what "type" of product you select. I would like to use the XSD to validate that all the required attributes are on the XML for that paticular product. I've currently been able to do this via the following. This works, but unfortunatly it requires that you create an element of <ProductB> to add Speakers to the order, and <ProductA> element to add Headphones. (where each requires an additional attribute each) What I would like is to have a single <Product> element, with an attribute defining the type. Then according to the type validate that all the required attributes have been entered. So that would not validate, but Does. So far I haven't been able to find any way to do this. Any ideas ?
|
 |
Rahul Bhattacharjee
Ranch Hand
Joined: Nov 29, 2005
Posts: 2300
|
|
Sorry I could not understand the question fully. If you are saying that just for adding one attribute you have to make one more complexType then I would suggest you to extend the first complexType and add the new attribute to make a new complexType.
|
Rahul Bhattacharjee
LinkedIn - Blog
|
 |
 |
|
|
subject: XSD Variable Attributes of Complex type,
|
|
|