case XMLEvent.END_ELEMENT:
writer.writeEndElement();
break;
case XMLEvent.NAMESPACE: {
Namespace ns = (Namespace) event;
writer.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
break;
}
case XMLEvent.START_ELEMENT: {
StartElement se = event.asStartElement();
QName n = se.getName();
writer.writeStartElement(n.getPrefix(), n.getLocalPart(),
n.getNamespaceURI());
Iterator it = se.getNamespaces();
while (it.hasNext()) {
Namespace ns = (Namespace) it.next();
writer.writeNamespace(ns.getPrefix(), ns.getNamespaceURI());
}
it = se.getAttributes();
while (it.hasNext()) {
Attribute attr = (Attribute) it.next();
QName name = attr.getName();