if (DEBUG)System.out.println("Adding processing instruction = " + processingInstruction.toString());
fStreamWriter.writeProcessingInstruction(processingInstruction.getTarget(), processingInstruction.getData());
break;
}
case XMLEvent.CHARACTERS:{
Characters characters = xMLEvent.asCharacters();
if (DEBUG)System.out.println("Adding characters = " + characters.toString());
//check if the CHARACTERS are CDATA
if(characters.isCData()){
fStreamWriter.writeCData(characters.getData());
}
else{
fStreamWriter.writeCharacters(characters.getData());
}
break;
}
case XMLEvent.ENTITY_REFERENCE:{
EntityReference entityReference = (EntityReference)xMLEvent ;
if (DEBUG)System.out.println("Adding Entity Reference = "+ entityReference.toString());
fStreamWriter.writeEntityRef(entityReference.getName());
break;
}
case XMLEvent.ATTRIBUTE:{
Attribute attribute = (Attribute)xMLEvent;
if (DEBUG)System.out.println("Adding Attribute = " + attribute.toString());
QName qname = attribute.getName();
fStreamWriter.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(),attribute.getValue());
break;
}
case XMLEvent.CDATA:{
//there is no separate CDATA datatype but CDATA event can be reported
//by using vendor specific CDATA property.
Characters characters = (Characters)xMLEvent;
if (DEBUG)System.out.println("Adding characters = " + characters.toString());
if(characters.isCData()){
fStreamWriter.writeCData(characters.getData());
}
break;
}
//xxx: Why there isn't any event called Notation.
//case XMLEvent.NOTATION_DECLARATION:{