⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 o3saxreader.java

📁 Java的面向对象数据库系统的源代码
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.//// $Id: O3SAXReader.java,v 1.1 2003/07/12 12:13:06 per_nyfelt Exp $package org.ozoneDB.xml.dom4j.io;import org.dom4j.DocumentFactory;import org.dom4j.NodeFactory;import org.dom4j.XPathFactory;import org.dom4j.io.SAXContentHandler;import org.dom4j.io.SAXReader;import org.ozoneDB.OzoneInterface;import org.ozoneDB.OzoneRemoteException;import org.ozoneDB.xml.dom4j.OzoneDocumentFactory;import org.xml.sax.SAXException;import org.xml.sax.XMLReader;/** * $Id: O3SAXReader.java,v 1.1 2003/07/12 12:13:06 per_nyfelt Exp $ */public class O3SAXReader extends SAXReader {    OzoneInterface db;    public O3SAXReader(OzoneInterface db) {        this.db = db;    }    public O3SAXReader(OzoneInterface db, boolean validating) {        super(validating);        this.db = db;    }    public O3SAXReader(OzoneInterface db, OzoneDocumentFactory factory) {        super(factory);        this.db = db;    }    public O3SAXReader(OzoneInterface db, DocumentFactory factory, boolean validating) {        super(factory, validating);        this.db = db;    }    public O3SAXReader(OzoneInterface db, XMLReader xmlReader) {        super(xmlReader);        this.db = db;    }    public O3SAXReader(OzoneInterface db, XMLReader xmlReader, boolean validating) {        super(xmlReader, validating);        this.db = db;    }    public O3SAXReader(OzoneInterface db, String xmlReaderClassName) throws SAXException {        super(xmlReaderClassName);        this.db = db;    }    public O3SAXReader(OzoneInterface db, String xmlReaderClassName, boolean validating) throws SAXException {        super(xmlReaderClassName, validating);        this.db = db;    }/*    public DocumentFactory getDocumentFactory() {        try {            System.out.println("[O3SAXReader] getting factory for db " + db);            return OzoneDocumentFactoryImpl.getInstance(db);        } catch (Exception e) {            e.printStackTrace();            throw new OzoneRemoteException("Documentfactory not registered" + e.toString());        }    }*/    public DocumentFactory getDocumentFactory() {        throw new OzoneRemoteException("getDocumentFactory will not work in Ozone");    }    /** Factory Method to allow user derived SAXContentHandler objects to be used     * overridden since the super class is still using the deprecated getDocumentFactory()     */    protected SAXContentHandler createContentHandler(XMLReader reader) {        return new SAXContentHandler(                getNodeFactory(), getDispatchHandler()        );    }    public NodeFactory getNodeFactory() {        try {            // todo: might be faster to return super.getNodeFactory() if it is instanceof OzoneCompatible first            // before falling back to object for name look-up            return (NodeFactory) db.objectForName(OzoneDocumentFactory.OBJECT_NAME);        } catch (Exception e) {            throw new OzoneRemoteException("NodeFctory not registered" + e.toString());        }    }    protected XPathFactory getXPathFactory() {        try {            // todo: might be faster to return super.getXPathFactory() if it is instanceof OzoneCompatible first            // before falling back to object for name look-up            return (XPathFactory) db.objectForName(OzoneDocumentFactory.OBJECT_NAME);        } catch (Exception e) {            throw new OzoneRemoteException("XPathFactory not registered" + e.toString());        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -