Source Code Cross Referenced for ElementImpl.java in  » IDE-Netbeans » xml » org » netbeans » tax » 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 » IDE Netbeans » xml » org.netbeans.tax.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.tax.dom;
043:
044:        import org.w3c.dom.*;
045:        import org.netbeans.tax.*;
046:
047:        /**
048:         *
049:         * @author  Petr Kuzel
050:         */
051:        class ElementImpl extends NodeImpl implements  Element {
052:
053:            private final TreeElement peer;
054:
055:            /** Creates a new instance of ElementImpl */
056:            public ElementImpl(TreeElement peer) {
057:                this .peer = peer;
058:            }
059:
060:            /** Retrieves an attribute value by name.
061:             * @param name The name of the attribute to retrieve.
062:             * @return The <code>Attr</code> value as a string, or the empty string
063:             *   if that attribute does not have a specified or default value.
064:             *
065:             */
066:            public String getAttribute(String name) {
067:                return peer.getAttribute(name).getValue();
068:            }
069:
070:            /** Retrieves an attribute value by local name and namespace URI.
071:             * <br>Documents which do not support the "XML" feature will permit only
072:             * the DOM Level 1 calls for creating/setting elements and attributes.
073:             * Hence, if you specify a non-null namespace URI, these DOMs will never
074:             * find a matching node.
075:             * @param namespaceURI The namespace URI of the attribute to retrieve.
076:             * @param localName The local name of the attribute to retrieve.
077:             * @return The <code>Attr</code> value as a string, or the empty string
078:             *   if that attribute does not have a specified or default value.
079:             * @since DOM Level 2
080:             *
081:             */
082:            public String getAttributeNS(String namespaceURI, String localName) {
083:                throw new UOException();
084:            }
085:
086:            /** Retrieves an attribute node by name.
087:             * <br>To retrieve an attribute node by qualified name and namespace URI,
088:             * use the <code>getAttributeNodeNS</code> method.
089:             * @param name The name (<code>nodeName</code>) of the attribute to
090:             *   retrieve.
091:             * @return The <code>Attr</code> node with the specified name (
092:             *   <code>nodeName</code>) or <code>null</code> if there is no such
093:             *   attribute.
094:             *
095:             */
096:            public Attr getAttributeNode(String name) {
097:                return Wrapper.wrap(peer.getAttribute(name));
098:            }
099:
100:            /** Retrieves an <code>Attr</code> node by local name and namespace URI.
101:             * <br>Documents which do not support the "XML" feature will permit only
102:             * the DOM Level 1 calls for creating/setting elements and attributes.
103:             * Hence, if you specify a non-null namespace URI, these DOMs will never
104:             * find a matching node.
105:             * @param namespaceURI The namespace URI of the attribute to retrieve.
106:             * @param localName The local name of the attribute to retrieve.
107:             * @return The <code>Attr</code> node with the specified attribute local
108:             *   name and namespace URI or <code>null</code> if there is no such
109:             *   attribute.
110:             * @since DOM Level 2
111:             *
112:             */
113:            public Attr getAttributeNodeNS(String namespaceURI, String localName) {
114:                throw new UOException();
115:            }
116:
117:            /** A <code>NamedNodeMap</code> containing the attributes of this node (if
118:             * it is an <code>Element</code>) or <code>null</code> otherwise.
119:             *
120:             */
121:            public NamedNodeMap getAttributes() {
122:                return Wrapper.wrap(peer.getAttributes());
123:            }
124:
125:            /** A <code>NodeList</code> that contains all children of this node. If
126:             * there are no children, this is a <code>NodeList</code> containing no
127:             * nodes.
128:             *
129:             */
130:            public NodeList getChildNodes() {
131:                return Wrapper.wrap(peer.getChildNodes());
132:            }
133:
134:            /** Returns a <code>NodeList</code> of all descendant <code>Elements</code>
135:             * with a given tag name, in the order in which they are encountered in
136:             * a preorder traversal of this <code>Element</code> tree.
137:             * @param name The name of the tag to match on. The special value "*"
138:             *   matches all tags.
139:             * @return A list of matching <code>Element</code> nodes.
140:             *
141:             */
142:            public NodeList getElementsByTagName(String name) {
143:                throw new UOException();
144:            }
145:
146:            /** Returns a <code>NodeList</code> of all the descendant
147:             * <code>Elements</code> with a given local name and namespace URI in
148:             * the order in which they are encountered in a preorder traversal of
149:             * this <code>Element</code> tree.
150:             * <br>Documents which do not support the "XML" feature will permit only
151:             * the DOM Level 1 calls for creating/setting elements and attributes.
152:             * Hence, if you specify a non-null namespace URI, these DOMs will never
153:             * find a matching node.
154:             * @param namespaceURI The namespace URI of the elements to match on. The
155:             *   special value "*" matches all namespaces.
156:             * @param localName The local name of the elements to match on. The
157:             *   special value "*" matches all local names.
158:             * @return A new <code>NodeList</code> object containing all the matched
159:             *   <code>Elements</code>.
160:             * @since DOM Level 2
161:             *
162:             */
163:            public NodeList getElementsByTagNameNS(String namespaceURI,
164:                    String localName) {
165:                throw new UOException();
166:            }
167:
168:            /** The first child of this node. If there is no such node, this returns
169:             * <code>null</code>.
170:             *
171:             */
172:            public Node getFirstChild() {
173:                return Wrapper.wrap(peer.getFirstChild());
174:            }
175:
176:            /** The last child of this node. If there is no such node, this returns
177:             * <code>null</code>.
178:             *
179:             */
180:            public Node getLastChild() {
181:                return Wrapper.wrap(peer.getLastChild());
182:            }
183:
184:            /** The node immediately following this node. If there is no such node,
185:             * this returns <code>null</code>.
186:             *
187:             */
188:            public Node getNextSibling() {
189:                return Children.getNextSibling(peer);
190:            }
191:
192:            /** The name of this node, depending on its type; see the table above.
193:             *
194:             */
195:            public String getNodeName() {
196:                return getTagName();
197:            }
198:
199:            /** A code representing the type of the underlying object, as defined above.
200:             *
201:             */
202:            public short getNodeType() {
203:                return Node.ELEMENT_NODE;
204:            }
205:
206:            /** The value of this node, depending on its type; see the table above.
207:             * When it is defined to be <code>null</code>, setting it has no effect.
208:             * @exception DOMException
209:             *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
210:             * @exception DOMException
211:             *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
212:             *   fit in a <code>DOMString</code> variable on the implementation
213:             *   platform.
214:             *
215:             */
216:            public String getNodeValue() throws DOMException {
217:                return null;
218:            }
219:
220:            /** The parent of this node. All nodes, except <code>Attr</code>,
221:             * <code>Document</code>, <code>DocumentFragment</code>,
222:             * <code>Entity</code>, and <code>Notation</code> may have a parent.
223:             * However, if a node has just been created and not yet added to the
224:             * tree, or if it has been removed from the tree, this is
225:             * <code>null</code>.
226:             *
227:             */
228:            public Node getParentNode() {
229:                return Wrapper.wrap(peer.getParentNode());
230:            }
231:
232:            /** The node immediately preceding this node. If there is no such node,
233:             * this returns <code>null</code>.
234:             *
235:             */
236:            public Node getPreviousSibling() {
237:                return Children.getPreviousSibling(peer);
238:            }
239:
240:            /** The name of the element. For example, in:
241:             * <pre> &lt;elementExample
242:             * id="demo"&gt; ... &lt;/elementExample&gt; , </pre>
243:             *  <code>tagName</code> has
244:             * the value <code>"elementExample"</code>. Note that this is
245:             * case-preserving in XML, as are all of the operations of the DOM. The
246:             * HTML DOM returns the <code>tagName</code> of an HTML element in the
247:             * canonical uppercase form, regardless of the case in the source HTML
248:             * document.
249:             *
250:             */
251:            public String getTagName() {
252:                return peer.getQName();
253:            }
254:
255:            /** Returns <code>true</code> when an attribute with a given name is
256:             * specified on this element or has a default value, <code>false</code>
257:             * otherwise.
258:             * @param name The name of the attribute to look for.
259:             * @return <code>true</code> if an attribute with the given name is
260:             *   specified on this element or has a default value, <code>false</code>
261:             *    otherwise.
262:             * @since DOM Level 2
263:             *
264:             */
265:            public boolean hasAttribute(String name) {
266:                throw new UOException();
267:            }
268:
269:            /** Returns <code>true</code> when an attribute with a given local name and
270:             * namespace URI is specified on this element or has a default value,
271:             * <code>false</code> otherwise.
272:             * <br>Documents which do not support the "XML" feature will permit only
273:             * the DOM Level 1 calls for creating/setting elements and attributes.
274:             * Hence, if you specify a non-null namespace URI, these DOMs will never
275:             * find a matching node.
276:             * @param namespaceURI The namespace URI of the attribute to look for.
277:             * @param localName The local name of the attribute to look for.
278:             * @return <code>true</code> if an attribute with the given local name
279:             *   and namespace URI is specified or has a default value on this
280:             *   element, <code>false</code> otherwise.
281:             * @since DOM Level 2
282:             *
283:             */
284:            public boolean hasAttributeNS(String namespaceURI, String localName) {
285:                throw new UOException();
286:            }
287:
288:            /** Returns whether this node (if it is an element) has any attributes.
289:             * @return <code>true</code> if this node has any attributes,
290:             *   <code>false</code> otherwise.
291:             * @since DOM Level 2
292:             *
293:             */
294:            public boolean hasAttributes() {
295:                return peer.hasAttributes();
296:            }
297:
298:            /** Returns whether this node has any children.
299:             * @return <code>true</code> if this node has any children,
300:             *   <code>false</code> otherwise.
301:             *
302:             */
303:            public boolean hasChildNodes() {
304:                return peer.hasChildNodes();
305:            }
306:
307:            /** Removes an attribute by name. If the removed attribute is known to have
308:             * a default value, an attribute immediately appears containing the
309:             * default value as well as the corresponding namespace URI, local name,
310:             * and prefix when applicable.
311:             * <br>To remove an attribute by local name and namespace URI, use the
312:             * <code>removeAttributeNS</code> method.
313:             * @param name The name of the attribute to remove.
314:             * @exception DOMException
315:             *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
316:             *
317:             */
318:            public void removeAttribute(String name) throws DOMException {
319:                throw new ROException();
320:            }
321:
322:            /** Removes an attribute by local name and namespace URI. If the removed
323:             * attribute has a default value it is immediately replaced. The
324:             * replacing attribute has the same namespace URI and local name, as
325:             * well as the original prefix.
326:             * <br>Documents which do not support the "XML" feature will permit only
327:             * the DOM Level 1 calls for creating/setting elements and attributes.
328:             * Hence, if you specify a non-null namespace URI, these DOMs will never
329:             * find a matching node.
330:             * @param namespaceURI The namespace URI of the attribute to remove.
331:             * @param localName The local name of the attribute to remove.
332:             * @exception DOMException
333:             *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
334:             * @since DOM Level 2
335:             *
336:             */
337:            public void removeAttributeNS(String namespaceURI, String localName)
338:                    throws DOMException {
339:                throw new ROException();
340:            }
341:
342:            /** Removes the specified attribute node. If the removed <code>Attr</code>
343:             * has a default value it is immediately replaced. The replacing
344:             * attribute has the same namespace URI and local name, as well as the
345:             * original prefix, when applicable.
346:             * @param oldAttr The <code>Attr</code> node to remove from the attribute
347:             *   list.
348:             * @return The <code>Attr</code> node that was removed.
349:             * @exception DOMException
350:             *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
351:             *   <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute
352:             *   of the element.
353:             *
354:             */
355:            public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
356:                throw new ROException();
357:            }
358:
359:            /** Adds a new attribute. If an attribute with that name is already present
360:             * in the element, its value is changed to be that of the value
361:             * parameter. This value is a simple string; it is not parsed as it is
362:             * being set. So any markup (such as syntax to be recognized as an
363:             * entity reference) is treated as literal text, and needs to be
364:             * appropriately escaped by the implementation when it is written out.
365:             * In order to assign an attribute value that contains entity
366:             * references, the user must create an <code>Attr</code> node plus any
367:             * <code>Text</code> and <code>EntityReference</code> nodes, build the
368:             * appropriate subtree, and use <code>setAttributeNode</code> to assign
369:             * it as the value of an attribute.
370:             * <br>To set an attribute with a qualified name and namespace URI, use
371:             * the <code>setAttributeNS</code> method.
372:             * @param name The name of the attribute to create or alter.
373:             * @param value Value to set in string form.
374:             * @exception DOMException
375:             *   INVALID_CHARACTER_ERR: Raised if the specified name contains an
376:             *   illegal character.
377:             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
378:             *
379:             */
380:            public void setAttribute(String name, String value)
381:                    throws DOMException {
382:                throw new ROException();
383:            }
384:
385:            /** Adds a new attribute. If an attribute with the same local name and
386:             * namespace URI is already present on the element, its prefix is
387:             * changed to be the prefix part of the <code>qualifiedName</code>, and
388:             * its value is changed to be the <code>value</code> parameter. This
389:             * value is a simple string; it is not parsed as it is being set. So any
390:             * markup (such as syntax to be recognized as an entity reference) is
391:             * treated as literal text, and needs to be appropriately escaped by the
392:             * implementation when it is written out. In order to assign an
393:             * attribute value that contains entity references, the user must create
394:             * an <code>Attr</code> node plus any <code>Text</code> and
395:             * <code>EntityReference</code> nodes, build the appropriate subtree,
396:             * and use <code>setAttributeNodeNS</code> or
397:             * <code>setAttributeNode</code> to assign it as the value of an
398:             * attribute.
399:             * @param namespaceURI The namespace URI of the attribute to create or
400:             *   alter.
401:             * @param qualifiedName The qualified name of the attribute to create or
402:             *   alter.
403:             * @param value The value to set in string form.
404:             * @exception DOMException
405:             *   INVALID_CHARACTER_ERR: Raised if the specified qualified name
406:             *   contains an illegal character, per the XML 1.0 specification .
407:             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
408:             *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
409:             *   malformed per the Namespaces in XML specification, if the
410:             *   <code>qualifiedName</code> has a prefix and the
411:             *   <code>namespaceURI</code> is <code>null</code>, if the
412:             *   <code>qualifiedName</code> has a prefix that is "xml" and the
413:             *   <code>namespaceURI</code> is different from "
414:             *   http://www.w3.org/XML/1998/namespace", or if the
415:             *   <code>qualifiedName</code>, or its prefix, is "xmlns" and the
416:             *   <code>namespaceURI</code> is different from "
417:             *   http://www.w3.org/2000/xmlns/".
418:             *   <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
419:             *   support the <code>"XML"</code> feature, since namespaces were
420:             *   defined by XML.
421:             * @since DOM Level 2
422:             *
423:             */
424:            public void setAttributeNS(String namespaceURI,
425:                    String qualifiedName, String value) throws DOMException {
426:                throw new ROException();
427:            }
428:
429:            /** Adds a new attribute node. If an attribute with that name (
430:             * <code>nodeName</code>) is already present in the element, it is
431:             * replaced by the new one.
432:             * <br>To add a new attribute node with a qualified name and namespace
433:             * URI, use the <code>setAttributeNodeNS</code> method.
434:             * @param newAttr The <code>Attr</code> node to add to the attribute list.
435:             * @return If the <code>newAttr</code> attribute replaces an existing
436:             *   attribute, the replaced <code>Attr</code> node is returned,
437:             *   otherwise <code>null</code> is returned.
438:             * @exception DOMException
439:             *   WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
440:             *   different document than the one that created the element.
441:             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
442:             *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
443:             *   attribute of another <code>Element</code> object. The DOM user must
444:             *   explicitly clone <code>Attr</code> nodes to re-use them in other
445:             *   elements.
446:             *
447:             */
448:            public Attr setAttributeNode(Attr newAttr) throws DOMException {
449:                throw new ROException();
450:            }
451:
452:            /** Adds a new attribute. If an attribute with that local name and that
453:             * namespace URI is already present in the element, it is replaced by
454:             * the new one.
455:             * @param newAttr The <code>Attr</code> node to add to the attribute list.
456:             * @return If the <code>newAttr</code> attribute replaces an existing
457:             *   attribute with the same local name and namespace URI, the replaced
458:             *   <code>Attr</code> node is returned, otherwise <code>null</code> is
459:             *   returned.
460:             * @exception DOMException
461:             *   WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
462:             *   different document than the one that created the element.
463:             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
464:             *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
465:             *   attribute of another <code>Element</code> object. The DOM user must
466:             *   explicitly clone <code>Attr</code> nodes to re-use them in other
467:             *   elements.
468:             *   <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
469:             *   support the <code>"XML"</code> feature, since namespaces were
470:             *   defined by XML.
471:             * @since DOM Level 2
472:             *
473:             */
474:            public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
475:                throw new ROException();
476:            }
477:
478:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.