import java.io.PrintWriter;\r
import java.io.StringWriter;\r
import java.util.ArrayList;\r
-import java.util.HashMap;\r
import java.util.List;\r
import java.util.Map;\r
\r
import javax.xml.namespace.QName;\r
\r
import org.simantics.utils.datastructures.BijectionMap;\r
-import org.simantics.xml.sax.SchemaConversionBase.RefType;\r
import org.simantics.xml.sax.configuration.AttributeComposition;\r
import org.simantics.xml.sax.configuration.Configuration;\r
import org.simantics.xml.sax.configuration.IDProvider;\r
import org.simantics.xml.sax.configuration.IDReference;\r
-import org.simantics.xml.sax.configuration.Rename;\r
import org.simantics.xml.sax.configuration.UnrecognizedChildElement;\r
import org.w3._2001.xmlschema.Annotated;\r
import org.w3._2001.xmlschema.Attribute;\r
import org.w3._2001.xmlschema.AttributeGroup;\r
-import org.w3._2001.xmlschema.AttributeGroupRef;\r
import org.w3._2001.xmlschema.ComplexType;\r
import org.w3._2001.xmlschema.Element;\r
import org.w3._2001.xmlschema.LocalComplexType;\r
import org.w3._2001.xmlschema.LocalSimpleType;\r
import org.w3._2001.xmlschema.NamedAttributeGroup;\r
-import org.w3._2001.xmlschema.OpenAttrs;\r
import org.w3._2001.xmlschema.Restriction;\r
import org.w3._2001.xmlschema.Schema;\r
import org.w3._2001.xmlschema.SimpleType;\r
super(configuration);\r
}\r
\r
- public void createParser(Schema schema,String className, SchemaConverter converter) throws IOException {\r
+ public void createParser(Schema schema,String ontologyUri, String className, SchemaConverter converter) throws IOException {\r
this.schema = schema;\r
this.ontologyClassName = className;\r
this.converter = converter;\r
}\r
\r
protected void handle(TopLevelAttribute topLevelAttribute) {\r
-\r
}\r
\r
+ @Override\r
+ protected void handleSimpleType(SchemaObject parent, SchemaObject simpleTypeObj) {\r
+ }\r
\r
@Override\r
protected void handleComplexType(SchemaObject complexTypeObj) {\r
ComplexType topLevelComplexType = complexTypeObj.getComplexType();\r
\r
- String name = getName(complexTypeObj);//topLevelComplexType.getName();\r
+ String name = getName(complexTypeObj);\r
+ \r
+// if (topLevelComplexType.getName().equals("Reference"))\r
+// System.out.println();\r
\r
String className = name;//"_"+name;\r
\r
throw new RuntimeException(e);\r
}\r
writers.put(complexTypeObj, fw);\r
- \r
- boolean isList = false;\r
\r
- String baseClass = "org.simantics.xml.sax.base.XMLElementNamedChildParserBase";\r
+ String baseClass = getBaseClass();\r
\r
boolean inherited = false;\r
\r
QName type = getComplexTypeBase(topLevelComplexType);\r
if (type != null && !type.getNamespaceURI().equals("http://www.w3.org/2001/XMLSchema")) {\r
- baseClass = getName(complexTypeName.get(type.getLocalPart()));\r
- inherited = true;\r
+ SchemaObject obj = complexTypeName.get(type.getLocalPart());\r
+ if (obj != null) {\r
+ baseClass = getName(obj);\r
+ inherited = true;\r
+ }\r
}\r
\r
provider = getIDProvider(topLevelComplexType);\r
if (unknownChildElement != null)\r
intrerfaces.add("org.simantics.xml.sax.base.UnrecognizedElementParser");\r
\r
- createClassHeader(fw.writer, isList);\r
+ createClassHeader(fw.writer, false);\r
writeClass(fw.writer,false, null, className, baseClass, intrerfaces);\r
\r
writeIDProvider(fw.writer);\r
fw.writer.println(" public Resource create(WriteGraph graph, ParserElement element) throws DatabaseException{");\r
fw.writer.println(" Layer0 L0 = Layer0.getInstance(graph);");\r
fw.writer.println(" "+getOntologyImport());\r
- if (!isList) {\r
fw.writer.println(" Resource res = graph.newResource();");\r
fw.writer.println(" graph.claim(res, L0.InstanceOf, "+ontShort+name+");");\r
- } else {\r
- fw.writer.println(" Resource res = ListUtils.create(graph, "+ontShort+name+", Collections.EMPTY_LIST);");\r
- }\r
fw.writer.println(" return res;");\r
fw.writer.println(" }");\r
fw.writer.println();\r
}\r
\r
\r
- @Override\r
- protected void handleSimpleType(SchemaObject parent, SchemaObject simpleType) {\r
-\r
- }\r
+ \r
\r
\r
IDProvider provider;\r