/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
*
* @author Neeraj Bajaj, Sun Microsystems.
*
*/
//delegate everything to XMLStreamWriter..
private static final boolean DEBUG = false;
/**
*
* @param streamWriter
*/
}
/**
*
* @param xMLEventReader
* @throws XMLStreamException
*/
public void add(javax.xml.stream.XMLEventReader xMLEventReader) throws javax.xml.stream.XMLStreamException {
while(xMLEventReader.hasNext()){
}
}
/**
*
* @param xMLEvent
* @throws XMLStreamException
*/
public void add(javax.xml.stream.events.XMLEvent xMLEvent) throws javax.xml.stream.XMLStreamException {
switch(type){
break;
}
case XMLEvent.START_DOCUMENT :{
try {
fStreamWriter.writeStartDocument(startDocument.getCharacterEncodingScheme(), startDocument.getVersion());
}catch(XMLStreamException e) {
}
break;
}
case XMLEvent.START_ELEMENT :{
//getNamespaces() Returns an Iterator of namespaces declared on this element. This Iterator does not contain
//previously declared namespaces unless they appear on the current START_ELEMENT. Therefore
//this list may contain redeclared namespaces and duplicate namespace declarations. Use the
//getNamespaceContext() method to get the current context of namespace declarations.
//so we should be using getNamespaces() to write namespace declarations for this START_ELEMENT
}
//REVISIT: What about writing attributes ?
while(attributes.hasNext()){
fStreamWriter.writeAttribute(aqname.getPrefix(), aqname.getNamespaceURI(), aqname.getLocalPart(),attribute.getValue());
}
break;
}
break ;
}
break;
}
case XMLEvent.PROCESSING_INSTRUCTION:{
if (DEBUG)System.out.println("Adding processing instruction = " + processingInstruction.toString());
fStreamWriter.writeProcessingInstruction(processingInstruction.getTarget(), processingInstruction.getData());
break;
}
case XMLEvent.CHARACTERS:{
//check if the CHARACTERS are CDATA
if(characters.isCData()){
}
else{
}
break;
}
case XMLEvent.ENTITY_REFERENCE:{
break;
}
fStreamWriter.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(),attribute.getValue());
break;
}
//there is no separate CDATA datatype but CDATA event can be reported
//by using vendor specific CDATA property.
if(characters.isCData()){
}
break;
}
//xxx: Why there isn't any event called Notation.
//case XMLEvent.NOTATION_DECLARATION:{
//}
case XMLEvent.END_ELEMENT:{
//we dont need to typecast it.. just call writeEndElement() and fStreamWriter will take care of it.
//EndElement endElement = (EndElement)xMLEvent;
break;
}
case XMLEvent.END_DOCUMENT:{
//we dont need to typecast just call writeEndDocument() and fStreamWriter will take care rest.
//EndDocument endDocument = (EndDocument)xMLEvent;
break;
}
//throw new XMLStreamException("Unknown Event type = " + type);
};
}
/**
*
* @throws XMLStreamException
*/
}
/**
*
* @throws XMLStreamException will inturn call flush on the stream to which data is being
* written.
*/
}
/**
*
* @return
*/
return fStreamWriter.getNamespaceContext();
}
/**
*
* @param namespaceURI Namespace URI
* @throws XMLStreamException
* @return prefix associated with the URI.
*/
}
/**
*
* @param uri Namespace URI
* @throws XMLStreamException
*/
}
/**
*
* @param namespaceContext Namespace Context
* @throws XMLStreamException
*/
public void setNamespaceContext(javax.xml.namespace.NamespaceContext namespaceContext) throws javax.xml.stream.XMLStreamException {
}
/**
*
* @param prefix namespace prefix associated with the uri.
* @param uri Namespace URI
* @throws XMLStreamException
*/
}
}//XMLEventWriterImpl