- From: Ernesto Wandeler <ernesto@wandeler.ch>
- Date: Mon, 02 Dec 2002 10:23:30 -0800
- To: xmlschema-dev@w3.org
Hi i am currently defining an XML Schema for a programming language which is represented in XML and which was already used for some time without any DTD or XML Schema. now i would like to know whether it is possible to define the complexType of an element depending on the value of an attribute of the element? for example i have an element named <Expr> with an attribute named "kind" and if "kind" equals "UnaryOp" then it must contain one <Op> element and one <Expr> element. but if "kind" equals "BinaryOp" then it must contain one <Expr> element followed by any number of <Op> and <Expr> comibinations. the XML could look for example like this: <Expr kind="BinOpSeq"> <Expr kind="UnaryOp"> <Op name="dom"/> <Expr kind="Var" name="a"/> </Expr> <Op name="!="/> <Expr kind="Set"/> <Op name="or"/> <Expr kind="UnaryOp"> <Op name="dom"/> <Expr kind="Var" name="s"/> </Expr> <Op name="!="/> <Expr kind="Set"/> </Expr> i think i could use a number of complexTypes inside a choice element but then how could i link the choice to the attribute value of the parent element? thank you very much for any help! cheers ernesto -- ---------------------------------------------------------------------- Ernesto Wandeler Department of Electrical Engineering and Computer Science University of California at Berkeley 545M Cory Hall Berkeley, CA 94720-1770 USA Work: +1 510 642 6873 Home: +1 510 898 1565 Mobile: +41 76 349 4972 E-Mail: ernesto@wandeler.ch ----------------------------------------------------------------------
Received on Monday, 2 December 2002 13:25:04 UTC