Complex rules in XSD for elements sequence?

XML Schema 1.0 cannot handle this case. Schematron, on the other hand, translates your constraints directly, see a working/tested Schematron schema below:? Xml version="1.0" encoding="UTF-8"?

> X1 must be followed by X2 X2 must be followed by X3 X3 must be followed by X4 X4 must be followed by X2, X3, X4 or X5 X5 must be followed by X6 X6 can be followed by X2, X3, X4, X5 or X6 Sample embedded Schematron rules X1 must be followed by X2 X2 must be followed by X3 X3 must be followed by X4 X4 must be followed by X2, X3, X4 or X5 X5 must be followed by X6 X6 can be followed by X2, X3, X4, X5 or X6.

XML Schema 1.0 cannot handle this case. Schematron, on the other hand, translates your constraints directly, see a working/tested Schematron schema below: X1 must be followed by X2 X2 must be followed by X3 X3 must be followed by X4 X4 must be followed by X2, X3, X4 or X5 X5 must be followed by X6 X6 can be followed by X2, X3, X4, X5 or X6 XML Schema 1.1 will add assertion support but that has some limitations on the scope the assertion XPath applies to - you will need to place the assertions on the parent element of X1..X6. Note also that the Schematron rules can stay embedded in XML Schema inside xs:annotation/xs:appinfo and you should be able to validate against both the XML Schema and against the embedded Schematron rules.

Follow up after the OP comment An XML Schema embedding the above Schematron rules is below. This is a sample that defines an element test that can contain the X1..X6. Sample embedded Schematron rules X1 must be followed by X2 X2 must be followed by X3 X3 must be followed by X4 X4 must be followed by X2, X3, X4 or X5 X5 must be followed by X6 X6 can be followed by X2, X3, X4, X5 or X6 An instance document can look like below: The above is tested with oXygen XML Editor.

The instance associates the XML Schema also with the processing instruction to tell oXygen that the schema contains embedded Schematron rules. The validation is performed against both the XML Schema and against the Schematron rules.

I added the pattern element under my schema and define xml name space but it gives error or root element missing. – Bhushan Jun 26 '09 at 11:24 See the follow up in my answer for a complete working sample. – George Bina Jun 26 '09 at 12:01.

Anyhow, here's a stab at a solution, presuming X6 can be the terminal item and "OverallSequence" is the base element.

This is not working, its complaining about circular reference. As you can see fourthItem includes fourthChoice and then fourthChoice again includes fourthItem. Same is true for others as well.

– Bhushan Jun 26 '09 at 11:15.

Note also that the Schematron rules can stay embedded in XML Schema inside xs:annotation/xs:appinfo and you should be able to validate against both the XML Schema and against the embedded Schematron rules. An XML Schema embedding the above Schematron rules is below. This is a sample that defines an element test that can contain the X1..X6.

The above is tested with oXygen XML Editor. The instance associates the XML Schema also with the processing instruction to tell oXygen that the schema contains embedded Schematron rules. The validation is performed against both the XML Schema and against the Schematron rules.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions