X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.xml.sax.base%2Fsrc%2Forg%2Fsimantics%2Fxml%2Fsax%2Fbase%2FXMLWriter.java;h=ce5cb90068aa16cedfa7483ae04d00dbeb0c4780;hb=c8ead11dcd815dc26885b2b8e866e4ac4e563ae5;hp=ac2d3682704f1962e8815744dd9ef6917ee2021a;hpb=854324972f1eef1c1ecef337146274c1428edeae;p=simantics%2Finterop.git diff --git a/org.simantics.xml.sax.base/src/org/simantics/xml/sax/base/XMLWriter.java b/org.simantics.xml.sax.base/src/org/simantics/xml/sax/base/XMLWriter.java index ac2d368..ce5cb90 100644 --- a/org.simantics.xml.sax.base/src/org/simantics/xml/sax/base/XMLWriter.java +++ b/org.simantics.xml.sax.base/src/org/simantics/xml/sax/base/XMLWriter.java @@ -163,8 +163,6 @@ public class XMLWriter { c = childWriterClass.getConstructor(); childWriter = c.newInstance(); } - //childWriter = childWriterClass.newInstance(); - namedWriters.put(childWriterClass, childWriter); } catch (IllegalAccessException|InstantiationException|NoSuchMethodException|SecurityException|InvocationTargetException e) { String err = "Error processing " + childWriterClass.getName() + " : element writers must have accessible constructor with ReadGraph parameter"; @@ -177,6 +175,7 @@ public class XMLWriter { childWriter = writers.get(type); } if (childWriter == null) { + // try child ontology/schema Resource type = graph.getSingleType(child.instance); Resource ontology = getOntology(type); if (ontology != null) { @@ -184,10 +183,12 @@ public class XMLWriter { if (xmlWriter != null) { childWriter = xmlWriter.writers.get(type); // wrap the child writer with namespace writer - if (childWriter instanceof XMLElementNamedChildWriter) { - childWriter = new XMLNSNamedChildWriter((XMLElementNamedChildWriter)childWriter, xmlWriter.schemaURI); - } else { - childWriter = new XMLNSElementWriter(childWriter, xmlWriter.schemaURI); + if (childWriter != null) { + if (childWriter instanceof XMLElementNamedChildWriter) { + childWriter = new XMLNSNamedChildWriter((XMLElementNamedChildWriter)childWriter, xmlWriter.schemaURI); + } else { + childWriter = new XMLNSElementWriter(childWriter, xmlWriter.schemaURI); + } } } }