开发者

XSD for Element Or OtherElement Or Text

I need an开发者_如何学JAVA XSD for the following construct:

Expression := <FunctionCall> | <OperatorConstruct> | <Variable> | Constant_Text

In other words, the Expression type consist of a choice between 3 other types and a text.

I know there is a xs:Choice element, but I can't figure out how to write the 'Or Text' part. Simply using mixed=true on the Expression element allows to enter text AND other elements, but I would like to limit to only one from those four.

So the question is, what xsd can I define that allows one of three elements or a text?


If you want your structure validated by an XML Schema, you'll have to make all four choices into elements. MathML expressions work that way, with elements for every term.

Or you could go with mixed and validate the structure outside of XSD (with XSLT or Schematron or your own parsing code).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜