Skip to content

Commit

Permalink
Replace implements ContentHandler with extends DefaultHandler to …
Browse files Browse the repository at this point in the history
…remove lots of empty unnecessary handlers.

C'mon why did nobody tell me about this one so far :)
  • Loading branch information
Wilm0r committed Mar 25, 2024
1 parent 9d7aea7 commit 185499d
Showing 1 changed file with 3 additions and 50 deletions.
53 changes: 3 additions & 50 deletions app/src/main/java/net/gaast/giggity/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;

import java.io.BufferedReader;
Expand Down Expand Up @@ -638,7 +639,7 @@ protected void applyItem(Item item) {
// example reminders, etc.
}

private class XcalParser implements ContentHandler {
private class XcalParser extends DefaultHandler {
private HashMap<String,Schedule.Line> tentMap;
private HashMap<String,String> eventData;
private HashMap<String,Attributes> eventDataAttr;
Expand Down Expand Up @@ -779,38 +780,14 @@ public void endElement(String uri, String localName, String qName)
eventData.put(localName, curString);
}
}

@Override
public void setDocumentLocator(Locator locator) {}

@Override
public void startDocument() throws SAXException {}

@Override
public void endDocument() throws SAXException {}

@Override
public void startPrefixMapping(String s, String s1) throws SAXException {}

@Override
public void endPrefixMapping(String s) throws SAXException {}

@Override
public void ignorableWhitespace(char[] chars, int i, int i1) throws SAXException {}

@Override
public void processingInstruction(String s, String s1) throws SAXException {}

@Override
public void skippedEntity(String s) throws SAXException {}
}

/* Pentabarf, the old conference organisation tool has a pretty excellent native XML format
and is now the preferred file format. http://pentabarf.org/Main_Page
It's not really maintained anymore though, a recent fork called Frab is more maintained and
Giggity can read its XML exports just as well https://github.com/frab/frab
*/
private class PentabarfParser implements ContentHandler {
private class PentabarfParser extends DefaultHandler {
private Schedule.Line curTent;
private HashMap<String,Schedule.Line> tentMap;
private HashMap<String,String> propMap;
Expand Down Expand Up @@ -1006,30 +983,6 @@ public void endElement(String uri, String localName, String qName)
propMap.put(localName, curString);
}
}

@Override
public void setDocumentLocator(Locator locator) {}

@Override
public void startDocument() throws SAXException {}

@Override
public void endDocument() throws SAXException {}

@Override
public void startPrefixMapping(String s, String s1) throws SAXException {}

@Override
public void endPrefixMapping(String s) throws SAXException {}

@Override
public void ignorableWhitespace(char[] chars, int i, int i1) throws SAXException {}

@Override
public void processingInstruction(String s, String s1) throws SAXException {}

@Override
public void skippedEntity(String s) throws SAXException {}
}

public enum RoomStatus {
Expand Down

0 comments on commit 185499d

Please sign in to comment.