package org.simantics.xml.sax.base; import java.util.Collection; import java.util.Set; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Statement; import org.simantics.db.exception.DatabaseException; public class XMLNSElementWriter implements XMLElementWriter{ XMLElementWriter writer; String ns; public XMLNSElementWriter(XMLElementWriter writer, String ns) { this.writer = writer; this.ns = ns; } @Override public void start(ReadGraph graph, WriterElement instance, XMLStreamWriter writer) throws XMLStreamException, DatabaseException { this.writer.start(graph, instance, writer); writer.writeNamespace("", ns); } @Override public void attributes(ReadGraph graph, WriterElement instance, Collection attributes, XMLStreamWriter writer) throws XMLStreamException, DatabaseException { this.writer.attributes(graph, instance, attributes, writer); } @Override public void characters(ReadGraph graph, WriterElement instance, XMLStreamWriter writer) throws XMLStreamException, DatabaseException { this.writer.characters(graph, instance, writer); } @Override public void children(ReadGraph graph, WriterElement instance, Set writer) throws XMLStreamException, DatabaseException { this.writer.children(graph, instance, writer); } @Override public void end(ReadGraph graph, WriterElement instance, XMLStreamWriter writer) throws XMLStreamException, DatabaseException { this.writer.end(graph, instance, writer); } @Override public String getElementId() { return writer.getElementId(); } @Override public Resource getType(ReadGraph graph) throws DatabaseException { return writer.getType(graph); } }