org.jvnet.jaxbcommons.runtime.ContentHandlerAdaptor Maven / Gradle / Ivy
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.6-01/24/2006 06:15 PM(kohsuke)-fcs
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2006.07.10 at 02:12:40 PM CEST
//
package org.jvnet.jaxbcommons.runtime;
import java.util.ArrayList;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
/**
* Receives SAX2 events and send the equivalent events to
* {@link com.sun.xml.bind.serializer.XMLSerializer}
*
* @author
* Kohsuke Kawaguchi ([email protected])
*/
public class ContentHandlerAdaptor implements ContentHandler {
/** Stores newly declared prefix-URI mapping. */
private final ArrayList prefixMap = new ArrayList();
/** Events will be sent to this object. */
private final XMLSerializer serializer;
private final StringBuffer text = new StringBuffer();
public ContentHandlerAdaptor( XMLSerializer _serializer ) {
this.serializer = _serializer;
}
public void startDocument() throws SAXException {
prefixMap.clear();
}
public void endDocument() throws SAXException {
}
public void startPrefixMapping(String prefix, String uri) throws SAXException {
prefixMap.add(prefix);
prefixMap.add(uri);
}
public void endPrefixMapping(String prefix) throws SAXException {
}
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
throws SAXException {
flushText();
int len = atts.getLength();
serializer.startElement(namespaceURI,localName);
// declare namespace events
for( int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy