KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xhtml > dom > xerces > XHTMLScriptElementImpl


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 Original Code is DigitalSesame
15  * Portions created by DigitalSesame are Copyright (C) 1997-2000 DigitalSesame
16  * All Rights Reserved.
17  *
18  * Contributor(s):
19  * Rex Tsai <chihchun@digitalsesame.com>
20  * David Li <david@digitalsesam.com>
21  *
22  * $Id: XHTMLScriptElementImpl.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
23  */

24
25 package org.enhydra.xml.xhtml.dom.xerces;
26
27 import org.w3c.dom.Node JavaDoc;
28 import org.w3c.dom.Text JavaDoc;
29
30 public class XHTMLScriptElementImpl
31     extends XHTMLElementImpl
32     implements org.enhydra.xml.xhtml.dom.XHTMLScriptElement
33 {
34
35     public XHTMLScriptElementImpl (XHTMLDocumentBase owner, String JavaDoc namespaceURI, String JavaDoc tagName) {
36     super( owner, namespaceURI, tagName);
37     }
38
39         public void setId (String JavaDoc newValue) {
40     setAttribute("id", newValue);
41     }
42
43     public String JavaDoc getId () {
44     return getAttribute ("id");
45     }
46     public void setLang (String JavaDoc newValue) {
47     setAttribute("lang", newValue);
48     }
49
50     public String JavaDoc getLang () {
51     return getAttribute ("lang");
52     }
53     public void setDir (String JavaDoc newValue) {
54     setAttribute("dir", newValue);
55     }
56
57     public String JavaDoc getDir () {
58     return getAttribute ("dir");
59     }
60     public void setClassName (String JavaDoc newValue) {
61     setAttribute("class", newValue);
62     }
63
64     public String JavaDoc getClassName () {
65     return getAttribute ("class");
66     }
67     public void setTitle (String JavaDoc newValue) {
68     setAttribute("title", newValue);
69     }
70
71     public String JavaDoc getTitle () {
72     return getAttribute ("title");
73     }
74     public void setType (String JavaDoc newValue) {
75     setAttribute("type", newValue);
76     }
77
78     public String JavaDoc getType () {
79     return getAttribute ("type");
80     }
81     public void setCharset (String JavaDoc newValue) {
82     setAttribute("charset", newValue);
83     }
84
85     public String JavaDoc getCharset () {
86     return getAttribute ("charset");
87     }
88     public void setSrc (String JavaDoc newValue) {
89     setAttribute("src", newValue);
90     }
91
92     public String JavaDoc getSrc () {
93     return getAttribute ("src");
94     }
95     public void setHtmlFor (String JavaDoc newValue) {
96     setAttribute("htmlfor", newValue);
97     }
98
99     public String JavaDoc getHtmlFor () {
100     return getAttribute ("htmlfor");
101     }
102     public void setEvent (String JavaDoc newValue) {
103     setAttribute("event", newValue);
104     }
105
106     public String JavaDoc getEvent () {
107     return getAttribute ("event");
108     }
109     public void setDefer (boolean newValue) {
110     setAttribute("defer", newValue);
111     }
112
113     public boolean getDefer () {
114     return getBooleanAttribute("defer");
115     }
116     public void setLanguage (String JavaDoc newValue) {
117     setAttribute("language", newValue);
118     }
119
120     public String JavaDoc getLanguage () {
121     return getAttribute ("language");
122     }
123
124
125     public String JavaDoc getText() {
126         Node JavaDoc child;
127         String JavaDoc text;
128         
129         // Find the Text nodes contained within this element and return their
130
// concatenated value. Required to go around comments, entities, etc.
131
child = getFirstChild();
132         text = "";
133         while ( child != null )
134         {
135             if ( child instanceof Text JavaDoc )
136                 text = text + ( (Text JavaDoc) child ).getData();
137             child = child.getNextSibling();
138         }
139         return text;
140     }
141     
142     
143     public void setText( String JavaDoc text ) {
144         Node JavaDoc child;
145         Node JavaDoc next;
146         
147         // Delete all the nodes and replace them with a single Text node.
148
// This is the only approach that can handle comments and other nodes.
149
child = getFirstChild();
150         while ( child != null )
151         {
152             next = child.getNextSibling();
153             removeChild( child );
154             child = next;
155         }
156         insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() );
157     }
158
159
160 ;
161 }
162
163
164
Popular Tags