Source Code Cross Referenced for UnImplNode.java in  » XML » xalan » org » apache » xml » utils » 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 » XML » xalan » org.apache.xml.utils 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 1999-2004 The Apache Software Foundation.
0003:         *
0004:         * Licensed under the Apache License, Version 2.0 (the "License");
0005:         * you may not use this file except in compliance with the License.
0006:         * You may obtain a copy of the License at
0007:         *
0008:         *     http://www.apache.org/licenses/LICENSE-2.0
0009:         *
0010:         * Unless required by applicable law or agreed to in writing, software
0011:         * distributed under the License is distributed on an "AS IS" BASIS,
0012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013:         * See the License for the specific language governing permissions and
0014:         * limitations under the License.
0015:         */
0016:        /*
0017:         * $Id: UnImplNode.java,v 1.13 2005/06/22 19:07:10 mkwan Exp $
0018:         */
0019:        package org.apache.xml.utils;
0020:
0021:        import org.apache.xml.res.XMLErrorResources;
0022:        import org.apache.xml.res.XMLMessages;
0023:
0024:        import org.w3c.dom.Attr;
0025:        import org.w3c.dom.CDATASection;
0026:        import org.w3c.dom.Comment;
0027:        import org.w3c.dom.DOMException;
0028:        import org.w3c.dom.DOMImplementation;
0029:        import org.w3c.dom.Document;
0030:        import org.w3c.dom.DocumentFragment;
0031:        import org.w3c.dom.DocumentType;
0032:        import org.w3c.dom.Element;
0033:        import org.w3c.dom.EntityReference;
0034:        import org.w3c.dom.NamedNodeMap;
0035:        import org.w3c.dom.Node;
0036:        import org.w3c.dom.NodeList;
0037:        import org.w3c.dom.ProcessingInstruction;
0038:        import org.w3c.dom.Text;
0039:
0040:        import org.w3c.dom.UserDataHandler;
0041:        import org.w3c.dom.DOMConfiguration;
0042:        import org.w3c.dom.TypeInfo;
0043:
0044:        /**
0045:         * To be subclassed by classes that wish to fake being nodes.
0046:         * @xsl.usage internal
0047:         */
0048:        public class UnImplNode implements  Node, Element, NodeList, Document {
0049:
0050:            /**
0051:             * Constructor UnImplNode
0052:             *
0053:             */
0054:            public UnImplNode() {
0055:            }
0056:
0057:            /**
0058:             * Throw an error.
0059:             *
0060:             * @param msg Message Key for the error
0061:             */
0062:            public void error(String msg) {
0063:
0064:                System.out.println("DOM ERROR! class: "
0065:                        + this .getClass().getName());
0066:
0067:                throw new RuntimeException(XMLMessages.createXMLMessage(msg,
0068:                        null));
0069:            }
0070:
0071:            /**
0072:             * Throw an error.
0073:             *
0074:             * @param msg Message Key for the error
0075:             * @param args Array of arguments to be used in the error message
0076:             */
0077:            public void error(String msg, Object[] args) {
0078:
0079:                System.out.println("DOM ERROR! class: "
0080:                        + this .getClass().getName());
0081:
0082:                throw new RuntimeException(XMLMessages.createXMLMessage(msg,
0083:                        args)); //"UnImplNode error: "+msg);
0084:            }
0085:
0086:            /**
0087:             * Unimplemented. See org.w3c.dom.Node
0088:             *
0089:             * @param newChild New node to append to the list of this node's children
0090:             *
0091:             * @return null
0092:             *
0093:             * @throws DOMException
0094:             */
0095:            public Node appendChild(Node newChild) throws DOMException {
0096:
0097:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"appendChild not supported!");
0098:
0099:                return null;
0100:            }
0101:
0102:            /**
0103:             * Unimplemented. See org.w3c.dom.Node
0104:             *
0105:             * @return false
0106:             */
0107:            public boolean hasChildNodes() {
0108:
0109:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasChildNodes not supported!");
0110:
0111:                return false;
0112:            }
0113:
0114:            /**
0115:             * Unimplemented. See org.w3c.dom.Node
0116:             *
0117:             * @return 0
0118:             */
0119:            public short getNodeType() {
0120:
0121:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeType not supported!");
0122:
0123:                return 0;
0124:            }
0125:
0126:            /**
0127:             * Unimplemented. See org.w3c.dom.Node
0128:             *
0129:             * @return null
0130:             */
0131:            public Node getParentNode() {
0132:
0133:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getParentNode not supported!");
0134:
0135:                return null;
0136:            }
0137:
0138:            /**
0139:             * Unimplemented. See org.w3c.dom.Node
0140:             *
0141:             * @return null
0142:             */
0143:            public NodeList getChildNodes() {
0144:
0145:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getChildNodes not supported!");
0146:
0147:                return null;
0148:            }
0149:
0150:            /**
0151:             * Unimplemented. See org.w3c.dom.Node
0152:             *
0153:             * @return null
0154:             */
0155:            public Node getFirstChild() {
0156:
0157:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getFirstChild not supported!");
0158:
0159:                return null;
0160:            }
0161:
0162:            /**
0163:             * Unimplemented. See org.w3c.dom.Node
0164:             *
0165:             * @return null
0166:             */
0167:            public Node getLastChild() {
0168:
0169:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLastChild not supported!");
0170:
0171:                return null;
0172:            }
0173:
0174:            /**
0175:             * Unimplemented. See org.w3c.dom.Node
0176:             *
0177:             * @return null
0178:             */
0179:            public Node getNextSibling() {
0180:
0181:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNextSibling not supported!");
0182:
0183:                return null;
0184:            }
0185:
0186:            /**
0187:             * Unimplemented. See org.w3c.dom.NodeList
0188:             *
0189:             * @return 0
0190:             */
0191:            public int getLength() {
0192:
0193:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLength not supported!");
0194:
0195:                return 0;
0196:            } // getLength():int
0197:
0198:            /**
0199:             * Unimplemented. See org.w3c.dom.NodeList
0200:             *
0201:             * @param index index of a child of this node in its list of children
0202:             *
0203:             * @return null
0204:             */
0205:            public Node item(int index) {
0206:
0207:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"item not supported!");
0208:
0209:                return null;
0210:            } // item(int):Node
0211:
0212:            /**
0213:             * Unimplemented. See org.w3c.dom.Node
0214:             *
0215:             * @return null
0216:             */
0217:            public Document getOwnerDocument() {
0218:
0219:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerDocument not supported!");
0220:
0221:                return null;
0222:            }
0223:
0224:            /**
0225:             * Unimplemented. See org.w3c.dom.Node
0226:             *
0227:             * @return null
0228:             */
0229:            public String getTagName() {
0230:
0231:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getTagName not supported!");
0232:
0233:                return null;
0234:            }
0235:
0236:            /**
0237:             * Unimplemented. See org.w3c.dom.Node
0238:             *
0239:             * @return null
0240:             */
0241:            public String getNodeName() {
0242:
0243:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeName not supported!");
0244:
0245:                return null;
0246:            }
0247:
0248:            /** Unimplemented. See org.w3c.dom.Node */
0249:            public void normalize() {
0250:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"normalize not supported!");
0251:            }
0252:
0253:            /**
0254:             * Unimplemented. See org.w3c.dom.Element
0255:             *
0256:             * @param name Name of the element
0257:             *
0258:             * @return null
0259:             */
0260:            public NodeList getElementsByTagName(String name) {
0261:
0262:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagName not supported!");
0263:
0264:                return null;
0265:            }
0266:
0267:            /**
0268:             * Unimplemented. See org.w3c.dom.Element
0269:             *
0270:             * @param oldAttr Attribute to be removed from this node's list of attributes
0271:             *
0272:             * @return null
0273:             *
0274:             * @throws DOMException
0275:             */
0276:            public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
0277:
0278:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNode not supported!");
0279:
0280:                return null;
0281:            }
0282:
0283:            /**
0284:             * Unimplemented. See org.w3c.dom.Element
0285:             *
0286:             * @param newAttr Attribute node to be added to this node's list of attributes
0287:             *
0288:             * @return null
0289:             *
0290:             * @throws DOMException
0291:             */
0292:            public Attr setAttributeNode(Attr newAttr) throws DOMException {
0293:
0294:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNode not supported!");
0295:
0296:                return null;
0297:            }
0298:
0299:            /**
0300:             * Unimplemented. See org.w3c.dom.Element
0301:             *
0302:             *
0303:             * @param name Name of an attribute
0304:             *
0305:             * @return false
0306:             */
0307:            public boolean hasAttribute(String name) {
0308:
0309:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttribute not supported!");
0310:
0311:                return false;
0312:            }
0313:
0314:            /**
0315:             * Unimplemented. See org.w3c.dom.Element
0316:             *
0317:             *
0318:             * @param name
0319:             * @param x
0320:             *
0321:             * @return false
0322:             */
0323:            public boolean hasAttributeNS(String name, String x) {
0324:
0325:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributeNS not supported!");
0326:
0327:                return false;
0328:            }
0329:
0330:            /**
0331:             * Unimplemented. See org.w3c.dom.Element
0332:             *
0333:             *
0334:             * @param name Attribute node name
0335:             *
0336:             * @return null
0337:             */
0338:            public Attr getAttributeNode(String name) {
0339:
0340:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNode not supported!");
0341:
0342:                return null;
0343:            }
0344:
0345:            /**
0346:             * Unimplemented. See org.w3c.dom.Element
0347:             *
0348:             * @param name Attribute node name to remove from list of attributes
0349:             *
0350:             * @throws DOMException
0351:             */
0352:            public void removeAttribute(String name) throws DOMException {
0353:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttribute not supported!");
0354:            }
0355:
0356:            /**
0357:             * Unimplemented. See org.w3c.dom.Element
0358:             *
0359:             * @param name Name of attribute to set
0360:             * @param value Value of attribute
0361:             *
0362:             * @throws DOMException
0363:             */
0364:            public void setAttribute(String name, String value)
0365:                    throws DOMException {
0366:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttribute not supported!");
0367:            }
0368:
0369:            /**
0370:             * Unimplemented. See org.w3c.dom.Element
0371:             *
0372:             * @param name Name of attribute to get
0373:             *
0374:             * @return null
0375:             */
0376:            public String getAttribute(String name) {
0377:
0378:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttribute not supported!");
0379:
0380:                return null;
0381:            }
0382:
0383:            /**
0384:             * Unimplemented. Introduced in DOM Level 2.
0385:             *
0386:             * @return false
0387:             */
0388:            public boolean hasAttributes() {
0389:
0390:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributes not supported!");
0391:
0392:                return false;
0393:            }
0394:
0395:            /**
0396:             * Unimplemented. See org.w3c.dom.Element
0397:             *
0398:             * @param namespaceURI Namespace URI of the element
0399:             * @param localName Local part of qualified name of the element
0400:             *
0401:             * @return null
0402:             */
0403:            public NodeList getElementsByTagNameNS(String namespaceURI,
0404:                    String localName) {
0405:
0406:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagNameNS not supported!");
0407:
0408:                return null;
0409:            }
0410:
0411:            /**
0412:             * Unimplemented. See org.w3c.dom.Element
0413:             *
0414:             * @param newAttr Attribute to set
0415:             *
0416:             * @return null
0417:             *
0418:             * @throws DOMException
0419:             */
0420:            public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
0421:
0422:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNodeNS not supported!");
0423:
0424:                return null;
0425:            }
0426:
0427:            /**
0428:             * Unimplemented. See org.w3c.dom.Element
0429:             *
0430:             * @param namespaceURI Namespace URI of attribute node to get
0431:             * @param localName Local part of qualified name of attribute node to get
0432:             *
0433:             * @return null
0434:             */
0435:            public Attr getAttributeNodeNS(String namespaceURI, String localName) {
0436:
0437:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNodeNS not supported!");
0438:
0439:                return null;
0440:            }
0441:
0442:            /**
0443:             * Unimplemented. See org.w3c.dom.Element
0444:             *
0445:             * @param namespaceURI Namespace URI of attribute node to remove
0446:             * @param localName Local part of qualified name of attribute node to remove
0447:             *
0448:             * @throws DOMException
0449:             */
0450:            public void removeAttributeNS(String namespaceURI, String localName)
0451:                    throws DOMException {
0452:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNS not supported!");
0453:            }
0454:
0455:            /**
0456:             * Unimplemented. See org.w3c.dom.Element
0457:             *
0458:             * @param namespaceURI Namespace URI of attribute node to set
0459:             * NEEDSDOC @param qualifiedName
0460:             * @param value value of attribute
0461:             *
0462:             * @throws DOMException
0463:             */
0464:            public void setAttributeNS(String namespaceURI,
0465:                    String qualifiedName, String value) throws DOMException {
0466:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNS not supported!");
0467:            }
0468:
0469:            /**
0470:             * Unimplemented. See org.w3c.dom.Element
0471:             *
0472:             * @param namespaceURI Namespace URI of attribute node to get
0473:             * @param localName Local part of qualified name of attribute node to get
0474:             *
0475:             * @return null
0476:             */
0477:            public String getAttributeNS(String namespaceURI, String localName) {
0478:
0479:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNS not supported!");
0480:
0481:                return null;
0482:            }
0483:
0484:            /**
0485:             * Unimplemented. See org.w3c.dom.Node
0486:             *
0487:             * @return null
0488:             */
0489:            public Node getPreviousSibling() {
0490:
0491:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPreviousSibling not supported!");
0492:
0493:                return null;
0494:            }
0495:
0496:            /**
0497:             * Unimplemented. See org.w3c.dom.Node
0498:             *
0499:             * @param deep Flag indicating whether to clone deep (clone member variables)
0500:             *
0501:             * @return null
0502:             */
0503:            public Node cloneNode(boolean deep) {
0504:
0505:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"cloneNode not supported!");
0506:
0507:                return null;
0508:            }
0509:
0510:            /**
0511:             * Unimplemented. See org.w3c.dom.Node
0512:             *
0513:             * @return null
0514:             *
0515:             * @throws DOMException
0516:             */
0517:            public String getNodeValue() throws DOMException {
0518:
0519:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeValue not supported!");
0520:
0521:                return null;
0522:            }
0523:
0524:            /**
0525:             * Unimplemented. See org.w3c.dom.Node
0526:             *
0527:             * @param nodeValue Value to set this node to
0528:             *
0529:             * @throws DOMException
0530:             */
0531:            public void setNodeValue(String nodeValue) throws DOMException {
0532:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setNodeValue not supported!");
0533:            }
0534:
0535:            /**
0536:             * Unimplemented. See org.w3c.dom.Node
0537:             *
0538:             *
0539:             * NEEDSDOC @param value
0540:             * @return value Node value
0541:             *
0542:             * @throws DOMException
0543:             */
0544:
0545:            // public String getValue ()
0546:            // {      
0547:            //  error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getValue not supported!");
0548:            //  return null;
0549:            // } 
0550:            /**
0551:             * Unimplemented. See org.w3c.dom.Node
0552:             *
0553:             * @param value Value to set this node to
0554:             *
0555:             * @throws DOMException
0556:             */
0557:            public void setValue(String value) throws DOMException {
0558:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!");
0559:            }
0560:
0561:            /**
0562:             *  Returns the name of this attribute.
0563:             *
0564:             * @return the name of this attribute.
0565:             */
0566:
0567:            // public String getName()
0568:            // {
0569:            //  return this.getNodeName();
0570:            // }
0571:            /**
0572:             * Unimplemented. See org.w3c.dom.Node
0573:             *
0574:             * @return null
0575:             */
0576:            public Element getOwnerElement() {
0577:
0578:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerElement not supported!");
0579:
0580:                return null;
0581:            }
0582:
0583:            /**
0584:             * Unimplemented. See org.w3c.dom.Node
0585:             *
0586:             * @return False
0587:             */
0588:            public boolean getSpecified() {
0589:
0590:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!");
0591:
0592:                return false;
0593:            }
0594:
0595:            /**
0596:             * Unimplemented. See org.w3c.dom.Node
0597:             *
0598:             * @return null
0599:             */
0600:            public NamedNodeMap getAttributes() {
0601:
0602:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributes not supported!");
0603:
0604:                return null;
0605:            }
0606:
0607:            /**
0608:             * Unimplemented. See org.w3c.dom.Node
0609:             *
0610:             * @param newChild New child node to insert
0611:             * @param refChild Insert in front of this child
0612:             *
0613:             * @return null
0614:             *
0615:             * @throws DOMException
0616:             */
0617:            public Node insertBefore(Node newChild, Node refChild)
0618:                    throws DOMException {
0619:
0620:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"insertBefore not supported!");
0621:
0622:                return null;
0623:            }
0624:
0625:            /**
0626:             * Unimplemented. See org.w3c.dom.Node
0627:             *
0628:             * @param newChild Replace existing child with this one
0629:             * @param oldChild Existing child to be replaced
0630:             *
0631:             * @return null
0632:             *
0633:             * @throws DOMException
0634:             */
0635:            public Node replaceChild(Node newChild, Node oldChild)
0636:                    throws DOMException {
0637:
0638:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
0639:
0640:                return null;
0641:            }
0642:
0643:            /**
0644:             * Unimplemented. See org.w3c.dom.Node
0645:             *
0646:             * @param oldChild Child to be removed
0647:             *
0648:             * @return null
0649:             *
0650:             * @throws DOMException
0651:             */
0652:            public Node removeChild(Node oldChild) throws DOMException {
0653:
0654:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
0655:
0656:                return null;
0657:            }
0658:
0659:            /**
0660:             * Tests whether the DOM implementation implements a specific feature and
0661:             * that feature is supported by this node.
0662:             * @param feature The name of the feature to test. This is the same name
0663:             *   which can be passed to the method <code>hasFeature</code> on
0664:             *   <code>DOMImplementation</code>.
0665:             * @param version This is the version number of the feature to test. In
0666:             *   Level 2, version 1, this is the string "2.0". If the version is not
0667:             *   specified, supporting any version of the feature will cause the
0668:             *   method to return <code>true</code>.
0669:             *
0670:             * @return Returns <code>false</code>
0671:             * @since DOM Level 2
0672:             */
0673:            public boolean isSupported(String feature, String version) {
0674:                return false;
0675:            }
0676:
0677:            /**
0678:             * Unimplemented. See org.w3c.dom.Node
0679:             *
0680:             * @return null
0681:             */
0682:            public String getNamespaceURI() {
0683:
0684:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNamespaceURI not supported!");
0685:
0686:                return null;
0687:            }
0688:
0689:            /**
0690:             * Unimplemented. See org.w3c.dom.Node
0691:             *
0692:             * @return null
0693:             */
0694:            public String getPrefix() {
0695:
0696:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPrefix not supported!");
0697:
0698:                return null;
0699:            }
0700:
0701:            /**
0702:             * Unimplemented. See org.w3c.dom.Node
0703:             *
0704:             * @param prefix Prefix to set for this node
0705:             *
0706:             * @throws DOMException
0707:             */
0708:            public void setPrefix(String prefix) throws DOMException {
0709:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setPrefix not supported!");
0710:            }
0711:
0712:            /**
0713:             * Unimplemented. See org.w3c.dom.Node
0714:             *
0715:             * @return null
0716:             */
0717:            public String getLocalName() {
0718:
0719:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLocalName not supported!");
0720:
0721:                return null;
0722:            }
0723:
0724:            /**
0725:             * Unimplemented. See org.w3c.dom.Document
0726:             *
0727:             * @return null
0728:             */
0729:            public DocumentType getDoctype() {
0730:
0731:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0732:
0733:                return null;
0734:            }
0735:
0736:            /**
0737:             * Unimplemented. See org.w3c.dom.Document
0738:             *
0739:             * @return null
0740:             */
0741:            public DOMImplementation getImplementation() {
0742:
0743:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0744:
0745:                return null;
0746:            }
0747:
0748:            /**
0749:             * Unimplemented. See org.w3c.dom.Document
0750:             *
0751:             * @return null
0752:             */
0753:            public Element getDocumentElement() {
0754:
0755:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0756:
0757:                return null;
0758:            }
0759:
0760:            /**
0761:             * Unimplemented. See org.w3c.dom.Document
0762:             *
0763:             * @param tagName Element tag name
0764:             *
0765:             * @return null
0766:             *
0767:             * @throws DOMException
0768:             */
0769:            public Element createElement(String tagName) throws DOMException {
0770:
0771:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0772:
0773:                return null;
0774:            }
0775:
0776:            /**
0777:             * Unimplemented. See org.w3c.dom.Document
0778:             *
0779:             * @return null
0780:             */
0781:            public DocumentFragment createDocumentFragment() {
0782:
0783:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0784:
0785:                return null;
0786:            }
0787:
0788:            /**
0789:             * Unimplemented. See org.w3c.dom.Document
0790:             *
0791:             * @param data Data for text node
0792:             *
0793:             * @return null
0794:             */
0795:            public Text createTextNode(String data) {
0796:
0797:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0798:
0799:                return null;
0800:            }
0801:
0802:            /**
0803:             * Unimplemented. See org.w3c.dom.Document
0804:             *
0805:             * @param data Data for comment
0806:             *
0807:             * @return null
0808:             */
0809:            public Comment createComment(String data) {
0810:
0811:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0812:
0813:                return null;
0814:            }
0815:
0816:            /**
0817:             * Unimplemented. See org.w3c.dom.Document
0818:             *
0819:             * @param data Data for CDATA section
0820:             *
0821:             * @return null
0822:             *
0823:             * @throws DOMException
0824:             */
0825:            public CDATASection createCDATASection(String data)
0826:                    throws DOMException {
0827:
0828:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0829:
0830:                return null;
0831:            }
0832:
0833:            /**
0834:             * Unimplemented. See org.w3c.dom.Document
0835:             *
0836:             * @param target Target for Processing instruction
0837:             * @param data Data for Processing instruction
0838:             *
0839:             * @return null
0840:             *
0841:             * @throws DOMException
0842:             */
0843:            public ProcessingInstruction createProcessingInstruction(
0844:                    String target, String data) throws DOMException {
0845:
0846:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0847:
0848:                return null;
0849:            }
0850:
0851:            /**
0852:             * Unimplemented. See org.w3c.dom.Document
0853:             *
0854:             * @param name Attribute name
0855:             *
0856:             * @return null
0857:             *
0858:             * @throws DOMException
0859:             */
0860:            public Attr createAttribute(String name) throws DOMException {
0861:
0862:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0863:
0864:                return null;
0865:            }
0866:
0867:            /**
0868:             * Unimplemented. See org.w3c.dom.Document
0869:             *
0870:             * @param name Entity Reference name
0871:             *
0872:             * @return null
0873:             *
0874:             * @throws DOMException
0875:             */
0876:            public EntityReference createEntityReference(String name)
0877:                    throws DOMException {
0878:
0879:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0880:
0881:                return null;
0882:            }
0883:
0884:            /**
0885:             * Unimplemented. See org.w3c.dom.Document
0886:             *
0887:             * @param importedNode The node to import.
0888:             * @param deep         If <code>true</code>, recursively import the subtree under
0889:             *   the specified node; if <code>false</code>, import only the node
0890:             *   itself, as explained above. This has no effect on <code>Attr</code>
0891:             *   , <code>EntityReference</code>, and <code>Notation</code> nodes.
0892:             *
0893:             * @return null
0894:             *
0895:             * @throws DOMException
0896:             */
0897:            public Node importNode(Node importedNode, boolean deep)
0898:                    throws DOMException {
0899:
0900:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0901:
0902:                return null;
0903:            }
0904:
0905:            /**
0906:             * Unimplemented. See org.w3c.dom.Document
0907:             *
0908:             * @param namespaceURI Namespace URI for the element
0909:             * @param qualifiedName Qualified name of the element
0910:             *
0911:             * @return null
0912:             *
0913:             * @throws DOMException
0914:             */
0915:            public Element createElementNS(String namespaceURI,
0916:                    String qualifiedName) throws DOMException {
0917:
0918:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0919:
0920:                return null;
0921:            }
0922:
0923:            /**
0924:             * Unimplemented. See org.w3c.dom.Document
0925:             *
0926:             * @param namespaceURI Namespace URI of the attribute
0927:             * @param qualifiedName Qualified name of the attribute
0928:             *
0929:             * @return null
0930:             *
0931:             * @throws DOMException
0932:             */
0933:            public Attr createAttributeNS(String namespaceURI,
0934:                    String qualifiedName) throws DOMException {
0935:
0936:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0937:
0938:                return null;
0939:            }
0940:
0941:            /**
0942:             * Unimplemented. See org.w3c.dom.Document
0943:             *
0944:             * @param elementId ID of the element to get
0945:             *
0946:             * @return null
0947:             */
0948:            public Element getElementById(String elementId) {
0949:
0950:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0951:
0952:                return null;
0953:            }
0954:
0955:            /**
0956:             * Set Node data
0957:             *
0958:             *
0959:             * @param data data to set for this node
0960:             *
0961:             * @throws DOMException
0962:             */
0963:            public void setData(String data) throws DOMException {
0964:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0965:            }
0966:
0967:            /**
0968:             * Unimplemented.
0969:             *
0970:             * @param offset Start offset of substring to extract.
0971:             * @param count The length of the substring to extract.
0972:             *
0973:             * @return null
0974:             *
0975:             * @throws DOMException
0976:             */
0977:            public String substringData(int offset, int count)
0978:                    throws DOMException {
0979:
0980:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0981:
0982:                return null;
0983:            }
0984:
0985:            /**
0986:             * Unimplemented.
0987:             *
0988:             * @param arg String data to append
0989:             *
0990:             * @throws DOMException
0991:             */
0992:            public void appendData(String arg) throws DOMException {
0993:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
0994:            }
0995:
0996:            /**
0997:             * Unimplemented.
0998:             *
0999:             * @param offset Start offset of substring to insert.
1000:             * NEEDSDOC @param arg
1001:             *
1002:             * @throws DOMException
1003:             */
1004:            public void insertData(int offset, String arg) throws DOMException {
1005:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1006:            }
1007:
1008:            /**
1009:             * Unimplemented.
1010:             *
1011:             * @param offset Start offset of substring to delete.
1012:             * @param count The length of the substring to delete.
1013:             *
1014:             * @throws DOMException
1015:             */
1016:            public void deleteData(int offset, int count) throws DOMException {
1017:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1018:            }
1019:
1020:            /**
1021:             * Unimplemented.
1022:             *
1023:             * @param offset Start offset of substring to replace.
1024:             * @param count The length of the substring to replace.
1025:             * @param arg substring to replace with
1026:             *
1027:             * @throws DOMException
1028:             */
1029:            public void replaceData(int offset, int count, String arg)
1030:                    throws DOMException {
1031:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1032:            }
1033:
1034:            /**
1035:             * Unimplemented.
1036:             *
1037:             * @param offset Offset into text to split
1038:             *
1039:             * @return null, unimplemented
1040:             *
1041:             * @throws DOMException
1042:             */
1043:            public Text splitText(int offset) throws DOMException {
1044:
1045:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1046:
1047:                return null;
1048:            }
1049:
1050:            /**
1051:             * NEEDSDOC Method adoptNode 
1052:             *
1053:             *
1054:             * NEEDSDOC @param source
1055:             *
1056:             * NEEDSDOC (adoptNode) @return
1057:             *
1058:             * @throws DOMException
1059:             */
1060:            public Node adoptNode(Node source) throws DOMException {
1061:
1062:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1063:
1064:                return null;
1065:            }
1066:
1067:            /**
1068:             * <p>Based on the <a
1069:             * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1070:             * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1071:             * <p>
1072:             * An attribute specifying, as part of the XML declaration, the encoding
1073:             * of this document. This is <code>null</code> when unspecified.
1074:             * @since DOM Level 3
1075:             *
1076:             * NEEDSDOC ($objectName$) @return
1077:             */
1078:            public String getInputEncoding() {
1079:
1080:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1081:
1082:                return null;
1083:            }
1084:
1085:            /**
1086:             * <p>Based on the <a
1087:             * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1088:             * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1089:             * <p>
1090:             * An attribute specifying, as part of the XML declaration, the encoding
1091:             * of this document. This is <code>null</code> when unspecified.
1092:             * @since DOM Level 3
1093:             *
1094:             * NEEDSDOC @param encoding
1095:             */
1096:            public void setInputEncoding(String encoding) {
1097:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1098:            }
1099:
1100:            /**
1101:             * <p>Based on the <a
1102:             * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1103:             * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1104:             * <p>
1105:             * An attribute specifying whether errors checking is enforced or not.
1106:             * When set to <code>false</code>, the implementation is free to not
1107:             * test every possible error case normally defined on DOM operations,
1108:             * and not raise any <code>DOMException</code>. In case of error, the
1109:             * behavior is undefined. This attribute is <code>true</code> by
1110:             * defaults.
1111:             * @since DOM Level 3
1112:             *
1113:             * NEEDSDOC ($objectName$) @return
1114:             */
1115:            public boolean getStrictErrorChecking() {
1116:
1117:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1118:
1119:                return false;
1120:            }
1121:
1122:            /**
1123:             * <p>Based on the <a
1124:             * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1125:             * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1126:             * <p>
1127:             * An attribute specifying whether errors checking is enforced or not.
1128:             * When set to <code>false</code>, the implementation is free to not
1129:             * test every possible error case normally defined on DOM operations,
1130:             * and not raise any <code>DOMException</code>. In case of error, the
1131:             * behavior is undefined. This attribute is <code>true</code> by
1132:             * defaults.
1133:             * @since DOM Level 3
1134:             *
1135:             * NEEDSDOC @param strictErrorChecking
1136:             */
1137:            public void setStrictErrorChecking(boolean strictErrorChecking) {
1138:                error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1139:            }
1140:
1141:            // RAMESH : Pending proper implementation of DOM Level 3    
1142:            public Object setUserData(String key, Object data,
1143:                    UserDataHandler handler) {
1144:                return getOwnerDocument().setUserData(key, data, handler);
1145:            }
1146:
1147:            /**
1148:             * Retrieves the object associated to a key on a this node. The object
1149:             * must first have been set to this node by calling
1150:             * <code>setUserData</code> with the same key.
1151:             * @param key The key the object is associated to.
1152:             * @return Returns the <code>DOMObject</code> associated to the given key
1153:             *   on this node, or <code>null</code> if there was none.
1154:             * @since DOM Level 3
1155:             */
1156:            public Object getUserData(String key) {
1157:                return getOwnerDocument().getUserData(key);
1158:            }
1159:
1160:            /**
1161:             *  This method returns a specialized object which implements the
1162:             * specialized APIs of the specified feature and version. The
1163:             * specialized object may also be obtained by using binding-specific
1164:             * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
1165:             * @param feature The name of the feature requested (case-insensitive).
1166:             * @param version  This is the version number of the feature to test. If
1167:             *   the version is <code>null</code> or the empty string, supporting
1168:             *   any version of the feature will cause the method to return an
1169:             *   object that supports at least one version of the feature.
1170:             * @return  Returns an object which implements the specialized APIs of
1171:             *   the specified feature and version, if any, or <code>null</code> if
1172:             *   there is no object which implements interfaces associated with that
1173:             *   feature. If the <code>DOMObject</code> returned by this method
1174:             *   implements the <code>Node</code> interface, it must delegate to the
1175:             *   primary core <code>Node</code> and not return results inconsistent
1176:             *   with the primary core <code>Node</code> such as attributes,
1177:             *   childNodes, etc.
1178:             * @since DOM Level 3
1179:             */
1180:            public Object getFeature(String feature, String version) {
1181:                // we don't have any alternate node, either this node does the job
1182:                // or we don't have anything that does
1183:                return isSupported(feature, version) ? this  : null;
1184:            }
1185:
1186:            /**
1187:             * Tests whether two nodes are equal.
1188:             * <br>This method tests for equality of nodes, not sameness (i.e.,
1189:             * whether the two nodes are references to the same object) which can be
1190:             * tested with <code>Node.isSameNode</code>. All nodes that are the same
1191:             * will also be equal, though the reverse may not be true.
1192:             * <br>Two nodes are equal if and only if the following conditions are
1193:             * satisfied: The two nodes are of the same type.The following string
1194:             * attributes are equal: <code>nodeName</code>, <code>localName</code>,
1195:             * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
1196:             * , <code>baseURI</code>. This is: they are both <code>null</code>, or
1197:             * they have the same length and are character for character identical.
1198:             * The <code>attributes</code> <code>NamedNodeMaps</code> are equal.
1199:             * This is: they are both <code>null</code>, or they have the same
1200:             * length and for each node that exists in one map there is a node that
1201:             * exists in the other map and is equal, although not necessarily at the
1202:             * same index.The <code>childNodes</code> <code>NodeLists</code> are
1203:             * equal. This is: they are both <code>null</code>, or they have the
1204:             * same length and contain equal nodes at the same index. This is true
1205:             * for <code>Attr</code> nodes as for any other type of node. Note that
1206:             * normalization can affect equality; to avoid this, nodes should be
1207:             * normalized before being compared.
1208:             * <br>For two <code>DocumentType</code> nodes to be equal, the following
1209:             * conditions must also be satisfied: The following string attributes
1210:             * are equal: <code>publicId</code>, <code>systemId</code>,
1211:             * <code>internalSubset</code>.The <code>entities</code>
1212:             * <code>NamedNodeMaps</code> are equal.The <code>notations</code>
1213:             * <code>NamedNodeMaps</code> are equal.
1214:             * <br>On the other hand, the following do not affect equality: the
1215:             * <code>ownerDocument</code> attribute, the <code>specified</code>
1216:             * attribute for <code>Attr</code> nodes, the
1217:             * <code>isWhitespaceInElementContent</code> attribute for
1218:             * <code>Text</code> nodes, as well as any user data or event listeners
1219:             * registered on the nodes.
1220:             * @param arg The node to compare equality with.
1221:             * @param deep If <code>true</code>, recursively compare the subtrees; if
1222:             *   <code>false</code>, compare only the nodes themselves (and its
1223:             *   attributes, if it is an <code>Element</code>).
1224:             * @return If the nodes, and possibly subtrees are equal,
1225:             *   <code>true</code> otherwise <code>false</code>.
1226:             * @since DOM Level 3
1227:             */
1228:            public boolean isEqualNode(Node arg) {
1229:                if (arg == this ) {
1230:                    return true;
1231:                }
1232:                if (arg.getNodeType() != getNodeType()) {
1233:                    return false;
1234:                }
1235:                // in theory nodeName can't be null but better be careful
1236:                // who knows what other implementations may be doing?...
1237:                if (getNodeName() == null) {
1238:                    if (arg.getNodeName() != null) {
1239:                        return false;
1240:                    }
1241:                } else if (!getNodeName().equals(arg.getNodeName())) {
1242:                    return false;
1243:                }
1244:
1245:                if (getLocalName() == null) {
1246:                    if (arg.getLocalName() != null) {
1247:                        return false;
1248:                    }
1249:                } else if (!getLocalName().equals(arg.getLocalName())) {
1250:                    return false;
1251:                }
1252:
1253:                if (getNamespaceURI() == null) {
1254:                    if (arg.getNamespaceURI() != null) {
1255:                        return false;
1256:                    }
1257:                } else if (!getNamespaceURI().equals(arg.getNamespaceURI())) {
1258:                    return false;
1259:                }
1260:
1261:                if (getPrefix() == null) {
1262:                    if (arg.getPrefix() != null) {
1263:                        return false;
1264:                    }
1265:                } else if (!getPrefix().equals(arg.getPrefix())) {
1266:                    return false;
1267:                }
1268:
1269:                if (getNodeValue() == null) {
1270:                    if (arg.getNodeValue() != null) {
1271:                        return false;
1272:                    }
1273:                } else if (!getNodeValue().equals(arg.getNodeValue())) {
1274:                    return false;
1275:                }
1276:                /*
1277:                    if (getBaseURI() == null) {
1278:                        if (((NodeImpl) arg).getBaseURI() != null) {
1279:                            return false;
1280:                        }
1281:                    }
1282:                    else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
1283:                        return false;
1284:                    }
1285:                 */
1286:
1287:                return true;
1288:            }
1289:
1290:            /**
1291:             * DOM Level 3:
1292:             * Look up the namespace URI associated to the given prefix, starting from this node.
1293:             * Use lookupNamespaceURI(null) to lookup the default namespace
1294:             *
1295:             * @param namespaceURI
1296:             * @return th URI for the namespace
1297:             * @since DOM Level 3
1298:             */
1299:            public String lookupNamespaceURI(String specifiedPrefix) {
1300:                short type = this .getNodeType();
1301:                switch (type) {
1302:                case Node.ELEMENT_NODE: {
1303:
1304:                    String namespace = this .getNamespaceURI();
1305:                    String prefix = this .getPrefix();
1306:                    if (namespace != null) {
1307:                        // REVISIT: is it possible that prefix is empty string?
1308:                        if (specifiedPrefix == null
1309:                                && prefix == specifiedPrefix) {
1310:                            // looking for default namespace
1311:                            return namespace;
1312:                        } else if (prefix != null
1313:                                && prefix.equals(specifiedPrefix)) {
1314:                            // non default namespace
1315:                            return namespace;
1316:                        }
1317:                    }
1318:                    if (this .hasAttributes()) {
1319:                        NamedNodeMap map = this .getAttributes();
1320:                        int length = map.getLength();
1321:                        for (int i = 0; i < length; i++) {
1322:                            Node attr = map.item(i);
1323:                            String attrPrefix = attr.getPrefix();
1324:                            String value = attr.getNodeValue();
1325:                            namespace = attr.getNamespaceURI();
1326:                            if (namespace != null
1327:                                    && namespace
1328:                                            .equals("http://www.w3.org/2000/xmlns/")) {
1329:                                // at this point we are dealing with DOM Level 2 nodes only
1330:                                if (specifiedPrefix == null
1331:                                        && attr.getNodeName().equals("xmlns")) {
1332:                                    // default namespace
1333:                                    return value;
1334:                                } else if (attrPrefix != null
1335:                                        && attrPrefix.equals("xmlns")
1336:                                        && attr.getLocalName().equals(
1337:                                                specifiedPrefix)) {
1338:                                    // non default namespace
1339:                                    return value;
1340:                                }
1341:                            }
1342:                        }
1343:                    }
1344:                    /*
1345:                            NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1346:                            if (ancestor != null) {
1347:                                return ancestor.lookupNamespaceURI(specifiedPrefix);
1348:                            }
1349:                     */
1350:
1351:                    return null;
1352:
1353:                }
1354:                    /*
1355:                     case Node.DOCUMENT_NODE : {
1356:                     return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
1357:                     }
1358:                     */
1359:                case Node.ENTITY_NODE:
1360:                case Node.NOTATION_NODE:
1361:                case Node.DOCUMENT_FRAGMENT_NODE:
1362:                case Node.DOCUMENT_TYPE_NODE:
1363:                    // type is unknown
1364:                    return null;
1365:                case Node.ATTRIBUTE_NODE: {
1366:                    if (this .getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
1367:                        return getOwnerElement().lookupNamespaceURI(
1368:                                specifiedPrefix);
1369:
1370:                    }
1371:                    return null;
1372:                }
1373:                default: {
1374:                    /*
1375:                             NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1376:                             if (ancestor != null) {
1377:                                 return ancestor.lookupNamespaceURI(specifiedPrefix);
1378:                             }
1379:                     */
1380:                    return null;
1381:                }
1382:
1383:                }
1384:            }
1385:
1386:            /**
1387:             *  DOM Level 3:
1388:             *  This method checks if the specified <code>namespaceURI</code> is the
1389:             *  default namespace or not.
1390:             *  @param namespaceURI The namespace URI to look for.
1391:             *  @return  <code>true</code> if the specified <code>namespaceURI</code>
1392:             *   is the default namespace, <code>false</code> otherwise.
1393:             * @since DOM Level 3
1394:             */
1395:            public boolean isDefaultNamespace(String namespaceURI) {
1396:                /*
1397:                 // REVISIT: remove casts when DOM L3 becomes REC.
1398:                 short type = this.getNodeType();
1399:                 switch (type) {
1400:                 case Node.ELEMENT_NODE: {
1401:                     String namespace = this.getNamespaceURI();
1402:                     String prefix = this.getPrefix();
1403:
1404:                     // REVISIT: is it possible that prefix is empty string?
1405:                     if (prefix == null || prefix.length() == 0) {
1406:                         if (namespaceURI == null) {
1407:                             return (namespace == namespaceURI);
1408:                         }
1409:                         return namespaceURI.equals(namespace);
1410:                     }
1411:                     if (this.hasAttributes()) {
1412:                         ElementImpl elem = (ElementImpl)this;
1413:                         NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns");
1414:                         if (attr != null) {
1415:                             String value = attr.getNodeValue();
1416:                             if (namespaceURI == null) {
1417:                                 return (namespace == value);
1418:                             }
1419:                             return namespaceURI.equals(value);
1420:                         }
1421:                     }
1422:
1423:                     NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1424:                     if (ancestor != null) {
1425:                         return ancestor.isDefaultNamespace(namespaceURI);
1426:                     }
1427:                     return false;
1428:                 }
1429:                 case Node.DOCUMENT_NODE:{
1430:                         return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI);
1431:                     }
1432:
1433:                 case Node.ENTITY_NODE :
1434:                   case Node.NOTATION_NODE:
1435:                 case Node.DOCUMENT_FRAGMENT_NODE:
1436:                 case Node.DOCUMENT_TYPE_NODE:
1437:                     // type is unknown
1438:                     return false;
1439:                 case Node.ATTRIBUTE_NODE:{
1440:                         if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
1441:                             return ownerNode.isDefaultNamespace(namespaceURI);
1442:
1443:                         }
1444:                         return false;
1445:                     }
1446:                 default:{  
1447:                         NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1448:                         if (ancestor != null) {
1449:                             return ancestor.isDefaultNamespace(namespaceURI);
1450:                         }
1451:                         return false;
1452:                     }
1453:
1454:                 }
1455:                 */
1456:                return false;
1457:
1458:            }
1459:
1460:            /**
1461:             *
1462:             * DOM Level 3:
1463:             * Look up the prefix associated to the given namespace URI, starting from this node.
1464:             *
1465:             * @param namespaceURI
1466:             * @return the prefix for the namespace
1467:             */
1468:            public String lookupPrefix(String namespaceURI) {
1469:
1470:                // REVISIT: When Namespaces 1.1 comes out this may not be true
1471:                // Prefix can't be bound to null namespace
1472:                if (namespaceURI == null) {
1473:                    return null;
1474:                }
1475:
1476:                short type = this .getNodeType();
1477:
1478:                switch (type) {
1479:                /*
1480:                 case Node.ELEMENT_NODE: {
1481:
1482:                 String namespace = this.getNamespaceURI(); // to flip out children
1483:                 return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
1484:                 }
1485:
1486:                 case Node.DOCUMENT_NODE:{
1487:                 return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
1488:                 }
1489:                 */
1490:                case Node.ENTITY_NODE:
1491:                case Node.NOTATION_NODE:
1492:                case Node.DOCUMENT_FRAGMENT_NODE:
1493:                case Node.DOCUMENT_TYPE_NODE:
1494:                    // type is unknown
1495:                    return null;
1496:                case Node.ATTRIBUTE_NODE: {
1497:                    if (this .getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
1498:                        return getOwnerElement().lookupPrefix(namespaceURI);
1499:
1500:                    }
1501:                    return null;
1502:                }
1503:                default: {
1504:                    /*
1505:                     NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1506:                     if (ancestor != null) {
1507:                     return ancestor.lookupPrefix(namespaceURI);
1508:                     }
1509:                     */
1510:                    return null;
1511:                }
1512:                }
1513:            }
1514:
1515:            /**
1516:             * Returns whether this node is the same node as the given one.
1517:             * <br>This method provides a way to determine whether two
1518:             * <code>Node</code> references returned by the implementation reference
1519:             * the same object. When two <code>Node</code> references are references
1520:             * to the same object, even if through a proxy, the references may be
1521:             * used completely interchangably, such that all attributes have the
1522:             * same values and calling the same DOM method on either reference
1523:             * always has exactly the same effect.
1524:             * @param other The node to test against.
1525:             * @return Returns <code>true</code> if the nodes are the same,
1526:             *   <code>false</code> otherwise.
1527:             * @since DOM Level 3
1528:             */
1529:            public boolean isSameNode(Node other) {
1530:                // we do not use any wrapper so the answer is obvious
1531:                return this  == other;
1532:            }
1533:
1534:            /**
1535:             * This attribute returns the text content of this node and its
1536:             * descendants. When it is defined to be null, setting it has no effect.
1537:             * When set, any possible children this node may have are removed and
1538:             * replaced by a single <code>Text</code> node containing the string
1539:             * this attribute is set to. On getting, no serialization is performed,
1540:             * the returned string does not contain any markup. No whitespace
1541:             * normalization is performed, the returned string does not contain the
1542:             * element content whitespaces . Similarly, on setting, no parsing is
1543:             * performed either, the input string is taken as pure textual content.
1544:             * <br>The string returned is made of the text content of this node
1545:             * depending on its type, as defined below:
1546:             * <table border='1'>
1547:             * <tr>
1548:             * <th>Node type</th>
1549:             * <th>Content</th>
1550:             * </tr>
1551:             * <tr>
1552:             * <td valign='top' rowspan='1' colspan='1'>
1553:             * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
1554:             * DOCUMENT_FRAGMENT_NODE</td>
1555:             * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
1556:             * attribute value of every child node, excluding COMMENT_NODE and
1557:             * PROCESSING_INSTRUCTION_NODE nodes</td>
1558:             * </tr>
1559:             * <tr>
1560:             * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
1561:             * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
1562:             * <td valign='top' rowspan='1' colspan='1'>
1563:             * <code>nodeValue</code></td>
1564:             * </tr>
1565:             * <tr>
1566:             * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
1567:             * <td valign='top' rowspan='1' colspan='1'>
1568:             * null</td>
1569:             * </tr>
1570:             * </table>
1571:             * @exception DOMException
1572:             *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
1573:             * @exception DOMException
1574:             *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
1575:             *   fit in a <code>DOMString</code> variable on the implementation
1576:             *   platform.
1577:             * @since DOM Level 3
1578:             */
1579:            public void setTextContent(String textContent) throws DOMException {
1580:                setNodeValue(textContent);
1581:            }
1582:
1583:            /**
1584:             * This attribute returns the text content of this node and its
1585:             * descendants. When it is defined to be null, setting it has no effect.
1586:             * When set, any possible children this node may have are removed and
1587:             * replaced by a single <code>Text</code> node containing the string
1588:             * this attribute is set to. On getting, no serialization is performed,
1589:             * the returned string does not contain any markup. No whitespace
1590:             * normalization is performed, the returned string does not contain the
1591:             * element content whitespaces . Similarly, on setting, no parsing is
1592:             * performed either, the input string is taken as pure textual content.
1593:             * <br>The string returned is made of the text content of this node
1594:             * depending on its type, as defined below:
1595:             * <table border='1'>
1596:             * <tr>
1597:             * <th>Node type</th>
1598:             * <th>Content</th>
1599:             * </tr>
1600:             * <tr>
1601:             * <td valign='top' rowspan='1' colspan='1'>
1602:             * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
1603:             * DOCUMENT_FRAGMENT_NODE</td>
1604:             * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
1605:             * attribute value of every child node, excluding COMMENT_NODE and
1606:             * PROCESSING_INSTRUCTION_NODE nodes</td>
1607:             * </tr>
1608:             * <tr>
1609:             * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
1610:             * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
1611:             * <td valign='top' rowspan='1' colspan='1'>
1612:             * <code>nodeValue</code></td>
1613:             * </tr>
1614:             * <tr>
1615:             * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
1616:             * <td valign='top' rowspan='1' colspan='1'>
1617:             * null</td>
1618:             * </tr>
1619:             * </table>
1620:             * @exception DOMException
1621:             *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
1622:             * @exception DOMException
1623:             *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
1624:             *   fit in a <code>DOMString</code> variable on the implementation
1625:             *   platform.
1626:             * @since DOM Level 3
1627:             */
1628:            public String getTextContent() throws DOMException {
1629:                return getNodeValue(); // overriden in some subclasses
1630:            }
1631:
1632:            /**
1633:             * Compares a node with this node with regard to their position in the
1634:             * document.
1635:             * @param other The node to compare against this node.
1636:             * @return Returns how the given node is positioned relatively to this
1637:             *   node.
1638:             * @since DOM Level 3
1639:             */
1640:            public short compareDocumentPosition(Node other)
1641:                    throws DOMException {
1642:                return 0;
1643:            }
1644:
1645:            /**
1646:             * The absolute base URI of this node or <code>null</code> if undefined.
1647:             * This value is computed according to . However, when the
1648:             * <code>Document</code> supports the feature "HTML" , the base URI is
1649:             * computed using first the value of the href attribute of the HTML BASE
1650:             * element if any, and the value of the <code>documentURI</code>
1651:             * attribute from the <code>Document</code> interface otherwise.
1652:             * <br> When the node is an <code>Element</code>, a <code>Document</code>
1653:             * or a a <code>ProcessingInstruction</code>, this attribute represents
1654:             * the properties [base URI] defined in . When the node is a
1655:             * <code>Notation</code>, an <code>Entity</code>, or an
1656:             * <code>EntityReference</code>, this attribute represents the
1657:             * properties [declaration base URI] in the . How will this be affected
1658:             * by resolution of relative namespace URIs issue?It's not.Should this
1659:             * only be on Document, Element, ProcessingInstruction, Entity, and
1660:             * Notation nodes, according to the infoset? If not, what is it equal to
1661:             * on other nodes? Null? An empty string? I think it should be the
1662:             * parent's.No.Should this be read-only and computed or and actual
1663:             * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
1664:             * teleconference 30 May 2001).If the base HTML element is not yet
1665:             * attached to a document, does the insert change the Document.baseURI?
1666:             * Yes. (F2F 26 Sep 2001)
1667:             * @since DOM Level 3
1668:             */
1669:            public String getBaseURI() {
1670:                return null;
1671:            }
1672:
1673:            /**
1674:             * DOM Level 3
1675:             * Renaming node
1676:             */
1677:            public Node renameNode(Node n, String namespaceURI, String name)
1678:                    throws DOMException {
1679:                return n;
1680:            }
1681:
1682:            /**
1683:             *  DOM Level 3
1684:             *  Normalize document.
1685:             */
1686:            public void normalizeDocument() {
1687:
1688:            }
1689:
1690:            /**
1691:             *  The configuration used when <code>Document.normalizeDocument</code> is
1692:             * invoked.
1693:             * @since DOM Level 3
1694:             */
1695:            public DOMConfiguration getDomConfig() {
1696:                return null;
1697:            }
1698:
1699:            /** DOM Level 3 feature: documentURI */
1700:            protected String fDocumentURI;
1701:
1702:            /**
1703:             * DOM Level 3
1704:             */
1705:            public void setDocumentURI(String documentURI) {
1706:
1707:                fDocumentURI = documentURI;
1708:            }
1709:
1710:            /**
1711:             * DOM Level 3
1712:             * The location of the document or <code>null</code> if undefined.
1713:             * <br>Beware that when the <code>Document</code> supports the feature
1714:             * "HTML" , the href attribute of the HTML BASE element takes precedence
1715:             * over this attribute.
1716:             * @since DOM Level 3
1717:             */
1718:            public String getDocumentURI() {
1719:                return fDocumentURI;
1720:            }
1721:
1722:            /** DOM Level 3 feature: Document actualEncoding */
1723:            protected String actualEncoding;
1724:
1725:            /**
1726:             * DOM Level 3
1727:             * An attribute specifying the actual encoding of this document. This is
1728:             * <code>null</code> otherwise.
1729:             * <br> This attribute represents the property [character encoding scheme]
1730:             * defined in .
1731:             * @since DOM Level 3
1732:             */
1733:            public String getActualEncoding() {
1734:                return actualEncoding;
1735:            }
1736:
1737:            /**
1738:             * DOM Level 3
1739:             * An attribute specifying the actual encoding of this document. This is
1740:             * <code>null</code> otherwise.
1741:             * <br> This attribute represents the property [character encoding scheme]
1742:             * defined in .
1743:             * @since DOM Level 3
1744:             */
1745:            public void setActualEncoding(String value) {
1746:                actualEncoding = value;
1747:            }
1748:
1749:            /**
1750:             * DOM Level 3
1751:             */
1752:            public Text replaceWholeText(String content) throws DOMException {
1753:                /*
1754:
1755:                 if (needsSyncData()) {
1756:                 synchronizeData();
1757:                 }
1758:
1759:                 // make sure we can make the replacement
1760:                 if (!canModify(nextSibling)) {
1761:                 throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
1762:                 DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null));
1763:                 }
1764:
1765:                 Node parent = this.getParentNode();
1766:                 if (content == null || content.length() == 0) {
1767:                 // remove current node
1768:                 if (parent !=null) { // check if node in the tree
1769:                 parent.removeChild(this);
1770:                 return null;
1771:                 }
1772:                 }
1773:                 Text currentNode = null;
1774:                 if (isReadOnly()){
1775:                 Text newNode = this.ownerDocument().createTextNode(content);
1776:                 if (parent !=null) { // check if node in the tree
1777:                 parent.insertBefore(newNode, this);
1778:                 parent.removeChild(this);
1779:                 currentNode = newNode;
1780:                 } else {
1781:                 return newNode;
1782:                 }
1783:                 }  else {
1784:                 this.setData(content);
1785:                 currentNode = this;
1786:                 }
1787:                 Node sibling =  currentNode.getNextSibling();
1788:                 while ( sibling !=null) {
1789:                 parent.removeChild(sibling);
1790:                 sibling = currentNode.getNextSibling();
1791:                 }
1792:
1793:                 return currentNode;
1794:                 */
1795:                return null; //Pending
1796:            }
1797:
1798:            /**
1799:             * DOM Level 3
1800:             * Returns all text of <code>Text</code> nodes logically-adjacent text
1801:             * nodes to this node, concatenated in document order.
1802:             * @since DOM Level 3
1803:             */
1804:            public String getWholeText() {
1805:
1806:                /*
1807:                 if (needsSyncData()) {
1808:                 synchronizeData();
1809:                 }
1810:                 if (nextSibling == null) {
1811:                 return data;
1812:                 }
1813:                 StringBuffer buffer = new StringBuffer();
1814:                 if (data != null && data.length() != 0) {
1815:                 buffer.append(data);
1816:                 }
1817:                 getWholeText(nextSibling, buffer);
1818:                 return buffer.toString();
1819:                 */
1820:                return null; // PENDING
1821:
1822:            }
1823:
1824:            /**
1825:             * DOM Level 3
1826:             * Returns whether this text node contains whitespace in element content,
1827:             * often abusively called "ignorable whitespace".
1828:             */
1829:            public boolean isWhitespaceInElementContent() {
1830:                return false;
1831:            }
1832:
1833:            /**
1834:             * NON-DOM: set the type of this attribute to be ID type.
1835:             *
1836:             * @param id
1837:             */
1838:            public void setIdAttribute(boolean id) {
1839:                //PENDING
1840:            }
1841:
1842:            /**
1843:             * DOM Level 3: register the given attribute node as an ID attribute
1844:             */
1845:            public void setIdAttribute(String name, boolean makeId) {
1846:                //PENDING
1847:            }
1848:
1849:            /**
1850:             * DOM Level 3: register the given attribute node as an ID attribute
1851:             */
1852:            public void setIdAttributeNode(Attr at, boolean makeId) {
1853:                //PENDING
1854:            }
1855:
1856:            /**
1857:             * DOM Level 3: register the given attribute node as an ID attribute
1858:             */
1859:            public void setIdAttributeNS(String namespaceURI, String localName,
1860:                    boolean makeId) {
1861:                //PENDING
1862:            }
1863:
1864:            /**
1865:             * Method getSchemaTypeInfo.
1866:             * @return TypeInfo
1867:             */
1868:            public TypeInfo getSchemaTypeInfo() {
1869:                return null; //PENDING
1870:            }
1871:
1872:            public boolean isId() {
1873:                return false; //PENDING
1874:            }
1875:
1876:            private String xmlEncoding;
1877:
1878:            public String getXmlEncoding() {
1879:                return xmlEncoding;
1880:            }
1881:
1882:            public void setXmlEncoding(String xmlEncoding) {
1883:                this .xmlEncoding = xmlEncoding;
1884:            }
1885:
1886:            private boolean xmlStandalone;
1887:
1888:            public boolean getXmlStandalone() {
1889:                return xmlStandalone;
1890:            }
1891:
1892:            public void setXmlStandalone(boolean xmlStandalone)
1893:                    throws DOMException {
1894:                this .xmlStandalone = xmlStandalone;
1895:            }
1896:
1897:            private String xmlVersion;
1898:
1899:            public String getXmlVersion() {
1900:                return xmlVersion;
1901:            }
1902:
1903:            public void setXmlVersion(String xmlVersion) throws DOMException {
1904:                this.xmlVersion = xmlVersion;
1905:            }
1906:
1907:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.