- throw new DatabaseException("Cannot locate writer for " + NameUtils.getSafeName(graph, child.instance) + ", " + child.instance);\r
+ // try child ontology/schema\r
+ Resource type = graph.getSingleType(child.instance);\r
+ Resource ontology = getOntology(type);\r
+ if (ontology != null) {\r
+ XMLWriter xmlWriter = subWriters.get(ontology);\r
+ if (xmlWriter != null) {\r
+ childWriter = xmlWriter.writers.get(type);\r
+ // wrap the child writer with namespace writer\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
+ if (childWriter == null)\r
+ throw new DatabaseException("Cannot locate writer for " + NameUtils.getSafeName(graph, child.instance) + ", " + child.instance);\r