01: /*
02: * Copyright 2006 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.xml.client;
17:
18: /*
19: * Implementation notes: Internet Explorer does not support any of the namespace
20: * methods, so xxxNS is not supported for all xxx. Safari does not support
21: * Attribute node modification; use <code>setAttribute</code> instead.
22: *
23: */
24:
25: /**
26: * This interface represents XML DOM elements, which are the basic building
27: * block of XML. An example follows:
28: *
29: * <pre>
30: * <sample my_attribute="one">
31: * Some text<child/> more text
32: * </sample>
33: * </pre>
34: */
35: public interface Element extends Node {
36: /**
37: * This method retrieves the attribute which has a name of <code>name</code>.
38: *
39: * @param name the name of the attribute to get the value of
40: * @return the value of the attribute specified by <code>name</code>
41: */
42: public String getAttribute(String name);
43:
44: /**
45: * This method retrieves the attribute node which has a name of
46: * <code>name</code>. This <code>Attr</code> will have the same value as
47: * would be gotten with <code>getAttribute</code>.
48: *
49: * @param name the name of the <code>Attr</code> to get
50: * @return the attribute node of this <code>Element</code>which has a name
51: * of <code>name</code>
52: */
53: public Attr getAttributeNode(String name);
54:
55: /**
56: * This method retrieves the elements by tag name which has a name of
57: * <code>name</code>.
58: *
59: * @param name the name of the <code>Element</code> to get
60: * @return the elements by tag name of this <code>Element</code> which has a
61: * name of <code>name</code>
62: */
63: public NodeList getElementsByTagName(String name);
64:
65: /**
66: * This method retrieves the tag name.
67: *
68: * @return the tag name of this <code>Element</code>
69: */
70: public String getTagName();
71:
72: /**
73: * This method determines whether this <code>Element</code> has an attribute
74: * with the supplied name.
75: *
76: * @param name the name of the attribute
77: * @return <code>true</code> if this <code>Element</code> has an attribute
78: * that name.
79: */
80: public boolean hasAttribute(String name);
81:
82: /**
83: * This method removes the attribute which has the specified name.
84: *
85: * @param name the name of the attribute to remove
86: */
87: public void removeAttribute(String name);
88:
89: /**
90: * This method sets the attribute specified by <code>name</code> to
91: * <code>value</code>.
92: *
93: * @param name the name of the attribute to set
94: * @param value the new value this attribute is to have
95: */
96: public void setAttribute(String name, String value);
97:
98: }
|