]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.xml.sax/src/org/simantics/xml/sax/SchemaConversionBase.java
Schema conversion changes
[simantics/interop.git] / org.simantics.xml.sax / src / org / simantics / xml / sax / SchemaConversionBase.java
index f349cde8960667c3ac33004c6fd1c5d62c538c5f..863162c2ca873ad5d8180a69524fda1a22a73360 100644 (file)
@@ -111,7 +111,7 @@ public final class SchemaConversionBase {
                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,"",""));
@@ -1469,9 +1469,9 @@ public final class SchemaConversionBase {
         */
        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);