create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / file / configuration / XmlElement.java
1 package net.sf.openrocket.file.configuration;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 /**
7  * A base simple XML element.  A simple XML element can contain either other XML elements
8  * (XmlContainerElement) or textual content (XmlContentElement), but not both.
9  * 
10  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
11  */
12 public abstract class XmlElement {
13         
14         private final String name;
15         private final HashMap<String, String> attributes = new HashMap<String, String>();
16         
17         
18
19         public XmlElement(String name) {
20                 this.name = name;
21         }
22         
23         
24         public String getName() {
25                 return name;
26         }
27         
28         public void setAttribute(String key, String value) {
29                 attributes.put(key, value);
30         }
31         
32         public void removeAttribute(String key) {
33                 attributes.remove(key);
34         }
35         
36         public String getAttribute(String key) {
37                 return attributes.get(key);
38         }
39         
40         @SuppressWarnings("unchecked")
41         public Map<String, String> getAttributes() {
42                 return (Map<String, String>) attributes.clone();
43         }
44         
45 }