c = childWriterClass.getConstructor();\r
childWriter = c.newInstance();\r
}\r
- //childWriter = childWriterClass.newInstance();\r
- \r
namedWriters.put(childWriterClass, childWriter);\r
} catch (IllegalAccessException|InstantiationException|NoSuchMethodException|SecurityException|InvocationTargetException e) {\r
String err = "Error processing " + childWriterClass.getName() + " : element writers must have accessible constructor with ReadGraph parameter";\r
childWriter = writers.get(type);\r
}\r
if (childWriter == null) {\r
+ // try child ontology/schema\r
Resource type = graph.getSingleType(child.instance);\r
Resource ontology = getOntology(type);\r
if (ontology != null) {\r
if (xmlWriter != null) {\r
childWriter = xmlWriter.writers.get(type);\r
// wrap the child writer with namespace writer\r
- if (childWriter instanceof XMLElementNamedChildWriter) {\r
- childWriter = new XMLNSNamedChildWriter((XMLElementNamedChildWriter)childWriter, xmlWriter.schemaURI);\r
- } else {\r
- childWriter = new XMLNSElementWriter(childWriter, xmlWriter.schemaURI);\r
+ if (childWriter != null) {\r
+ if (childWriter instanceof XMLElementNamedChildWriter) {\r
+ childWriter = new XMLNSNamedChildWriter((XMLElementNamedChildWriter)childWriter, xmlWriter.schemaURI);\r
+ } else {\r
+ childWriter = new XMLNSElementWriter(childWriter, xmlWriter.schemaURI);\r
+ }\r
}\r
}\r
}\r