// FIXME: complain if none
@Override
  public void startElement (String uri, String name, String qName, Attributes atts) throws SAXException {
    try {
    //log.debug("S: '" + uri + "' " + qName);
    // ----- <xfml> -----------------------------------------------------------
    if (EL_XFML.equals(qName)) {
      String version = atts.getValue("version");
      if (version == null)
        log.warn("No version attribute on 'xfml' element");
      if (!"1.0".equals(version))
        log.warn("Unsupported XFML version: " + version);
      String mapurl = atts.getValue("url");
      if (mapurl == null)
        log.warn("No url attribute on 'xfml' element");
      else {
        try {
          map_uri = new URILocator(mapurl);
          TopicMapStoreIF store = topicmap.getStore();
          if (store instanceof AbstractTopicMapStore && store.getBaseAddress() == null)
            ((AbstractTopicMapStore) store).setBaseAddress(map_uri);
          doc_address = map_uri;
          // Add this document to the list of processed documents.
          processed_documents_accumulated.add(getBaseAddress());
        } catch (MalformedURLException e) {
          log.warn("Invalid xfml base URL: " + mapurl);
        }
      }
      // FIXME: what to do about language?
    }
    // ----- <facet> ----------------------------------------------------------
    else if (EL_FACET.equals(qName)) {
      String id = atts.getValue("id");
      // FIXME: complain if no id
      current_topic = builder.makeTopic();
      registerSourceLocator(current_topic, id);
      keep_content = true;
    }
    // ----- <topic> ----------------------------------------------------------
    else if (EL_TOPIC.equals(qName)) {
      String id = atts.getValue("id");
      // FIXME: complain if no id
      current_topic = builder.makeTopic();
      registerSourceLocator(current_topic, id);
      String parentid = atts.getValue("parentTopicid");
      if (parentid == null)
        parentid = atts.getValue("facetid");
      // FIXME: complain if no refs
      TopicIF parent = resolveTopicRef("#" + parentid);
      parentBuilder.makeAssociation(parent, current_topic);
    }
    // ----- <page> -----------------------------------------------------------
    else if (EL_PAGE.equals(qName)) {
      String url = atts.getValue("url");
      // FIXME: complain if no url
      current_topic = builder.makeTopic();
      current_topic.addSubjectLocator(createLocator(url));
    }
    // ----- <occurrence>------------------------------------------------------
    else if (EL_OCCURRENCE.equals(qName)) {
      String topicid = atts.getValue("topicid");
      // FIXME: complain if none
      TopicIF subject = resolveTopicRef("#" + topicid);
      occursBuilder.makeAssociation(subject, current_topic);
    }
    // ----- <name> -----------------------------------------------------------
    // ----- <psi> ------------------------------------------------------------
    // ----- <description> ----------------------------------------------------
    // ----- <title> ----------------------------------------------------------
    // ----- <connect> --------------------------------------------------------
    else if (EL_NAME.equals(qName) || EL_PSI.equals(qName) || EL_DESCRIPTION.equals(qName) ||
            EL_TITLE.equals(qName) || EL_CONNECT.equals(qName)) 
      keep_content = true;   
    } catch (RuntimeException e) {
      e.printStackTrace();
      throw e;
    }
  }
else if (EL_OCCURRENCE.equals(qName)) {
String topicid = atts.getValue("topicid");
// FIXME: complain if none
TopicIF subject = resolveTopicRef("#" + topicid);
occursBuilder.makeAssociation(subject, current_topic);
// ----- <page> -----------------------------------------------------------
else if (EL_PAGE.equals(qName)) {
String url = atts.getValue("url");
// FIXME: complain if no url
current_topic = builder.makeTopic();
current_topic.addSubjectLocator(createLocator(url));
}
// ----- <occurrence>------------------------------------------------------
else if (EL_OCCURRENCE.equals(qName)) {
String topicid = atts.getValue("topicid");
// FIXME: complain if none
TopicIF subject = resolveTopicRef("#" + topicid);
occursBuilder.makeAssociation(subject, current_topic);
}
// ----- <name> -----------------------------------------------------------
// ----- <psi> ------------------------------------------------------------
// ----- <description> ----------------------------------------------------
// ----- <title> ----------------------------------------------------------
// ----- <connect> --------------------------------------------------------
else if (EL_NAME.equals(qName) || EL_PSI.equals(qName) || EL_DESCRIPTION.equals(qName) ||
EL_TITLE.equals(qName) || EL_CONNECT.equals(qName))
// FIXME: complain if no id
current_topic = builder.makeTopic();
registerSourceLocator(current_topic, id);
String parentid = atts.getValue("parentTopicid");
if (parentid == null)
parentid = atts.getValue("facetid");
// FIXME: complain if no refs
TopicIF parent = resolveTopicRef("#" + parentid);
parentBuilder.makeAssociation(parent, current_topic);
}
// ----- <page> -----------------------------------------------------------
else if (EL_PAGE.equals(qName)) {
String url = atts.getValue("url");
// FIXME: complain if no url
current_topic = builder.makeTopic();
current_topic.addSubjectLocator(createLocator(url));
}
// ----- <occurrence>------------------------------------------------------
else if (EL_OCCURRENCE.equals(qName)) {
String topicid = atts.getValue("topicid");
// FIXME: complain if none
TopicIF subject = resolveTopicRef("#" + topicid);
occursBuilder.makeAssociation(subject, current_topic);
}
// ----- <name> -----------------------------------------------------------
// ----- <psi> ------------------------------------------------------------
// ----- <description> ----------------------------------------------------
// ----- <title> ----------------------------------------------------------
// ----- <connect> --------------------------------------------------------
else if (EL_NAME.equals(qName) || EL_PSI.equals(qName) || EL_DESCRIPTION.equals(qName) ||
EL_TITLE.equals(qName) || EL_CONNECT.equals(qName))
keep_content = true;
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
}
}