From fb01c21839aea801224aeb82b64bd261120619d5 Mon Sep 17 00:00:00 2001 From: luukkainen Date: Mon, 30 Jan 2017 11:04:51 +0000 Subject: [PATCH] Export XML Namespaces refs #6985 git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@33441 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/org/simantics/xml/sax/base/XMLWriter.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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); + } } } } -- 2.47.1