Source Code Cross Referenced for SimpleXMLObjectImpl.java in  » J2EE » Enhydra-Application-Framework » org » enhydra » util » dom » 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 » J2EE » Enhydra Application Framework » org.enhydra.util.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Enhydra Java Application Server Project
0003:         *
0004:         * The contents of this file are subject to the Enhydra Public License
0005:         * Version 1.1 (the "License"); you may not use this file except in
0006:         * compliance with the License. You may obtain a copy of the License on
0007:         * the Enhydra web site ( http://www.enhydra.org/ ).
0008:         *
0009:         * Software distributed under the License is distributed on an "AS IS"
0010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
0011:         * the License for the specific terms governing rights and limitations
0012:         * under the License.
0013:         *
0014:         * The Developer of the Enhydra Application Server is Together Austria.
0015:         * All Rights Reserved.
0016:         *
0017:         */
0018:        package org.enhydra.util.dom;
0019:
0020:        import org.enhydra.xml.dom.DOMOps;
0021:        import org.enhydra.xml.io.DOMFormatter;
0022:        import org.enhydra.xml.io.DocumentInfo;
0023:        import org.enhydra.xml.xmlc.XMLCError;
0024:        import org.enhydra.xml.xmlc.XMLCUtil;
0025:        import org.enhydra.xml.xmlc.XMLObject;
0026:        import org.enhydra.xml.xmlc.XMLObjectLink;
0027:        import org.enhydra.xml.xmlc.dom.XMLCDomFactory;
0028:        import org.w3c.dom.Attr;
0029:        import org.w3c.dom.CDATASection;
0030:        import org.w3c.dom.Comment;
0031:        import org.w3c.dom.DOMConfiguration;
0032:        import org.w3c.dom.DOMException;
0033:        import org.w3c.dom.DOMImplementation;
0034:        import org.w3c.dom.Document;
0035:        import org.w3c.dom.DocumentFragment;
0036:        import org.w3c.dom.DocumentType;
0037:        import org.w3c.dom.Element;
0038:        import org.w3c.dom.EntityReference;
0039:        import org.w3c.dom.NamedNodeMap;
0040:        import org.w3c.dom.Node;
0041:        import org.w3c.dom.NodeList;
0042:        import org.w3c.dom.ProcessingInstruction;
0043:        import org.w3c.dom.Text;
0044:        import org.w3c.dom.UserDataHandler;
0045:
0046:        /**
0047:         * <p>Title: SimpleXMLObjectImpl</p>
0048:         * <p>Description: This class represents implementation of XMLObject interface.
0049:         * Its main purpose is to provide the way for creation of XMLObject object by
0050:         * passed org.w3c.dom.Document object implementation. The XMLCObject created by
0051:         * this manner can be used in already existing writeDOM() method of
0052:         * ServletHttpPresentationResponse object to perform http response. So, this
0053:         * class (or extemnsion of this class) may be used as suitable way to process
0054:         * the http response by using different org.w3c.dom.Document object
0055:         * implementations (for example Jivan implementation) via already existing
0056:         * XMLC writeDOM() methods. Note that this class was tested only in in http
0057:         * response, not in DOM manipulation, and some methods throw an exception
0058:         * because they are not implemented.</p>
0059:         * <p>Copyright: Copyright (c) 2004</p>
0060:         * <p>Company: Together</p>
0061:         * @author Vladimir Radisic
0062:         * @version 1.0
0063:         */
0064:        public class SimpleXMLObjectImpl implements  XMLObject {
0065:
0066:            /**
0067:             * Default XML formatting object for use by toDocument().  Initialized
0068:             * on first use and shared
0069:             */
0070:            private static DOMFormatter fFormatter = null;
0071:
0072:            /**
0073:             * The document the object is associated with.
0074:             */
0075:            private Document fDocument;
0076:
0077:            /**
0078:             * The MIME type associated with the document.
0079:             */
0080:            private String fMIMEType;
0081:
0082:            /**
0083:             * The encoding associated with the document.
0084:             */
0085:            private String encoding;
0086:
0087:            /**
0088:             * The delegate object.
0089:             */
0090:            private XMLObject fDelegate;
0091:
0092:            /**
0093:             * Constructor. The setDocument() method must be called to
0094:             * associate a document with this object.
0095:             */
0096:            public SimpleXMLObjectImpl() {
0097:            }
0098:
0099:            /**
0100:             * Method is not implemented yet.
0101:             * @param parm1
0102:             * @return
0103:             */
0104:            public Node cloneNode(boolean parm1) {
0105:                /**@todo Implement this org.w3c.dom.Node abstract method*/
0106:                throw new java.lang.UnsupportedOperationException(
0107:                        "Method cloneNode() not yet implemented.");
0108:            }
0109:
0110:            /**
0111:             * Method is not implemented yet.
0112:             * @param node
0113:             */
0114:            protected void syncWithDocument(Node node) {
0115:                /**@todo Implement this org.enhydra.xml.xmlc.XMLObjectImpl abstract method*/
0116:            }
0117:
0118:            /**
0119:             * Method is not implemented yet.
0120:             */
0121:            public void buildDocument() {
0122:                /**@todo Implement this org.enhydra.xml.xmlc.XMLObject abstract method*/
0123:                throw new java.lang.UnsupportedOperationException(
0124:                        "Method buildDocument() not yet implemented.");
0125:            }
0126:
0127:            /**
0128:             * Method is not implemented yet.
0129:             * @return
0130:             */
0131:            protected XMLCDomFactory getDomFactory() {
0132:                /**@todo Implement this org.enhydra.xml.xmlc.XMLObjectImpl abstract method*/
0133:                throw new java.lang.UnsupportedOperationException(
0134:                        "Method getDomFactory() not yet implemented.");
0135:            }
0136:
0137:            /**
0138:             * Set the DOM document associated with this object and optional encoding.
0139:             * @param document org.w3c.dom.Document implementation which should be
0140:             * associated with this object
0141:             * @param mimeType The MIME type associated with the document.
0142:             * @param encoding The encoding associated with the document.
0143:             */
0144:            public void setDocument(Document document, String mimeType,
0145:                    String encoding) {
0146:                fDocument = document;
0147:                fMIMEType = mimeType;
0148:                this .encoding = encoding;
0149:
0150:                // Link Document back to this object if it supports XMLObjectLink
0151:                if (document instanceof  XMLObjectLink) {
0152:                    ((XMLObjectLink) document).setXMLObject(this );
0153:                }
0154:            }
0155:
0156:            /**
0157:             * @see XMLObject#getDocument
0158:             */
0159:            public Document getDocument() {
0160:                if (fDelegate != null) {
0161:                    return fDelegate.getDocument();
0162:                } else {
0163:                    return fDocument;
0164:                }
0165:            }
0166:
0167:            /**
0168:             * @see XMLObject#getMIMEType
0169:             */
0170:            public String getMIMEType() {
0171:                if (fDelegate != null) {
0172:                    return fDelegate.getMIMEType();
0173:                } else {
0174:                    return fMIMEType;
0175:                }
0176:            }
0177:
0178:            /**
0179:             * @see XMLObject#setDelegate
0180:             */
0181:            public void setDelegate(XMLObject delegate) {
0182:                fDelegate = delegate;
0183:            }
0184:
0185:            /**
0186:             * @see XMLObject#getDelegate
0187:             */
0188:            public XMLObject getDelegate() {
0189:                return fDelegate;
0190:            }
0191:
0192:            /**
0193:             * Check that cloneNode on an entire document is done with the
0194:             * deep option.
0195:             */
0196:            protected void cloneDeepCheck(boolean deep) {
0197:                if (!deep) {
0198:                    throw new XMLCError(
0199:                            "Must use deep clone when cloning entire document");
0200:                }
0201:            }
0202:
0203:            /**
0204:             * @see org.w3c.dom.Document#getDoctype
0205:             */
0206:            public DocumentType getDoctype() {
0207:                if (fDelegate != null) {
0208:                    return fDelegate.getDoctype();
0209:                } else {
0210:                    return fDocument.getDoctype();
0211:                }
0212:            }
0213:
0214:            /**
0215:             * @see org.w3c.dom.Document#getImplementation
0216:             */
0217:            public DOMImplementation getImplementation() {
0218:                if (fDelegate != null) {
0219:                    return fDelegate.getImplementation();
0220:                } else {
0221:                    return fDocument.getImplementation();
0222:                }
0223:            }
0224:
0225:            /**
0226:             * @see org.w3c.dom.Document#getDocumentElement
0227:             */
0228:            public Element getDocumentElement() {
0229:                if (fDelegate != null) {
0230:                    return fDelegate.getDocumentElement();
0231:                } else {
0232:                    return fDocument.getDocumentElement();
0233:                }
0234:            }
0235:
0236:            /**
0237:             * @see org.w3c.dom.Document#importNode
0238:             */
0239:            public Node importNode(Node importedNode, boolean deep)
0240:                    throws DOMException {
0241:                if (fDelegate != null) {
0242:                    return fDelegate.importNode(importedNode, deep);
0243:                } else {
0244:                    return fDocument.importNode(importedNode, deep);
0245:                }
0246:            }
0247:
0248:            /**
0249:             * @see org.w3c.dom.Document#createElement
0250:             */
0251:            public Element createElement(String tagName) throws DOMException {
0252:                if (fDelegate != null) {
0253:                    return fDelegate.createElement(tagName);
0254:                } else {
0255:                    return fDocument.createElement(tagName);
0256:                }
0257:            }
0258:
0259:            /**
0260:             * @see org.w3c.dom.Document#createElementNS
0261:             */
0262:            public Element createElementNS(String namespaceURI,
0263:                    String qualifiedName) throws DOMException {
0264:                if (fDelegate != null) {
0265:                    return fDelegate.createElementNS(namespaceURI,
0266:                            qualifiedName);
0267:                } else {
0268:                    return fDocument.createElementNS(namespaceURI,
0269:                            qualifiedName);
0270:                }
0271:            }
0272:
0273:            /**
0274:             * @see org.w3c.dom.Document#createDocumentFragment
0275:             */
0276:            public DocumentFragment createDocumentFragment() {
0277:                if (fDelegate != null) {
0278:                    return fDelegate.createDocumentFragment();
0279:                } else {
0280:                    return fDocument.createDocumentFragment();
0281:                }
0282:            }
0283:
0284:            /**
0285:             * @see org.w3c.dom.Document#createTextNode
0286:             */
0287:            public Text createTextNode(String data) {
0288:                if (fDelegate != null) {
0289:                    return fDelegate.createTextNode(data);
0290:                } else {
0291:                    return fDocument.createTextNode(data);
0292:                }
0293:            }
0294:
0295:            /**
0296:             * @see org.w3c.dom.Document#createComment
0297:             */
0298:            public Comment createComment(String data) {
0299:                if (fDelegate != null) {
0300:                    return fDelegate.createComment(data);
0301:                } else {
0302:                    return fDocument.createComment(data);
0303:                }
0304:            }
0305:
0306:            /**
0307:             * @see org.w3c.dom.Document#createCDATASection
0308:             */
0309:            public CDATASection createCDATASection(String data)
0310:                    throws DOMException {
0311:                if (fDelegate != null) {
0312:                    return fDelegate.createCDATASection(data);
0313:                } else {
0314:                    return fDocument.createCDATASection(data);
0315:                }
0316:            }
0317:
0318:            /**
0319:             * @see org.w3c.dom.Document#createProcessingInstruction
0320:             */
0321:            public ProcessingInstruction createProcessingInstruction(
0322:                    String target, String data) throws DOMException {
0323:                if (fDelegate != null) {
0324:                    return fDelegate.createProcessingInstruction(target, data);
0325:                } else {
0326:                    return fDocument.createProcessingInstruction(target, data);
0327:                }
0328:            }
0329:
0330:            /**
0331:             * @see org.w3c.dom.Document#createAttribute
0332:             */
0333:            public Attr createAttribute(String qualifiedName)
0334:                    throws DOMException {
0335:                if (fDelegate != null) {
0336:                    return fDelegate.createAttribute(qualifiedName);
0337:                } else {
0338:                    return fDocument.createAttribute(qualifiedName);
0339:                }
0340:            }
0341:
0342:            /**
0343:             * @see org.w3c.dom.Document#createAttributeNS
0344:             */
0345:            public Attr createAttributeNS(String namespaceURI,
0346:                    String qualifiedName) throws DOMException {
0347:                if (fDelegate != null) {
0348:                    return fDelegate.createAttributeNS(namespaceURI,
0349:                            qualifiedName);
0350:                } else {
0351:                    return fDocument.createAttributeNS(namespaceURI,
0352:                            qualifiedName);
0353:                }
0354:            }
0355:
0356:            /**
0357:             * @see org.w3c.dom.Document#createEntityReference
0358:             */
0359:            public EntityReference createEntityReference(String name)
0360:                    throws DOMException {
0361:                if (fDelegate != null) {
0362:                    return fDelegate.createEntityReference(name);
0363:                } else {
0364:                    return fDocument.createEntityReference(name);
0365:                }
0366:            }
0367:
0368:            /**
0369:             * @see org.w3c.dom.Document#getElementsByTagName
0370:             */
0371:            public NodeList getElementsByTagName(String tagname) {
0372:                if (fDelegate != null) {
0373:                    return fDelegate.getElementsByTagName(tagname);
0374:                } else {
0375:                    return fDocument.getElementsByTagName(tagname);
0376:                }
0377:            }
0378:
0379:            /**
0380:             * @see org.w3c.dom.Document#getElementsByTagNameNS
0381:             */
0382:            public NodeList getElementsByTagNameNS(String namespaceURI,
0383:                    String localName) {
0384:                if (fDelegate != null) {
0385:                    return fDelegate.getElementsByTagNameNS(namespaceURI,
0386:                            localName);
0387:                } else {
0388:                    return fDocument.getElementsByTagNameNS(namespaceURI,
0389:                            localName);
0390:                }
0391:            }
0392:
0393:            /**
0394:             * @see org.w3c.dom.Document#getElementById
0395:             */
0396:            public Element getElementById(String elementId) {
0397:                if (fDelegate != null) {
0398:                    return fDelegate.getElementById(elementId);
0399:                } else {
0400:                    return fDocument.getElementById(elementId);
0401:                }
0402:            }
0403:
0404:            /**
0405:             * See org.w3c.dom.Document#getEncoding
0406:             */
0407:            public String getEncoding() {
0408:                if (fDelegate != null) {
0409:                    return fDelegate.getEncoding();
0410:                } else {
0411:                    return this .encoding;
0412:                }
0413:            }
0414:
0415:            /**
0416:             * See org.w3c.dom.Document#setEncoding
0417:             */
0418:            public void setEncoding(String encoding) {
0419:                if (fDelegate != null) {
0420:                    fDelegate.setEncoding(encoding);
0421:                } else {
0422:                    DOMOps.setEncoding(fDocument, encoding);
0423:                }
0424:            }
0425:
0426:            /**
0427:             * See org.w3c.dom.Document#getStandalone
0428:             */
0429:            public boolean getStandalone() {
0430:                if (fDelegate != null) {
0431:                    return fDelegate.getStandalone();
0432:                } else {
0433:                    return DOMOps.getStandalone(fDocument);
0434:                }
0435:            }
0436:
0437:            /**
0438:             * See org.w3c.dom.Document#setStandalone
0439:             */
0440:            public void setStandalone(boolean standalone) {
0441:                if (fDelegate != null) {
0442:                    fDelegate.setStandalone(standalone);
0443:                } else {
0444:                    DOMOps.setStandalone(fDocument, standalone);
0445:                }
0446:            }
0447:
0448:            /**
0449:             * See org.w3c.dom.Document#getStrictErrorChecking
0450:             */
0451:            public boolean getStrictErrorChecking() {
0452:                if (fDelegate != null) {
0453:                    return fDelegate.getStrictErrorChecking();
0454:                } else {
0455:                    return DOMOps.getStrictErrorChecking(fDocument);
0456:                }
0457:            }
0458:
0459:            /**
0460:             * See org.w3c.dom.Document#setStrictErrorChecking
0461:             */
0462:            public void setStrictErrorChecking(boolean strictErrorChecking) {
0463:                if (fDelegate != null) {
0464:                    fDelegate.setStrictErrorChecking(strictErrorChecking);
0465:                } else {
0466:                    DOMOps.setStrictErrorChecking(fDocument,
0467:                            strictErrorChecking);
0468:                }
0469:            }
0470:
0471:            /**
0472:             * See org.w3c.dom.Document#getVersion()
0473:             */
0474:            public String getVersion() {
0475:                if (fDelegate != null) {
0476:                    return fDelegate.getVersion();
0477:                } else {
0478:                    return DOMOps.getVersion(fDocument);
0479:                }
0480:            }
0481:
0482:            /**
0483:             * See org.w3c.dom.Document#setVersion
0484:             */
0485:            public void setVersion(String version) {
0486:                if (fDelegate != null) {
0487:                    fDelegate.setVersion(version);
0488:                } else {
0489:                    DOMOps.setVersion(fDocument, version);
0490:                }
0491:            }
0492:
0493:            /**
0494:             * See org.w3c.dom.Document#adoptNode
0495:             */
0496:            public Node adoptNode(Node source) throws DOMException {
0497:                if (fDelegate != null) {
0498:                    return fDelegate.adoptNode(source);
0499:                } else {
0500:                    return DOMOps.adoptNode(fDocument, source);
0501:                }
0502:            }
0503:
0504:            /**
0505:             * @see org.w3c.dom.Node#getNodeName()
0506:             */
0507:            public String getNodeName() {
0508:                if (fDelegate != null) {
0509:                    return fDelegate.getNodeName();
0510:                } else {
0511:                    return fDocument.getNodeName();
0512:                }
0513:            }
0514:
0515:            /**
0516:             * @see org.w3c.dom.Node#getNodeValue()
0517:             */
0518:            public String getNodeValue() throws DOMException {
0519:                if (fDelegate != null) {
0520:                    return fDelegate.getNodeValue();
0521:                } else {
0522:                    return fDocument.getNodeValue();
0523:                }
0524:            }
0525:
0526:            /**
0527:             * @see org.w3c.dom.Node#setNodeValue
0528:             */
0529:            public void setNodeValue(String nodeValue) throws DOMException {
0530:                if (fDelegate != null) {
0531:                    fDelegate.setNodeValue(nodeValue);
0532:                } else {
0533:                    fDocument.setNodeValue(nodeValue);
0534:                }
0535:            }
0536:
0537:            /**
0538:             * @see org.w3c.dom.Node#getNodeType
0539:             */
0540:            public short getNodeType() {
0541:                if (fDelegate != null) {
0542:                    return fDelegate.getNodeType();
0543:                } else {
0544:                    return fDocument.getNodeType();
0545:                }
0546:            }
0547:
0548:            /**
0549:             * @see org.w3c.dom.Node#getParentNode
0550:             */
0551:            public Node getParentNode() {
0552:                if (fDelegate != null) {
0553:                    return fDelegate.getParentNode();
0554:                } else {
0555:                    return fDocument.getParentNode();
0556:                }
0557:            }
0558:
0559:            /**
0560:             * @see org.w3c.dom.Node#getChildNodes
0561:             */
0562:            public NodeList getChildNodes() {
0563:                if (fDelegate != null) {
0564:                    return fDelegate.getChildNodes();
0565:                } else {
0566:                    return fDocument.getChildNodes();
0567:                }
0568:            }
0569:
0570:            /**
0571:             * @see org.w3c.dom.Node#getFirstChild
0572:             */
0573:            public Node getFirstChild() {
0574:                if (fDelegate != null) {
0575:                    return fDelegate.getFirstChild();
0576:                } else {
0577:                    return fDocument.getFirstChild();
0578:                }
0579:            }
0580:
0581:            /**
0582:             * @see org.w3c.dom.Node#getLastChild
0583:             */
0584:            public Node getLastChild() {
0585:                if (fDelegate != null) {
0586:                    return fDelegate.getLastChild();
0587:                } else {
0588:                    return fDocument.getLastChild();
0589:                }
0590:            }
0591:
0592:            /**
0593:             * @see org.w3c.dom.Node#getPreviousSibling
0594:             */
0595:            public Node getPreviousSibling() {
0596:                if (fDelegate != null) {
0597:                    return fDelegate.getPreviousSibling();
0598:                } else {
0599:                    return fDocument.getPreviousSibling();
0600:                }
0601:            }
0602:
0603:            /**
0604:             * @see org.w3c.dom.Node#getNextSibling
0605:             */
0606:            public Node getNextSibling() {
0607:                if (fDelegate != null) {
0608:                    return fDelegate.getNextSibling();
0609:                } else {
0610:                    return fDocument.getNextSibling();
0611:                }
0612:            }
0613:
0614:            /**
0615:             * @see org.w3c.dom.Node#getAttributes
0616:             */
0617:            public NamedNodeMap getAttributes() {
0618:                if (fDelegate != null) {
0619:                    return fDelegate.getAttributes();
0620:                } else {
0621:                    return fDocument.getAttributes();
0622:                }
0623:            }
0624:
0625:            /**
0626:             * @see org.w3c.dom.Node#getOwnerDocument
0627:             */
0628:            public Document getOwnerDocument() {
0629:                if (fDelegate != null) {
0630:                    return fDelegate.getOwnerDocument();
0631:                } else {
0632:                    return fDocument.getOwnerDocument();
0633:                }
0634:            }
0635:
0636:            /**
0637:             * @see org.w3c.dom.Node#insertBefore
0638:             */
0639:            public Node insertBefore(Node newChild, Node refChild)
0640:                    throws DOMException {
0641:                if (fDelegate != null) {
0642:                    return fDelegate.insertBefore(newChild, refChild);
0643:                } else {
0644:                    return fDocument.insertBefore(newChild, refChild);
0645:                }
0646:            }
0647:
0648:            /**
0649:             * @see org.w3c.dom.Node#replaceChild
0650:             */
0651:            public Node replaceChild(Node newChild, Node oldChild)
0652:                    throws DOMException {
0653:                if (fDelegate != null) {
0654:                    return fDelegate.replaceChild(newChild, oldChild);
0655:                } else {
0656:                    return fDocument.replaceChild(newChild, oldChild);
0657:                }
0658:            }
0659:
0660:            /**
0661:             * @see org.w3c.dom.Node#removeChild
0662:             */
0663:            public Node removeChild(Node oldChild) throws DOMException {
0664:                if (fDelegate != null) {
0665:                    return fDelegate.removeChild(oldChild);
0666:                } else {
0667:                    return fDocument.removeChild(oldChild);
0668:                }
0669:            }
0670:
0671:            /**
0672:             * @see org.w3c.dom.Node#appendChild
0673:             */
0674:            public Node appendChild(Node newChild) throws DOMException {
0675:                if (fDelegate != null) {
0676:                    return fDelegate.appendChild(newChild);
0677:                } else {
0678:                    return fDocument.appendChild(newChild);
0679:                }
0680:            }
0681:
0682:            /**
0683:             * @see org.w3c.dom.Node#normalize
0684:             */
0685:            public void normalize() {
0686:                if (fDelegate != null) {
0687:                    fDelegate.normalize();
0688:                } else {
0689:                    fDocument.normalize();
0690:                }
0691:            }
0692:
0693:            /**
0694:             * @see org.w3c.dom.Node#isSupported(String, String)
0695:             */
0696:            public boolean isSupported(String feature, String version) {
0697:                if (fDelegate != null) {
0698:                    return fDelegate.isSupported(feature, version);
0699:                } else {
0700:                    return fDocument.isSupported(feature, version);
0701:                }
0702:            }
0703:
0704:            /**
0705:             * @see org.w3c.dom.Node#getNamespaceURI
0706:             */
0707:            public String getNamespaceURI() {
0708:                if (fDelegate != null) {
0709:                    return fDelegate.getNamespaceURI();
0710:                } else {
0711:                    return fDocument.getNamespaceURI();
0712:                }
0713:            }
0714:
0715:            /**
0716:             * @see org.w3c.dom.Node#getPrefix
0717:             */
0718:            public String getPrefix() {
0719:                if (fDelegate != null) {
0720:                    return fDelegate.getPrefix();
0721:                } else {
0722:                    return fDocument.getPrefix();
0723:                }
0724:            }
0725:
0726:            /**
0727:             * @see org.w3c.dom.Node#setPrefix
0728:             */
0729:            public void setPrefix(String prefix) {
0730:                if (fDelegate != null) {
0731:                    fDelegate.setPrefix(prefix);
0732:                } else {
0733:                    fDocument.setPrefix(prefix);
0734:                }
0735:            }
0736:
0737:            /**
0738:             * @see org.w3c.dom.Node#getLocalName
0739:             */
0740:            public String getLocalName() {
0741:                if (fDelegate != null) {
0742:                    return fDelegate.getLocalName();
0743:                } else {
0744:                    return fDocument.getLocalName();
0745:                }
0746:            }
0747:
0748:            /**
0749:             * @see org.w3c.dom.Node#hasChildNodes
0750:             */
0751:            public boolean hasChildNodes() {
0752:                if (fDelegate != null) {
0753:                    return fDelegate.hasChildNodes();
0754:                } else {
0755:                    return fDocument.hasChildNodes();
0756:                }
0757:            }
0758:
0759:            /**
0760:             * @see org.w3c.dom.Node#hasAttributes
0761:             */
0762:            public boolean hasAttributes() {
0763:                if (fDelegate != null) {
0764:                    return fDelegate.hasAttributes();
0765:                } else {
0766:                    return fDocument.hasAttributes();
0767:                }
0768:            }
0769:
0770:            /**
0771:             * @see XMLObject#toDocument
0772:             */
0773:            public String toDocument() {
0774:                // Create formatter if needed (no synchronization necessary)
0775:                if (fFormatter == null) {
0776:                    fFormatter = new DOMFormatter(DOMFormatter
0777:                            .getDefaultOutputOptions(getDocument()));
0778:                }
0779:
0780:                if (fDelegate != null) {
0781:                    return fFormatter.toString(fDelegate);
0782:                } else {
0783:                    return fFormatter.toString(this );
0784:                }
0785:            }
0786:
0787:            /**
0788:             * Recursively synchronize access methods.
0789:             */
0790:            private void syncAccessMethods(Node node) {
0791:                syncWithDocument(node);
0792:                for (Node child = node.getFirstChild(); child != null; child = child
0793:                        .getNextSibling()) {
0794:                    syncAccessMethods(child);
0795:                }
0796:            }
0797:
0798:            /**
0799:             * @see XMLObject#syncAccessMethods
0800:             */
0801:            public void syncAccessMethods() {
0802:                if (fDelegate != null) {
0803:                    fDelegate.syncAccessMethods();
0804:                } else {
0805:                    syncAccessMethods(fDocument);
0806:                }
0807:            }
0808:
0809:            /**
0810:             * Old method to initialize the fields used by the generated access
0811:             * methods from the current state of the document.  This method was
0812:             * poorly named and is deprecated.
0813:             *
0814:             * @deprecated Use <CODE>syncAccessMethods()</CODE> instead.
0815:             * @see #syncAccessMethods
0816:             */
0817:            public void initFields() {
0818:                syncAccessMethods();
0819:            }
0820:
0821:            /**
0822:             * @see DocumentInfo#isURLAttribute
0823:             */
0824:            public boolean isURLAttribute(Element element, String attrName) {
0825:                return getDomFactory().isURLAttribute(element, attrName);
0826:            }
0827:
0828:            /**
0829:             * Used internally to implement a setTextXXX() method.  Adds check for
0830:             * for null value and helps to minimizes the amount of generated code.
0831:             */
0832:            protected final void doSetText(Element element, String text) {
0833:                if (text == null) {
0834:                    throw new IllegalArgumentException(
0835:                            "attempt to set a DOM text node value to null");
0836:                }
0837:                XMLCUtil.getFirstText(element).setData(text);
0838:            }
0839:
0840:            /* (non-Javadoc)
0841:             * @see org.w3c.dom.Document#getInputEncoding()
0842:             */
0843:            public String getInputEncoding() {
0844:                // TODO Auto-generated method stub
0845:                return null;
0846:            }
0847:
0848:            /* (non-Javadoc)
0849:             * @see org.w3c.dom.Document#getXmlEncoding()
0850:             */
0851:            public String getXmlEncoding() {
0852:                // TODO Auto-generated method stub
0853:                return null;
0854:            }
0855:
0856:            /* (non-Javadoc)
0857:             * @see org.w3c.dom.Document#getXmlStandalone()
0858:             */
0859:            public boolean getXmlStandalone() {
0860:                // TODO Auto-generated method stub
0861:                return false;
0862:            }
0863:
0864:            /* (non-Javadoc)
0865:             * @see org.w3c.dom.Document#setXmlStandalone(boolean)
0866:             */
0867:            public void setXmlStandalone(boolean arg0) throws DOMException {
0868:                // TODO Auto-generated method stub
0869:
0870:            }
0871:
0872:            /* (non-Javadoc)
0873:             * @see org.w3c.dom.Document#getXmlVersion()
0874:             */
0875:            public String getXmlVersion() {
0876:                // TODO Auto-generated method stub
0877:                return null;
0878:            }
0879:
0880:            /* (non-Javadoc)
0881:             * @see org.w3c.dom.Document#setXmlVersion(java.lang.String)
0882:             */
0883:            public void setXmlVersion(String arg0) throws DOMException {
0884:                // TODO Auto-generated method stub
0885:
0886:            }
0887:
0888:            /* (non-Javadoc)
0889:             * @see org.w3c.dom.Document#getDocumentURI()
0890:             */
0891:            public String getDocumentURI() {
0892:                // TODO Auto-generated method stub
0893:                return null;
0894:            }
0895:
0896:            /* (non-Javadoc)
0897:             * @see org.w3c.dom.Document#setDocumentURI(java.lang.String)
0898:             */
0899:            public void setDocumentURI(String arg0) {
0900:                // TODO Auto-generated method stub
0901:
0902:            }
0903:
0904:            /* (non-Javadoc)
0905:             * @see org.w3c.dom.Document#getDomConfig()
0906:             */
0907:            public DOMConfiguration getDomConfig() {
0908:                // TODO Auto-generated method stub
0909:                return null;
0910:            }
0911:
0912:            /* (non-Javadoc)
0913:             * @see org.w3c.dom.Document#normalizeDocument()
0914:             */
0915:            public void normalizeDocument() {
0916:                // TODO Auto-generated method stub
0917:
0918:            }
0919:
0920:            /* (non-Javadoc)
0921:             * @see org.w3c.dom.Document#renameNode(org.w3c.dom.Node, java.lang.String, java.lang.String)
0922:             */
0923:            public Node renameNode(Node arg0, String arg1, String arg2)
0924:                    throws DOMException {
0925:                // TODO Auto-generated method stub
0926:                return null;
0927:            }
0928:
0929:            /* (non-Javadoc)
0930:             * @see org.w3c.dom.Node#getBaseURI()
0931:             */
0932:            public String getBaseURI() {
0933:                // TODO Auto-generated method stub
0934:                return null;
0935:            }
0936:
0937:            /* (non-Javadoc)
0938:             * @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node)
0939:             */
0940:            public short compareDocumentPosition(Node arg0) throws DOMException {
0941:                // TODO Auto-generated method stub
0942:                return 0;
0943:            }
0944:
0945:            /* (non-Javadoc)
0946:             * @see org.w3c.dom.Node#getTextContent()
0947:             */
0948:            public String getTextContent() throws DOMException {
0949:                // TODO Auto-generated method stub
0950:                return null;
0951:            }
0952:
0953:            /* (non-Javadoc)
0954:             * @see org.w3c.dom.Node#setTextContent(java.lang.String)
0955:             */
0956:            public void setTextContent(String arg0) throws DOMException {
0957:                // TODO Auto-generated method stub
0958:
0959:            }
0960:
0961:            /* (non-Javadoc)
0962:             * @see org.w3c.dom.Node#isSameNode(org.w3c.dom.Node)
0963:             */
0964:            public boolean isSameNode(Node arg0) {
0965:                // TODO Auto-generated method stub
0966:                return false;
0967:            }
0968:
0969:            /* (non-Javadoc)
0970:             * @see org.w3c.dom.Node#lookupPrefix(java.lang.String)
0971:             */
0972:            public String lookupPrefix(String arg0) {
0973:                // TODO Auto-generated method stub
0974:                return null;
0975:            }
0976:
0977:            /* (non-Javadoc)
0978:             * @see org.w3c.dom.Node#isDefaultNamespace(java.lang.String)
0979:             */
0980:            public boolean isDefaultNamespace(String arg0) {
0981:                // TODO Auto-generated method stub
0982:                return false;
0983:            }
0984:
0985:            /* (non-Javadoc)
0986:             * @see org.w3c.dom.Node#lookupNamespaceURI(java.lang.String)
0987:             */
0988:            public String lookupNamespaceURI(String arg0) {
0989:                // TODO Auto-generated method stub
0990:                return null;
0991:            }
0992:
0993:            /* (non-Javadoc)
0994:             * @see org.w3c.dom.Node#isEqualNode(org.w3c.dom.Node)
0995:             */
0996:            public boolean isEqualNode(Node arg0) {
0997:                // TODO Auto-generated method stub
0998:                return false;
0999:            }
1000:
1001:            /* (non-Javadoc)
1002:             * @see org.w3c.dom.Node#getFeature(java.lang.String, java.lang.String)
1003:             */
1004:            public Object getFeature(String arg0, String arg1) {
1005:                // TODO Auto-generated method stub
1006:                return null;
1007:            }
1008:
1009:            /* (non-Javadoc)
1010:             * @see org.w3c.dom.Node#setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler)
1011:             */
1012:            public Object setUserData(String arg0, Object arg1,
1013:                    UserDataHandler arg2) {
1014:                // TODO Auto-generated method stub
1015:                return null;
1016:            }
1017:
1018:            /* (non-Javadoc)
1019:             * @see org.w3c.dom.Node#getUserData(java.lang.String)
1020:             */
1021:            public Object getUserData(String arg0) {
1022:                // TODO Auto-generated method stub
1023:                return null;
1024:            }
1025:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.