用Java写的面相对象的数据库管理系统

源代码在线查看: cxmlcontenthandler.java

软件大小: 3066 K
上传用户: xufengping716
关键词: Java 对象 数据库管理系统
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*				 *  $Id: CXMLContentHandler.java,v 1.5 2000/11/08 16:31:17 conny Exp $				 *				 *  This code was part of the prove of concept of a binary representation of XML				 *  called CXML send to the Cocoon users list by Stefano Mazzocchi.				 */								package org.ozoneDB.xml.util;								import java.io.OutputStream;				import java.io.IOException;				import java.io.Serializable;								import org.xml.sax.SAXException;				import org.xml.sax.ContentHandler;				import org.xml.sax.Attributes;				import org.xml.sax.Locator;												/**				 */				class CXMLContentHandler implements ContentHandler, Serializable {				    				    public final static boolean debug = false;				    				    public final static int START_DOCUMENT = 0;				    public final static int END_DOCUMENT = 1;				    public final static int START_PREFIX_MAPPING = 2;				    public final static int END_PREFIX_MAPPING = 3;				    public final static int START_ELEMENT = 4;				    public final static int END_ELEMENT = 5;				    public final static int CHARACTERS = 6;				    public final static int IGNORABLE_WHITESPACE = 7;				    public final static int PROCESSING_INSTRUCTION = 8;				    				    private final CompiledXMLOutputStream out;				    				    				    public CXMLContentHandler( OutputStream stream ) throws IOException{				        out = new CompiledXMLOutputStream( stream );				    }				    				    				    public void startDocument() throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": startDocument()");				        }				        try {				            out.writeEvent( START_DOCUMENT );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void endDocument() throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": endRuntime()");				        }				        try {				            out.writeEvent( END_DOCUMENT );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void startPrefixMapping( java.lang.String prefix, java.lang.String uri ) throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": startPrefixMapping(...)");				        }				        try {				            out.writeEvent( START_PREFIX_MAPPING );				            out.writeString( prefix );				            out.writeString( uri );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void endPrefixMapping( java.lang.String prefix ) throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": endPrefixMapping(...)");				        }				        try {				            out.writeEvent( END_PREFIX_MAPPING );				            out.writeString( prefix );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void startElement( java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName,				            Attributes atts ) throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": startElement(...)");				        }				        try {				            int length = atts.getLength();				            out.writeEvent( START_ELEMENT );				            out.writeAttributes( length );				            for (int i = 0; i < length; i++) {				                out.writeString( atts.getURI( i ) );				                out.writeString( atts.getLocalName( i ) );				                out.writeString( atts.getQName( i ) );				                out.writeString( atts.getType( i ) );				                out.writeString( atts.getValue( i ) );				            } 				            out.writeString( namespaceURI );				            out.writeString( localName );				            out.writeString( qName );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void endElement( java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName ) 				            throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": endElement(...)");				        }				        try {				            out.writeEvent( END_ELEMENT );				            out.writeString( namespaceURI );				            out.writeString( localName );				            out.writeString( qName );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void characters( char[] ch, int start, int length ) throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": characters(...)");				        }				        try {				            out.writeEvent( CHARACTERS );				            out.writeChars( ch, start, length );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void ignorableWhitespace( char[] ch, int start, int length ) throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": ignorableWhitespace(...)");				        }				        try {				            out.writeEvent( IGNORABLE_WHITESPACE );				            out.writeChars( ch, start, length );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void processingInstruction( java.lang.String target, java.lang.String data ) throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": processingInstruction(...)");				        }				        try {				            out.writeEvent( PROCESSING_INSTRUCTION );				            out.writeString( target );				            out.writeString( data );				        } catch (Exception e) {				            throw new SAXException( e );				        } 				    } 				    				    				    public void setDocumentLocator( Locator locator ) {				    // ignore.				    } 				    				    				    public void skippedEntity( java.lang.String name ) throws SAXException {				        if (debug) {				            System.out.println(this.getClass().getName() + ": skippedEntity(...)[ignored]");				        }				    // ignore.				    } 				}							

相关资源