Source Code Cross Referenced for DOMDocumentImpl.java in  » HTML-Parser » JTidy » org » w3c » tidy » 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 » HTML Parser » JTidy » org.w3c.tidy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Java HTML Tidy - JTidy
003:         *  HTML parser and pretty printer
004:         *
005:         *  Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
006:         *  Institute of Technology, Institut National de Recherche en
007:         *  Informatique et en Automatique, Keio University). All Rights
008:         *  Reserved.
009:         *
010:         *  Contributing Author(s):
011:         *
012:         *     Dave Raggett <dsr@w3.org>
013:         *     Andy Quick <ac.quick@sympatico.ca> (translation to Java)
014:         *     Gary L Peskin <garyp@firstech.com> (Java development)
015:         *     Sami Lempinen <sami@lempinen.net> (release management)
016:         *     Fabrizio Giustina <fgiust at users.sourceforge.net>
017:         *
018:         *  The contributing author(s) would like to thank all those who
019:         *  helped with testing, bug fixes, and patience.  This wouldn't
020:         *  have been possible without all of you.
021:         *
022:         *  COPYRIGHT NOTICE:
023:         * 
024:         *  This software and documentation is provided "as is," and
025:         *  the copyright holders and contributing author(s) make no
026:         *  representations or warranties, express or implied, including
027:         *  but not limited to, warranties of merchantability or fitness
028:         *  for any particular purpose or that the use of the software or
029:         *  documentation will not infringe any third party patents,
030:         *  copyrights, trademarks or other rights. 
031:         *
032:         *  The copyright holders and contributing author(s) will not be
033:         *  liable for any direct, indirect, special or consequential damages
034:         *  arising out of any use of the software or documentation, even if
035:         *  advised of the possibility of such damage.
036:         *
037:         *  Permission is hereby granted to use, copy, modify, and distribute
038:         *  this source code, or portions hereof, documentation and executables,
039:         *  for any purpose, without fee, subject to the following restrictions:
040:         *
041:         *  1. The origin of this source code must not be misrepresented.
042:         *  2. Altered versions must be plainly marked as such and must
043:         *     not be misrepresented as being the original source.
044:         *  3. This Copyright notice may not be removed or altered from any
045:         *     source or altered source distribution.
046:         * 
047:         *  The copyright holders and contributing author(s) specifically
048:         *  permit, without fee, and encourage the use of this source code
049:         *  as a component for supporting the Hypertext Markup Language in
050:         *  commercial products. If you use this source code in a product,
051:         *  acknowledgment is not required but would be appreciated.
052:         *
053:         */
054:        package org.w3c.tidy;
055:
056:        import org.w3c.dom.DOMConfiguration;
057:        import org.w3c.dom.DOMException;
058:
059:        /**
060:         * DOMDocumentImpl.
061:         * @author Dave Raggett <a href="mailto:dsr@w3.org">dsr@w3.org </a>
062:         * @author Andy Quick <a href="mailto:ac.quick@sympatico.ca">ac.quick@sympatico.ca </a> (translation to Java)
063:         * @author Fabrizio Giustina
064:         * @version $Revision: 1.13 $ ($Author: fgiust $)
065:         */
066:        public class DOMDocumentImpl extends DOMNodeImpl implements 
067:                org.w3c.dom.Document {
068:
069:            /**
070:             * A DOM Document has its own TagTable.
071:             */
072:            private TagTable tt;
073:
074:            /**
075:             * Instantiates a new Dom document with a default tag table.
076:             * @param adaptee tidy Node
077:             */
078:            protected DOMDocumentImpl(Node adaptee) {
079:                super (adaptee);
080:                this .tt = new TagTable();
081:            }
082:
083:            /**
084:             * @see org.w3c.dom.Node#getNodeName
085:             */
086:            public String getNodeName() {
087:                return "#document";
088:            }
089:
090:            /**
091:             * @see org.w3c.dom.Node#getNodeType
092:             */
093:            public short getNodeType() {
094:                return org.w3c.dom.Node.DOCUMENT_NODE;
095:            }
096:
097:            /**
098:             * @see org.w3c.dom.Document#getDoctype
099:             */
100:            public org.w3c.dom.DocumentType getDoctype() {
101:                Node node = this .adaptee.content;
102:                while (node != null) {
103:                    if (node.type == Node.DOCTYPE_TAG) {
104:                        break;
105:                    }
106:                    node = node.next;
107:                }
108:                if (node != null) {
109:                    return (org.w3c.dom.DocumentType) node.getAdapter();
110:                }
111:
112:                return null;
113:            }
114:
115:            /**
116:             * @todo DOM level 2 getImplementation() Not implemented. Throws NOT_SUPPORTED_ERR.
117:             * @see org.w3c.dom.Document#getImplementation
118:             */
119:            public org.w3c.dom.DOMImplementation getImplementation() {
120:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
121:                        "DOM method not supported");
122:            }
123:
124:            /**
125:             * @see org.w3c.dom.Document#getDocumentElement
126:             */
127:            public org.w3c.dom.Element getDocumentElement() {
128:                Node node = this .adaptee.content;
129:                while (node != null) {
130:                    if (node.type == Node.START_TAG
131:                            || node.type == Node.START_END_TAG) {
132:                        break;
133:                    }
134:                    node = node.next;
135:                }
136:                if (node != null) {
137:                    return (org.w3c.dom.Element) node.getAdapter();
138:                }
139:
140:                return null;
141:            }
142:
143:            /**
144:             * @see org.w3c.dom.Document#createElement
145:             */
146:            public org.w3c.dom.Element createElement(String tagName)
147:                    throws DOMException {
148:                Node node = new Node(Node.START_END_TAG, null, 0, 0, tagName,
149:                        this .tt);
150:                if (node != null) {
151:                    if (node.tag == null) // Fix Bug 121206
152:                    {
153:                        node.tag = TagTable.XML_TAGS;
154:                    }
155:                    return (org.w3c.dom.Element) node.getAdapter();
156:                }
157:
158:                return null;
159:            }
160:
161:            /**
162:             * @todo DOM level 2 createDocumentFragment() Not implemented. Throws NOT_SUPPORTED_ERR.
163:             * @see org.w3c.dom.Document#createDocumentFragment
164:             */
165:            public org.w3c.dom.DocumentFragment createDocumentFragment() {
166:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
167:                        "DOM method not supported");
168:            }
169:
170:            /**
171:             * @see org.w3c.dom.Document#createTextNode
172:             */
173:            public org.w3c.dom.Text createTextNode(String data) {
174:                byte[] textarray = TidyUtils.getBytes(data);
175:                Node node = new Node(Node.TEXT_NODE, textarray, 0,
176:                        textarray.length);
177:                if (node != null) {
178:                    return (org.w3c.dom.Text) node.getAdapter();
179:                }
180:
181:                return null;
182:            }
183:
184:            /**
185:             * @see org.w3c.dom.Document#createComment
186:             */
187:            public org.w3c.dom.Comment createComment(String data) {
188:                byte[] textarray = TidyUtils.getBytes(data);
189:                Node node = new Node(Node.COMMENT_TAG, textarray, 0,
190:                        textarray.length);
191:                if (node != null) {
192:                    return (org.w3c.dom.Comment) node.getAdapter();
193:                }
194:
195:                return null;
196:            }
197:
198:            /**
199:             * @todo DOM level 2 createCDATASection() Not supported. Throws NOT_SUPPORTED_ERR.
200:             * @see org.w3c.dom.Document#createCDATASection
201:             */
202:            public org.w3c.dom.CDATASection createCDATASection(String data)
203:                    throws DOMException {
204:                // NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
205:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
206:                        "HTML document");
207:            }
208:
209:            /**
210:             * @todo DOM level 2 createProcessingInstruction() Not supported. Throws NOT_SUPPORTED_ERR.
211:             * @see org.w3c.dom.Document#createProcessingInstruction
212:             */
213:            public org.w3c.dom.ProcessingInstruction createProcessingInstruction(
214:                    String target, String data) throws DOMException {
215:                // NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
216:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
217:                        "HTML document");
218:            }
219:
220:            /**
221:             * @see org.w3c.dom.Document#createAttribute
222:             */
223:            public org.w3c.dom.Attr createAttribute(String name)
224:                    throws DOMException {
225:                AttVal av = new AttVal(null, null, '"', name, null);
226:                if (av != null) {
227:                    av.dict = AttributeTable.getDefaultAttributeTable()
228:                            .findAttribute(av);
229:                    return av.getAdapter();
230:                }
231:
232:                return null;
233:            }
234:
235:            /**
236:             * @todo DOM level 2 createEntityReference() Not supported. Throws NOT_SUPPORTED_ERR.
237:             * @see org.w3c.dom.Document#createEntityReference
238:             */
239:            public org.w3c.dom.EntityReference createEntityReference(String name)
240:                    throws DOMException {
241:                // NOT_SUPPORTED_ERR: Raised if this document is an HTML document
242:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
243:                        "createEntityReference not supported");
244:            }
245:
246:            /**
247:             * @see org.w3c.dom.Document#getElementsByTagName
248:             */
249:            public org.w3c.dom.NodeList getElementsByTagName(String tagname) {
250:                return new DOMNodeListByTagNameImpl(this .adaptee, tagname);
251:            }
252:
253:            /**
254:             * @todo DOM level 2 importNode() Not supported. Throws NOT_SUPPORTED_ERR.
255:             * @see org.w3c.dom.Document#importNode(org.w3c.dom.Node, boolean)
256:             */
257:            public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
258:                    boolean deep) throws org.w3c.dom.DOMException {
259:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
260:                        "importNode not supported");
261:            }
262:
263:            /**
264:             * @todo DOM level 2 createAttributeNS() Not supported. Throws NOT_SUPPORTED_ERR.
265:             * @see org.w3c.dom.Document#createAttributeNS(java.lang.String, java.lang.String)
266:             */
267:            public org.w3c.dom.Attr createAttributeNS(String namespaceURI,
268:                    String qualifiedName) throws org.w3c.dom.DOMException {
269:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
270:                        "createAttributeNS not supported");
271:            }
272:
273:            /**
274:             * @todo DOM level 2 createElementNS() Not supported. Throws NOT_SUPPORTED_ERR.
275:             * @see org.w3c.dom.Document#createElementNS(java.lang.String, java.lang.String)
276:             */
277:            public org.w3c.dom.Element createElementNS(String namespaceURI,
278:                    String qualifiedName) throws org.w3c.dom.DOMException {
279:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
280:                        "createElementNS not supported");
281:            }
282:
283:            /**
284:             * @todo DOM level 2 getElementsByTagNameNS() Not supported. Throws NOT_SUPPORTED_ERR.
285:             * @see org.w3c.dom.Document#getElementsByTagNameNS(java.lang.String, java.lang.String)
286:             */
287:            public org.w3c.dom.NodeList getElementsByTagNameNS(
288:                    String namespaceURI, String localName) {
289:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
290:                        "getElementsByTagNameNS not supported");
291:            }
292:
293:            /**
294:             * @todo DOM level 2 getElementById() Not implemented. Returns null.
295:             * @see org.w3c.dom.Document#getElementById(java.lang.String)
296:             */
297:            public org.w3c.dom.Element getElementById(String elementId) {
298:                return null;
299:            }
300:
301:            /**
302:             * @todo DOM level 3 adoptNode() Not implemented.
303:             * @see org.w3c.dom.Document#adoptNode(org.w3c.dom.Node)
304:             */
305:            public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source)
306:                    throws DOMException {
307:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
308:                        "DOM method not supported");
309:            }
310:
311:            /**
312:             * @todo DOM level 3 getDocumentURI() Not implemented. Returns null.
313:             * @see org.w3c.dom.Document#getDocumentURI()
314:             */
315:            public String getDocumentURI() {
316:                return null;
317:            }
318:
319:            /**
320:             * @todo DOM level 3 getDomConfig() Not implemented. Returns null.
321:             * @see org.w3c.dom.Document#getDomConfig()
322:             */
323:            public DOMConfiguration getDomConfig() {
324:                return null;
325:            }
326:
327:            /**
328:             * @todo DOM level 3 getInputEncoding() Not implemented. Returns null.
329:             * @see org.w3c.dom.Document#getInputEncoding()
330:             */
331:            public String getInputEncoding() {
332:                return null;
333:            }
334:
335:            /**
336:             * @todo DOM level 3 getStrictErrorChecking() Not implemented. Returns true.
337:             * @see org.w3c.dom.Document#getStrictErrorChecking()
338:             */
339:            public boolean getStrictErrorChecking() {
340:                return true;
341:            }
342:
343:            /**
344:             * @todo DOM level 3 getXmlEncoding() Not implemented. Returns null.
345:             * @see org.w3c.dom.Document#getXmlEncoding()
346:             */
347:            public String getXmlEncoding() {
348:                return null;
349:            }
350:
351:            /**
352:             * @todo DOM level 3 getXmlStandalone() Not implemented. Returns false.
353:             * @see org.w3c.dom.Document#getXmlStandalone()
354:             */
355:            public boolean getXmlStandalone() {
356:                return false;
357:            }
358:
359:            /**
360:             * @todo DOM level 3 getXmlVersion() Not implemented. Always returns "1.0".
361:             * @see org.w3c.dom.Document#getXmlVersion()
362:             */
363:            public String getXmlVersion() {
364:                // An attribute specifying, as part of the XML declaration, the version number of this document. If there is no
365:                // declaration and if this document supports the "XML" feature, the value is "1.0"
366:                return "1.0";
367:            }
368:
369:            /**
370:             * @todo DOM level 3 normalizeDocument() Not implemented. Do nothing.
371:             * @see org.w3c.dom.Document#normalizeDocument()
372:             */
373:            public void normalizeDocument() {
374:                // do nothing
375:            }
376:
377:            /**
378:             * @todo DOM level 3 renameNode() Not implemented. Throws NOT_SUPPORTED_ERR.
379:             * @see org.w3c.dom.Document#renameNode(org.w3c.dom.Node, java.lang.String, java.lang.String)
380:             */
381:            public org.w3c.dom.Node renameNode(org.w3c.dom.Node n,
382:                    String namespaceURI, String qualifiedName)
383:                    throws DOMException {
384:                throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
385:                        "DOM method not supported");
386:            }
387:
388:            /**
389:             * @todo DOM level 3 setDocumentURI() Not implemented. Do nothing.
390:             * @see org.w3c.dom.Document#setDocumentURI(java.lang.String)
391:             */
392:            public void setDocumentURI(String documentURI) {
393:                // do nothing
394:            }
395:
396:            /**
397:             * @todo DOM level 3 setStrictErrorChecking() Not implemented. Do nothing.
398:             * @see org.w3c.dom.Document#setStrictErrorChecking(boolean)
399:             */
400:            public void setStrictErrorChecking(boolean strictErrorChecking) {
401:                // do nothing
402:            }
403:
404:            /**
405:             * @todo DOM level 3 setXmlStandalone() Not implemented. Do nothing.
406:             * @see org.w3c.dom.Document#setXmlStandalone(boolean)
407:             */
408:            public void setXmlStandalone(boolean xmlStandalone)
409:                    throws DOMException {
410:                // do nothing
411:            }
412:
413:            /**
414:             * @todo DOM level 3 setXmlVersion() Not implemented. Do nothing.
415:             * @see org.w3c.dom.Document#setXmlVersion(java.lang.String)
416:             */
417:            public void setXmlVersion(String xmlVersion) throws DOMException {
418:                // do nothing
419:            }
420:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.