1 package net.sf.openrocket.file.simplesax;
3 import java.util.HashMap;
5 import net.sf.openrocket.aerodynamics.Warning;
6 import net.sf.openrocket.aerodynamics.WarningSet;
8 import org.xml.sax.SAXException;
11 * A singleton element handler that does not accept any content in the element
12 * except whitespace text. All subelements are ignored and a warning is produced
13 * of them. It ignores any attributes.
15 * This class can be used for elements that have no content but contain attributes.
17 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
19 public class NullElementHandler extends ElementHandler {
20 public static final NullElementHandler INSTANCE = new NullElementHandler();
22 private static final HashMap<String, String> EMPTY_MAP = new HashMap<String,String>();
24 private NullElementHandler() {
28 public ElementHandler openElement(String element, HashMap<String, String> attributes,
29 WarningSet warnings) {
30 warnings.add(Warning.fromString("Unknown element " + element + ", ignoring."));
35 public void closeElement(String element, HashMap<String, String> attributes,
36 String content, WarningSet warnings) throws SAXException {
37 super.closeElement(element, EMPTY_MAP, content, warnings);