001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Sam
028: */
029:
030: package com.caucho.quercus.lib.dom;
031:
032: import com.caucho.xml.*;
033:
034: import org.w3c.dom.*;
035: import org.xml.sax.SAXException;
036:
037: import java.io.IOException;
038: import java.io.InputStream;
039:
040: public class QDOMFactory implements DOMFactory {
041: public Attr createAttr(String name) {
042: return new QAttr(name);
043: }
044:
045: public Comment createComment() {
046: return new QComment();
047: }
048:
049: public Document createDocument() {
050: return new QDocument();
051: }
052:
053: public Document createDocument(DocumentType docType) {
054: return new QDocument(docType);
055: }
056:
057: public DocumentType createDocumentType(String qualifiedName) {
058: return new QDocumentType(qualifiedName);
059: }
060:
061: public DocumentType createDocumentType(String qualifiedName,
062: String publicId, String systemId) {
063: return new QDocumentType(qualifiedName, publicId, systemId);
064: }
065:
066: public Element createElement(String name) {
067: return new QElement(name);
068: }
069:
070: public Element createElement(String name, String namespace) {
071: return new QElement(name, namespace);
072: }
073:
074: public EntityReference createEntityReference(String name) {
075: return new QEntityReference(name);
076: }
077:
078: public ProcessingInstruction createProcessingInstruction(String name) {
079: return new QProcessingInstruction(name);
080: }
081:
082: public Text createText() {
083: return new QText();
084: }
085:
086: public org.w3c.dom.DOMImplementation getImplementation() {
087: return new QDOMImplementation();
088: }
089:
090: public void parseXMLDocument(Document document, InputStream is,
091: String path) throws IOException, SAXException {
092: Xml xml = new Xml();
093: xml.parseDocument((QDocument) document, is, path);
094: }
095:
096: public void parseHTMLDocument(Document document, InputStream is,
097: String path) throws IOException, SAXException {
098: Html html = new Html();
099: html.parseDocument((QDocument) document, is, path);
100: }
101: }
|