How to use alternatives in XML Schema 1.1

后端 未结 2 1879
猫巷女王i
猫巷女王i 2021-01-16 11:59

From everything I have read, the schema I have defined below should work (emphasis on alternatives). I get the following error: The \'http://www.w3.org/2001/XMLSchema:altern

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-16 12:41

    As Michael Kay has already pointed out, the most likely cause of your error message is that your unidentified XSD processor doesn't support XSD 1.1.

    But there are a other few issues that will cause problems for any conforming XSD 1.1 processor.

    • An XSD 1.1 processor will reject the attribute-value specification mixed="true" on any complex type with simple content. (A 1.0 processor may issue a warning, but otherwise 1.0 says just to ignore it.)

    • The second alternative in the element declaration for property assigns the type YearType to the element, but YearType is not derived from xs:string, the declared type of property, so it's not legal as a type alternative. Since two of your alternatives are derived from xs:string and one from xs:gYear, you need to specify something more general than xs:string as the declared type of property. Any of xs:anyType, xs:anySimpleType, or xs:anyAtomicType should do.

提交回复
热议问题