Source Code Cross Referenced for ElementImpl.java in  » Web-Server » Rimfaxe-Web-Server » com » rimfaxe » xml » compatibility » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Rimfaxe Web Server » com.rimfaxe.xml.compatibility 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.rimfaxe.xml.compatibility;
002:
003:        import org.w3c.dom.Attr;
004:        import org.w3c.dom.NodeList;
005:        import org.w3c.dom.NamedNodeMap;
006:        import java.util.*;
007:
008:        /**
009:         * Wrapper around a {@link com.rimfaxe.xml.xmlreader.Element sparta Element}.
010:
011:         <blockquote><small> Copyright (C) 2002 Hewlett-Packard Company.
012:         This file is part of Sparta, an XML Parser, DOM, and XPath library.
013:         This library is free software; you can redistribute it and/or
014:         modify it under the terms of the <a href="doc-files/LGPL.txt">GNU
015:         Lesser General Public License</a> as published by the Free Software
016:         Foundation; either version 2.1 of the License, or (at your option)
017:         any later version.  This library is distributed in the hope that it
018:         will be useful, but WITHOUT ANY WARRANTY; without even the implied
019:         warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
020:         PURPOSE. </small></blockquote>
021:         @version  $Date: 2002/10/30 16:41:39 $  $Revision: 1.2 $
022:         @author Eamonn O'Brien-Strain
023:         @author Sergio Marti
024:         * @todo make these DOM objects be part of Observer pattern
025:         * @stereotype container
026:         */
027:
028:        public class ElementImpl extends NodeImpl implements 
029:                org.w3c.dom.Element {
030:
031:            public String getAttribute(String name) {
032:                return getSpartanElement().getAttribute(name);
033:            }
034:
035:            public String getAttributeNS(String parm1, String parm2) {
036:                /**@todo: Implement this org.w3c.dom.Element method*/
037:                throw new Error("not implemented: getAttributeNS");
038:            }
039:
040:            public Attr getAttributeNode(String name) {
041:                String value = getAttribute(name);
042:                return (value == null) ? null : new AttrImpl(this , name, value);
043:            }
044:
045:            public Attr getAttributeNodeNS(String parm1, String parm2) {
046:                /**@todo: Implement this org.w3c.dom.Element method*/
047:                throw new Error("not implemented: getAttributeNodeNS");
048:            }
049:
050:            public NodeList getElementsByTagName(String tagName) {
051:                Enumeration elements;
052:                try {
053:                    elements = getSpartanElement().xpathSelectElements(
054:                            ".//" + tagName);
055:                } catch (Exception e) {
056:                    e.printStackTrace();
057:                    throw new Error("assertion violated: " + e);
058:                }
059:                return new NodeListImpl((DocumentImpl) getOwnerDocument(),
060:                        elements);
061:            }
062:
063:            public NodeList getElementsByTagNameNS(String parm1, String parm2) {
064:                /**@todo: Implement this org.w3c.dom.Element method*/
065:                throw new Error("not implemented: getElementsByTagNameNS");
066:            }
067:
068:            public String getTagName() {
069:                return getSpartanElement().getTagName();
070:            }
071:
072:            public boolean hasAttribute(String parm1) {
073:                /**@todo: Implement this org.w3c.dom.Element method*/
074:                throw new Error("not implemented: hasAttribute");
075:            }
076:
077:            public boolean hasAttributeNS(String parm1, String parm2) {
078:                /**@todo: Implement this org.w3c.dom.Element method*/
079:                throw new Error("not implemented: hasAttributeNS");
080:            }
081:
082:            public void removeAttribute(String name)
083:                    throws org.w3c.dom.DOMException {
084:                getSpartanElement().removeAttribute(name);
085:            }
086:
087:            public void removeAttributeNS(String parm1, String parm2)
088:                    throws org.w3c.dom.DOMException {
089:                /**@todo: Implement this org.w3c.dom.Element method*/
090:                throw new Error("not implemented: removeAttributeNS");
091:            }
092:
093:            public Attr removeAttributeNode(Attr parm1)
094:                    throws org.w3c.dom.DOMException {
095:                /**@todo: Implement this org.w3c.dom.Element method*/
096:                throw new Error("not implemented: removeAttributeNode");
097:            }
098:
099:            public void setAttribute(String name, String value)
100:                    throws org.w3c.dom.DOMException {
101:                getSpartanElement().setAttribute(name, value);
102:            }
103:
104:            public void setAttributeNS(String parm1, String parm2, String parm3)
105:                    throws org.w3c.dom.DOMException {
106:                /**@todo: Implement this org.w3c.dom.Element method*/
107:                throw new Error("not implemented: setAttributeNS");
108:            }
109:
110:            public Attr setAttributeNode(Attr parm1)
111:                    throws org.w3c.dom.DOMException {
112:                /**@todo: Implement this org.w3c.dom.Element method*/
113:                throw new Error("not implemented: setAttributeNode");
114:            }
115:
116:            public Attr setAttributeNodeNS(Attr attr)
117:                    throws org.w3c.dom.DOMException {
118:                /**@todo: Implement this org.w3c.dom.Element method*/
119:                throw new Error("not implemented: setAttributeNodeNS");
120:            }
121:
122:            public org.w3c.dom.Node appendChild(org.w3c.dom.Node node)
123:                    throws org.w3c.dom.DOMException {
124:
125:                if (node instanceof  NodeImpl) {
126:                    NodeImpl nodeImpl = (NodeImpl) node;
127:                    getSpartanElement().appendChild(nodeImpl.getSpartan());
128:                    return node;
129:                } else
130:                    throw new org.w3c.dom.DOMException(
131:                            org.w3c.dom.DOMException.HIERARCHY_REQUEST_ERR,
132:                            "can only add root element to document");
133:
134:            }
135:
136:            /** Return clone of node. */
137:            public org.w3c.dom.Node cloneNode(boolean deep) {
138:                com.rimfaxe.xml.xmlreader.Node spartanClone = (com.rimfaxe.xml.xmlreader.Node) getSpartanElement()
139:                        .clone();
140:                ;
141:                return ((DocumentImpl) getOwnerDocument())
142:                        .wrapper(spartanClone);
143:            }
144:
145:            public NamedNodeMap getAttributes() {
146:                return new NamedNodeMapImpl(this );
147:            }
148:
149:            public NodeList getChildNodes() {
150:                Vector list = new Vector();
151:                for (com.rimfaxe.xml.xmlreader.Node c = getSpartanElement()
152:                        .getFirstChild(); c != null; c = c.getNextSibling())
153:                    list.addElement(c);
154:                return new NodeListImpl((DocumentImpl) getOwnerDocument(), list);
155:            }
156:
157:            public org.w3c.dom.Node getFirstChild() {
158:                com.rimfaxe.xml.xmlreader.Node firstChild = getSpartanElement()
159:                        .getFirstChild();
160:                return (firstChild == null) ? null
161:                        : ((DocumentImpl) getOwnerDocument())
162:                                .wrapper(firstChild);
163:            }
164:
165:            public org.w3c.dom.Node getLastChild() {
166:                /**@todo: Implement this org.w3c.dom.Node method*/
167:                throw new Error("not implemented: getLastChild");
168:            }
169:
170:            public String getLocalName() {
171:                return null;
172:            }
173:
174:            public String getNamespaceURI() {
175:                return null;
176:            }
177:
178:            public String getNodeName() {
179:                return getSpartanElement().getTagName();
180:            }
181:
182:            public short getNodeType() {
183:                return org.w3c.dom.Node.ELEMENT_NODE;
184:            }
185:
186:            public String getNodeValue() throws org.w3c.dom.DOMException {
187:                return null;
188:            }
189:
190:            public org.w3c.dom.Node getParentNode() {
191:                if (getSpartan().getParentNode() == null)
192:                    return getOwnerDocument();
193:                else {
194:                    com.rimfaxe.xml.xmlreader.Element spartanParent = getSpartan()
195:                            .getParentNode();
196:                    return ((DocumentImpl) getOwnerDocument())
197:                            .wrapper(spartanParent);
198:                }
199:
200:            }
201:
202:            public String getPrefix() {
203:                /**@todo: Implement this org.w3c.dom.Node method*/
204:                throw new Error("not implemented: getPrefix");
205:            }
206:
207:            public boolean hasAttributes() {
208:                /**@todo: Implement this org.w3c.dom.Node method*/
209:                throw new Error("not implemented: hasAttributes");
210:            }
211:
212:            public boolean hasChildNodes() {
213:                return getSpartanElement().getFirstChild() != null;
214:            }
215:
216:            public org.w3c.dom.Node insertBefore(org.w3c.dom.Node parm1,
217:                    org.w3c.dom.Node parm2) throws org.w3c.dom.DOMException {
218:                /**@todo: Implement this org.w3c.dom.Node method*/
219:                throw new Error("not implemented: insertBefore");
220:            }
221:
222:            public boolean isSupported(String feature, String version) {
223:                if (feature.equals("NodeTestFilter"))
224:                    return false;
225:                throw new Error("Method isSupported(" + feature + "," + version
226:                        + ") not known.");
227:            }
228:
229:            public void normalize() {
230:                /**@todo: Implement this org.w3c.dom.Node method*/
231:                throw new Error("not implemented: normalize");
232:            }
233:
234:            public org.w3c.dom.Node removeChild(org.w3c.dom.Node child)
235:                    throws org.w3c.dom.DOMException {
236:                try {
237:
238:                    getSpartanElement().removeChild(
239:                            ((NodeImpl) child).getSpartan());
240:                    return child;
241:
242:                } catch (com.rimfaxe.xml.xmlreader.DOMException e) {
243:                    throw new org.w3c.dom.DOMException(e.code, e.getMessage());
244:                }
245:            }
246:
247:            public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
248:                    org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException {
249:                try {
250:
251:                    if (newChild instanceof  ElementImpl)
252:                        getSpartanElement().replaceChild(
253:                                ((ElementImpl) newChild).getSpartanElement(),
254:                                ((NodeImpl) oldChild).getSpartan());
255:                    else if (newChild instanceof  TextImpl)
256:                        getSpartanElement().replaceChild(
257:                                ((TextImpl) newChild).getSpartanText(),
258:                                ((NodeImpl) oldChild).getSpartan());
259:                    else
260:                        throw new org.w3c.dom.DOMException(
261:                                org.w3c.dom.DOMException.HIERARCHY_REQUEST_ERR,
262:                                "Cannot replace node with "
263:                                        + newChild.getClass().getName());
264:
265:                    return oldChild;
266:
267:                } catch (com.rimfaxe.xml.xmlreader.DOMException e) {
268:                    throw new org.w3c.dom.DOMException(e.code, e.getMessage());
269:                }
270:            }
271:
272:            public void setNodeValue(String parm1)
273:                    throws org.w3c.dom.DOMException {
274:                /**@todo: Implement this org.w3c.dom.Node method*/
275:                throw new Error("not implemented: setNodeValue");
276:            }
277:
278:            public void setPrefix(String parm1) throws org.w3c.dom.DOMException {
279:                /**@todo: Implement this org.w3c.dom.Node method*/
280:                throw new Error("not implemented: setPrefix");
281:            }
282:
283:            ElementImpl(DocumentImpl doc, String tagName) {
284:                this (doc, new com.rimfaxe.xml.xmlreader.Element(tagName));
285:            }
286:
287:            ElementImpl(DocumentImpl doc,
288:                    com.rimfaxe.xml.xmlreader.Element spartan) {
289:                super (doc, spartan);
290:            }
291:
292:            com.rimfaxe.xml.xmlreader.Element getSpartanElement() {
293:                return (com.rimfaxe.xml.xmlreader.Element) getSpartan();
294:            }
295:
296:            /////////////////////////////////////////////////
297:
298:        }
299:
300:        // $Log: ElementImpl.java,v $
301:        // Revision 1.2  2002/10/30 16:41:39  eobrain
302:        // appendChild no longer throws DOMException
303:        //
304:        // Revision 1.1.1.1  2002/08/19 05:04:17  eobrain
305:        // import from HP Labs internal CVS
306:        //
307:        // Revision 1.13  2002/08/18 05:45:43  eob
308:        // Add copyright and other formatting and commenting in preparation for
309:        // release to SourceForge.
310:        //
311:        // Revision 1.12  2002/08/15 22:15:24  eob
312:        // Constructor no longer needs documenent.  Fix clone.
313:        //
314:        // Revision 1.11  2002/06/21 00:32:43  eob
315:        // Make work with old JDK 1.1.*
316:        //
317:        // Revision 1.10  2002/05/23 20:06:28  eob
318:        // Add implementation of getChildNodes.
319:        //
320:        // Revision 1.9  2002/05/11 18:53:31  eob
321:        // Implement replaceChild.
322:        //
323:        // Revision 1.8  2002/02/23 02:10:45  eob
324:        // Exception handling.  Implement some methods that had been stubs.
325:        //
326:        // Revision 1.7  2002/02/04 22:11:16  eob
327:        // Implement getAttributeNode
328:        //
329:        // Revision 1.6  2002/02/01 22:01:02  eob
330:        // Comment change only.
331:        //
332:        // Revision 1.5  2002/01/05 08:14:48  eob
333:        // Fix typo
334:        //
335:        // Revision 1.4  2002/01/05 08:11:36  eob
336:        // fix typo
337:        //
338:        // Revision 1.3  2002/01/05 08:04:52  eob
339:        // Factor out some functionality into NodeImpl.
340:        //
341:        // Revision 1.2  2002/01/04 00:51:57  eob
342:        // Store wrapper as annotation of spartan object to avoid creating
343:        // uncecessary wrapper objects, while still allowing garbage collection
344:        // to clean the wrappers up.
345:        //
346:        // Revision 1.1  2002/01/04 19:57:15  eob
347:        // initial
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.