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;
12 * An abstract base class for creating an ElementHandler. This implements the close
13 * methods so that warnings are generated for spurious content.
15 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
17 public abstract class AbstractElementHandler implements ElementHandler {
20 public abstract ElementHandler openElement(String element,
21 HashMap<String, String> attributes, WarningSet warnings) throws SAXException;
26 * The default implementation is to add warnings for any textual content or attributes.
27 * This is useful for generating warnings for unknown XML attributes.
30 public void closeElement(String element, HashMap<String, String> attributes,
31 String content, WarningSet warnings) throws SAXException {
33 if (!content.trim().equals("")) {
34 warnings.add(Warning.fromString("Unknown text in element '" + element
37 if (!attributes.isEmpty()) {
38 warnings.add(Warning.fromString("Unknown attributes in element '" + element
46 * The default implementation is a no-op.
49 public void endHandler(String element, HashMap<String, String> attributes,
50 String content, WarningSet warnings) throws SAXException {