package org.simantics.xml.sax;
import org.simantics.xml.sax.configuration.Rename;
+import org.w3._2001.xmlschema.Attribute;
import org.w3._2001.xmlschema.AttributeGroup;
import org.w3._2001.xmlschema.AttributeGroupRef;
import org.w3._2001.xmlschema.ComplexType;
import org.w3._2001.xmlschema.SimpleType;
public class SchemaObject {
- enum ObjectType{ELEMENT,COMPLEX_TYPE,SIMPLE_TYPE,ATTRIBUTE_GROUP,MODEL_GROUP};
+ enum ObjectType{ELEMENT,COMPLEX_TYPE,SIMPLE_TYPE,ATTRIBUTE_GROUP,MODEL_GROUP,ATTRIBUTE};
private SchemaConversionBase sc;
private String name;
this(sc,null, namedGroup);
}
+ public SchemaObject(SchemaConversionBase sc, Attribute attribute) {
+ this(sc,null, attribute);
+ }
+
public SchemaObject(SchemaConversionBase sc,SchemaObject parent, Element element) {
this.parent = parent;
this.obj = element;
_init();
}
+ public SchemaObject(SchemaConversionBase sc,SchemaObject parent, Attribute attribute) {
+ this.parent = parent;
+ this.obj = attribute;
+ this.type = ObjectType.ATTRIBUTE;
+ this.sc = sc;
+ _init();
+ }
+
private void _init() {
name = _getName();
if (name != null)
return (NamedGroup)obj;
}
+ public Attribute getAttribute() {
+ if (type != ObjectType.ATTRIBUTE)
+ return null;
+ return (Attribute)obj;
+ }
+
public SchemaObject getParent() {
return parent;
}
return ((Element)obj).getName();
case SIMPLE_TYPE:
return ((SimpleType)obj).getName();
+ case ATTRIBUTE:
+ return ((Attribute)obj).getName();
}
throw new RuntimeException("Unknown object type " + type);
}