String binding = getBindingFromPrimitiveType(base);\r
writeAttribute(fw, attrName, relationName, binding, isReference);\r
} else {\r
- throw new RuntimeException("Cannot resolve type for Attribute " + attrName + " -> " + primitiveType.getLocalPart());\r
+ //throw new RuntimeException("Cannot resolve type for Attribute " + attrName + " -> " + primitiveType.getLocalPart());\r
+ //writeAttribute(fw, attrName, relationName, binding, isReference);\r
}\r
}\r
\r
// FIXME : handle optional attributes properly.\r
for (org.simantics.xml.sax.configuration.Attribute a : composition.getAttribute()) {\r
Attribute attribute = ((Attribute)attributes.getRight(a));\r
- QName atype = getBaseType(attribute);\r
+ //QName atype = getBaseType(attribute);\r
+ QName atype = getPrimitiveType(attribute);\r
String defaultValue = attribute.getDefault();\r
if (defaultValue == null)\r
defaultValue = getDefaultValue(atype);\r
version = "1.0";\r
\r
name = name.replaceAll("\\.", "_");\r
+ name = name.replaceAll(" ", "_");\r
className = converter.getPluginName() + "." + name;\r
\r
for (String s : converter.getHeader()) {\r
protected void handleElement(SchemaObject elementObj) {\r
Element element = elementObj.getElement();\r
String name = getName(elementObj);//element.getName();\r
+ \r
+// if ("Presentation".equals(name))\r
+// System.out.println();\r
\r
// if (parent != null)\r
// name = parent +"_"+name;\r
return null;\r
}\r
\r
+ protected QName getPrimitiveType(Attribute attribute) {\r
+ QName type = getBaseType(attribute);\r
+ String b = getBindingFromPrimitiveType(type);\r
+ while (b==null && type != null) {\r
+ SchemaObject baseType = simpleTypeName.get(type.getLocalPart());\r
+ if (baseType != null) {\r
+ Restriction restriction = baseType.getSimpleType().getRestriction();\r
+ if (restriction != null)\r
+ if (restriction.getBase() != null) {\r
+ type = restriction.getBase();\r
+ b = getBindingFromPrimitiveType(type);\r
+ }\r
+ }\r
+ }\r
+ return type;\r
+ }\r
+ \r
protected Attribute getRefAttribute(QName ref) {\r
for (OpenAttrs attrs : schema.getSimpleTypeOrComplexTypeOrGroup()) {\r
if (attrs instanceof TopLevelAttribute) {\r