//getNamespaceContext() method to get the current context of namespace declarations.
//so we should be using getNamespaces() to write namespace declarations for this START_ELEMENT
Iterator iterator = startElement.getNamespaces();
while(iterator.hasNext()){
Namespace namespace = (Namespace)iterator.next();
fStreamWriter.writeNamespace(namespace.getPrefix(), namespace.getNamespaceURI());
}
//REVISIT: What about writing attributes ?
Iterator attributes = startElement.getAttributes();
while(attributes.hasNext()){
Attribute attribute = (Attribute)attributes.next();
QName aqname = attribute.getName();
fStreamWriter.writeAttribute(aqname.getPrefix(), aqname.getNamespaceURI(), aqname.getLocalPart(),attribute.getValue());
}
break;
}
case XMLEvent.NAMESPACE:{
Namespace namespace = (Namespace)xMLEvent;
if (DEBUG)System.out.println("Adding namespace = " + namespace.toString());
fStreamWriter.writeNamespace(namespace.getPrefix(), namespace.getNamespaceURI());
break ;
}
case XMLEvent.COMMENT: {
Comment comment = (Comment)xMLEvent ;
if (DEBUG)System.out.println("Adding comment = " + comment.toString());