Class ConfigImporter

java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.ka2ddo.yaac.io.ConfigImporter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ConfigImporter extends DefaultHandler
This class implements an XML parser that can interpret the XML export of a YAAC configuration (as dumped by the Java Preferences code). It tries to provide enough smarts to validate parts of the configuration that might be different when restoring on a different computer (such as directory paths to the tile or log directories, serial port device names, etc.).
Author:
Andrew Pavlin, KA2DDO
  • Method Details

    • parseYAACXMLConfigFile

      public static void parseYAACXMLConfigFile(InputStream is, long fileLength) throws UserAbort
      Throws:
      UserAbort
    • setDocumentLocator

      public void setDocumentLocator(Locator locator)
      Receive a Locator object for document events.
      Specified by:
      setDocumentLocator in interface ContentHandler
      Overrides:
      setDocumentLocator in class DefaultHandler
      Parameters:
      locator - A locator for all SAX document events.
      See Also:
    • startElement

      public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
      Receive notification of the start of an element.
      Specified by:
      startElement in interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
      Parameters:
      uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
      localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
      qName - The qualified name (with prefix), or the empty string if qualified names are not available.
      attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
      Throws:
      SAXException - Any SAX exception, possibly wrapping another exception.
    • endElement

      public void endElement(String uri, String localName, String qName) throws SAXException
      Receive notification of the end of an element.
      Specified by:
      endElement in interface ContentHandler
      Overrides:
      endElement in class DefaultHandler
      Parameters:
      uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
      localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
      qName - The qualified name (with prefix), or the empty string if qualified names are not available.
      Throws:
      SAXException - Any SAX exception, possibly wrapping another exception.