org.oddjob.arooa.xml.XMLArooaAttributes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of arooa Show documentation
Show all versions of arooa Show documentation
A Rip Off Of Ant - A drag and drop component framework.
/*
* (c) Rob Gordon 2006
*/
package org.oddjob.arooa.xml;
import java.util.LinkedHashMap;
import java.util.Map;
import org.oddjob.arooa.parsing.ArooaAttributes;
import org.xml.sax.Attributes;
public class XMLArooaAttributes implements ArooaAttributes {
private final Map attributes =
new LinkedHashMap();
public XMLArooaAttributes(String uri, Attributes attrs) {
for (int i = 0; i < attrs.getLength(); i++) {
String attrUri = attrs.getURI(i);
if (attrUri != null
&& !attrUri.equals("")
&& !attrUri.equals(uri)) {
continue; // Ignore attributes from unknown uris
}
String key = attrs.getLocalName(i);
String value = attrs.getValue(i);
attributes.put(key, value);
}
}
public String get(String name) {
return (String) attributes.get(name);
}
public String[] getAttributNames() {
return (String[]) attributes.keySet().toArray(new String[0]);
}
public String remove(String name) {
return (String) attributes.remove(name);
}
}