1 package org.simantics.xml.sax;
\r
3 import org.w3._2001.xmlschema.Any;
\r
4 import org.w3._2001.xmlschema.Element;
\r
5 import org.w3._2001.xmlschema.Group;
\r
7 public class SchemaElement {
\r
9 public enum ElementType{CHOICE,SEQUENCE,ALL,ANY,ELEMENT,NAMED_GROUP, GROUP_REF}
\r
11 private Group gelement;
\r
12 private Any aelement;
\r
13 private Element eelement;
\r
14 private MultiplicityRestriction restriction;
\r
15 private SchemaElement.ElementType type;
\r
17 private SchemaElement parent;
\r
19 public SchemaElement(Group element, ElementType indicator) {
\r
20 this.gelement = element;
\r
21 this.type = indicator;
\r
22 this.restriction = new MultiplicityRestriction(element);
\r
25 public SchemaElement(Any element, ElementType indicator) {
\r
26 this.aelement = element;
\r
27 this.type = indicator;
\r
28 this.restriction = new MultiplicityRestriction(element);
\r
31 public SchemaElement(Element element, ElementType indicator) {
\r
32 this.eelement = element;
\r
33 this.type = indicator;
\r
34 this.restriction = new MultiplicityRestriction(element);
\r
37 public SchemaElement(SchemaElement parent, Group element, ElementType indicator) {
\r
38 this.parent = parent;
\r
39 this.gelement = element;
\r
40 this.type = indicator;
\r
41 this.restriction = new MultiplicityRestriction(element);
\r
44 public SchemaElement(SchemaElement parent, Any element, ElementType indicator) {
\r
45 this.parent = parent;
\r
46 this.aelement = element;
\r
47 this.type = indicator;
\r
48 this.restriction = new MultiplicityRestriction(element);
\r
51 public SchemaElement(SchemaElement parent, Element element, ElementType indicator) {
\r
52 this.parent = parent;
\r
53 this.eelement = element;
\r
54 this.type = indicator;
\r
55 this.restriction = new MultiplicityRestriction(element);
\r
58 public Group getGroup() {
\r
62 public Any getAny() {
\r
66 public Element getElement() {
\r
70 public MultiplicityRestriction getRestriction() {
\r
74 public ElementType getType() {
\r
78 public SchemaElement getParent() {
\r
83 public boolean order() {
\r
84 if (type == ElementType.ELEMENT) {
\r
85 if (restriction.many())
\r
89 if (type == ElementType.SEQUENCE)
\r
94 public boolean many() {
\r
95 if (restriction.many())
\r
98 return parent.many();
\r