KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > quercus > lib > dom > QDOMFactory


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Sam
28  */

29
30 package com.caucho.quercus.lib.dom;
31
32 import com.caucho.xml.*;
33
34 import org.w3c.dom.*;
35 import org.xml.sax.SAXException JavaDoc;
36
37 import java.io.IOException JavaDoc;
38 import java.io.InputStream JavaDoc;
39
40 public class QDOMFactory
41   implements DOMFactory
42 {
43   public Attr createAttr(String JavaDoc name)
44   {
45     return new QAttr(name);
46   }
47
48   public Comment createComment()
49   {
50     return new QComment();
51   }
52
53   public Document createDocument()
54   {
55     return new QDocument();
56   }
57
58   public Document createDocument(DocumentType docType)
59   {
60     return new QDocument(docType);
61   }
62
63   public DocumentType createDocumentType(String JavaDoc qualifiedName)
64   {
65     return new QDocumentType(qualifiedName);
66   }
67
68   public DocumentType createDocumentType(String JavaDoc qualifiedName,
69                                          String JavaDoc publicId,
70                                          String JavaDoc systemId)
71   {
72     return new QDocumentType(qualifiedName, publicId, systemId);
73   }
74
75   public Element createElement(String JavaDoc name)
76   {
77     return new QElement(name);
78   }
79
80   public Element createElement(String JavaDoc name, String JavaDoc namespace)
81   {
82     return new QElement(name, namespace);
83   }
84
85   public EntityReference createEntityReference(String JavaDoc name)
86   {
87     return new QEntityReference(name);
88   }
89
90   public ProcessingInstruction createProcessingInstruction(String JavaDoc name)
91   {
92     return new QProcessingInstruction(name);
93   }
94
95   public Text createText()
96   {
97     return new QText();
98   }
99
100   public org.w3c.dom.DOMImplementation JavaDoc getImplementation()
101   {
102     return new QDOMImplementation();
103   }
104
105   public void parseXMLDocument(Document document, InputStream JavaDoc is, String JavaDoc path)
106     throws IOException JavaDoc, SAXException JavaDoc
107   {
108     Xml xml = new Xml();
109     xml.parseDocument((QDocument) document, is, path);
110   }
111
112   public void parseHTMLDocument(Document document, InputStream JavaDoc is, String JavaDoc path)
113     throws IOException JavaDoc, SAXException JavaDoc
114   {
115     Html html = new Html();
116     html.parseDocument((QDocument) document, is, path);
117   }
118 }
119
Popular Tags