*/
return new NodeFactory() {
private Element buffer = null;
private final Nodes NONE = new Nodes();
private final NodeBuilder nodeBuilder = new NodeBuilder();
public Nodes makeAttribute(String name, String namespace,
String value, Attribute.Type type) {
buffer.addAttribute(
nodeBuilder.createAttribute(name, namespace, value, type));
// buffer.addAttribute(
// new Attribute(name, namespace, value, type));
return NONE;
}
public Nodes makeComment(String data) {
flush();
try {
serializer.write(new Comment(data));
} catch (IOException e) {
throw new RuntimeException(e);
}
return NONE;
}
public Nodes makeDocType(String rootElementName, String publicID, String systemID) {
flush();
try {
serializer.write(new DocType(rootElementName, publicID, systemID));
} catch (IOException e) {
throw new RuntimeException(e);
}
return NONE;
}
public Nodes makeProcessingInstruction(String target, String data) {
flush();
try {
serializer.write(new ProcessingInstruction(target, data));
} catch (IOException e) {
throw new RuntimeException(e);
}
return NONE;
}
public Nodes makeText(String text) {
flush();
try {
serializer.write(new Text(text));
} catch (IOException e) {
throw new RuntimeException(e);
}
return NONE;
}
public Element startMakingElement(String name, String namespace) {
flush();
// buffer = new Element(name, namespace);
buffer = nodeBuilder.createElement(name, namespace);
return buffer;
}
public Nodes finishMakingElement(Element element) {
flush();