KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xmlc > dom > xerces > XercesHTMLDomFactory


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: XercesHTMLDomFactory.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.xmlc.dom.xerces;
25
26 import org.enhydra.apache.html.dom.HTMLDocumentImpl;
27 import org.enhydra.xml.xmlc.XMLObject;
28 import org.enhydra.xml.xmlc.XMLObjectLink;
29 import org.enhydra.xml.xmlc.dom.HTMLDomFactoryMethods;
30 import org.enhydra.xml.xmlc.dom.XMLCDomFactory;
31 import org.w3c.dom.Document JavaDoc;
32 import org.w3c.dom.DocumentType JavaDoc;
33 import org.w3c.dom.Element JavaDoc;
34 import org.w3c.dom.html.HTMLDocument;
35
36 /**
37  * XMLC DOM factory for creating HTML Document objects based on the Xerces
38  * DOM.
39  */

40 public class XercesHTMLDomFactory extends XercesDomFactory
41                                   implements XMLCDomFactory {
42     // FIXME: deprecated in 4.0 beta 2, can be removed when object code
43
// compatibility XMLC 2.0.1 is no longer required. This was removed
44
// since generate a variable name to an inner class broke forte.
45
/**
46      * Class that adds XMLObjectLink support to the Xerces HTMLDocument.
47      * @deprecated Remains for compaitiblity with objects compiled
48      * with XMLC 2.0.1
49      */

50     public class LinkedXercesDocument extends HTMLDocumentImpl
51                                       implements XMLObjectLink {
52         /** Reference to XMLObject containing this Document. */
53         private XMLObject fXmlObjectLink;
54
55         /** Constructor */
56         public LinkedXercesDocument() {
57         }
58
59         /** @see XMLObjectLink#setXMLObject */
60         public void setXMLObject(XMLObject xmlObject) {
61             fXmlObjectLink = xmlObject;
62         }
63
64         /** @see XMLObjectLink#getXMLObject */
65         public XMLObject getXMLObject() {
66             return fXmlObjectLink;
67         }
68     }
69
70     /**
71      * This creates a Document object that extends the Xerces HTMLDocument
72      * class and implements XMLObjectLink.
73      * @see XMLCDomFactory#createDocument
74      */

75     public Document JavaDoc createDocument(String JavaDoc namespaceURI,
76                                    String JavaDoc qualifiedName,
77                                    DocumentType JavaDoc docType) {
78         HTMLDocument doc = new XercesLinkedHTMLDocument();
79
80         // This creates the document element.
81
doc.getDocumentElement();
82         return doc;
83     }
84
85     /**
86      * @see XMLCDomFactory#getMIMEType
87      */

88     public String JavaDoc getMIMEType() {
89         return "text/html";
90     }
91
92     /**
93      * @see XMLCDomFactory#getBaseClassName
94      */

95     public String JavaDoc getBaseClassName() {
96         return HTMLDomFactoryMethods.getBaseClassName();
97     }
98
99     /**
100      * @see XMLCDomFactory#getInterfaceNames
101      */

102     public String JavaDoc[] getInterfaceNames() {
103         return HTMLDomFactoryMethods.getInterfaceNames();
104     }
105
106     /**
107      * @see XMLCDomFactory#getElementClassNames
108      */

109     public String JavaDoc[] getElementClassNames(Element JavaDoc element) {
110         return HTMLDomFactoryMethods.getElementClassNames(element);
111     }
112
113     /**
114      * @see XMLCDomFactory#isURLAttribute
115      */

116     public boolean isURLAttribute(Element JavaDoc element,
117                                   String JavaDoc attrName) {
118         return HTMLDomFactoryMethods.isURLAttribute(element, attrName);
119     }
120 }
121
Popular Tags