schemaTypes.put("unsignedByte", new TypeEntry("L0.Byte", "Bindings.BYTE", "byte", "0","java.lang.Byte.parseByte(",")","java.lang.Byte.toString(",")"));
schemaTypes.put("long", new TypeEntry("L0.Long", "Bindings.LONG", "long", "0","java.lang.Long.parseLong(",")","java.lang.Long.toString(",")"));
schemaTypes.put("unsignedLong", new TypeEntry("L0.Long", "Bindings.LONG", "long", "0","java.lang.Long.parseLong(",")","java.lang.Long.toString(",")"));
- schemaTypes.put("base64Binary", new TypeEntry("L0.ByteArray", "Bindings.BYTE_ARRAY", "byte[]", "new byte[0]","java.util.Base64.getDecoder().decode(",")","java.util.Base64.getEncoder().encodeToString(",")"));
+ schemaTypes.put("base64Binary", new TypeEntry("L0.ByteArray", "Bindings.BYTE_ARRAY", "byte[]", "new byte[0]","java.util.Base64.getDecoder().decode(",".replaceAll(\"\\n\", \"\").getBytes(java.nio.charset.StandardCharsets.UTF_8))","java.util.Base64.getEncoder().encodeToString(",")"));
l0Types.put("doubleArray", new TypeEntry("L0.DoubleArray", "Bindings.DOUBLE_ARRAY", "double[]", null,null,null,"java.lang.Double.toString(",")"));
l0Types.put("stringArray", new TypeEntry("L0.StringArray", "Bindings.STRING_ARRAY", "string[]", null,null,null,"",""));
public static class Inheritance {
public String baseClass;
+ public String additionalClass;
public InheritanceType type;
public TypeEntry atomicType;
QName type = topLevelElement.getType();
if (!type.getNamespaceURI().equals(SCHEMA_NS)) {
SchemaObject obj = complexTypeName.get(type.getLocalPart());
- // if (obj == null)
- // obj = simpleTypeName.get(type.getLocalPart());
if (obj != null) {
inheritance.baseClass = getName(obj);
inheritance.type = InheritanceType.ComplexType;
}
+ else {
+ obj = simpleTypeName.get(type.getLocalPart());
+ if (obj != null)
+ getAtomicTypeInheritance(type, inheritance);
+ }
} else {
TypeEntry entry = getTypeEntry(type);
if (entry != null) {
ExtensionType extensionType = simpleContent.getExtension();
if (extensionType != null) {
type = extensionType.getBase();
+ SchemaObject simpleType = getSimpleType(type);
+ if (simpleType != null)
+ inheritance.additionalClass = getName(simpleType);
getAtomicTypeInheritance(type, inheritance);
}
}
*/
public void getAtomicTypeInheritance(QName type, Inheritance inheritance) {
if (!type.getNamespaceURI().equals(SCHEMA_NS)) {
- SchemaObject obj = getWithName(type);
- if (obj.getType() != ObjectType.SIMPLE_TYPE)
- throw new RuntimeException("SimpleContent does not use SimpleType definition");
+ SchemaObject obj = getSimpleType(type);
+ if (obj == null)
+ throw new RuntimeException("Cannot locate SimpleType " + type.getLocalPart());
SimpleType simpleType = obj.getSimpleType();
type = getSimpleTypeBase(simpleType);
getAtomicTypeInheritance(type, inheritance);