diff --git a/res/raw/skuska.xml b/res/raw/skuska.xml index 76d8e2e..e9c197f 100644 --- a/res/raw/skuska.xml +++ b/res/raw/skuska.xml @@ -15,7 +15,76 @@ - + + + + + + + FMFI + FMFI + + + + .KAFZMUcitel1 + + + KAFZM + KAFZM + + + + .KAFZMUcitel10 + + + KAFZM + KAFZM + + + + + + + 0 + 0 + + + + A + 330 + u + FMFI PP A + + + B + 220 + u + FMFI PP B + + + + + Mechanika + FMFI.KAFZM/1-FYZ-110/00 + 1-FYZ-110 + 7 + 6K + + + Molekulová fyzika + FMFI.KAFZM/1-FYZ-155/00 + 1-FYZ-155 + 3 + 2K + + + Úvod do astronómie + FMFI.KAFZM/1-FYZ-410/00 + 1-FYZ-410 + 3 + 2P + + pon @@ -23,23 +92,41 @@ 885 A 1 - FMFI.KAFZM/1-FYZ-110/00 + XXXPRED010 UCI1 n 1 + + + pon + 840 + 885 + B + 1 + XXXPRED010 + UCI1 + + n + 2 + + + + + pon + 840 + 885 + F1 + 1 + XXXPRED010 + UCI1 + + n + 3 + + - - - - Mechanika - FMFI.KAFZM/1-FYZ-110/00 - 1-FYZ-110 - 7 - 6K - - \ No newline at end of file diff --git a/res/raw/skuska.xml~ b/res/raw/skuska.xml~ index 14001cc..76d8e2e 100644 --- a/res/raw/skuska.xml~ +++ b/res/raw/skuska.xml~ @@ -23,7 +23,7 @@ 885 A 1 - 1-FYZ-110 + FMFI.KAFZM/1-FYZ-110/00 UCI1 n diff --git a/src/com/svt/candle/XMLParsing/DataHandlerIf.java b/src/com/svt/candle/XMLParsing/DataHandlerIf.java new file mode 100644 index 0000000..af44a7f --- /dev/null +++ b/src/com/svt/candle/XMLParsing/DataHandlerIf.java @@ -0,0 +1,207 @@ +package com.svt.candle.XMLParsing; + +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; +import Database.DatabaseManager; +import android.util.Log; +/** + * trieda na parsovanie xml a ukladanie do databazy vsetky udaje, xperia8 2:40, sax parser if else + */ +public class DataHandlerIf extends DefaultHandler { + // na vkladanie udajov do databazy + private DatabaseManager dbManager = null; + // zakladne + private Boolean bUcitelia = false; + private Boolean bMiestnosti = false; + private Boolean bPredmety = false; + private Boolean bHodiny = false; + + private HodinaData hodinaData = null; + private PredmetyData predmetyData = null; + private MiestrnostData miestnostData = null; + private UciteliaData uciteliaData = null; + + String chars = null; + + public DataHandlerIf(DatabaseManager dbManager) { + this.dbManager = dbManager; + predmetyData = new PredmetyData(); + hodinaData = new HodinaData(); + miestnostData = new MiestrnostData(); + uciteliaData = new UciteliaData(); + } + + @Override + public void startDocument() throws SAXException { + Log.d("ParserXMl", "Dostal som sa do handlera1"); + } + + @Override + public void endDocument() throws SAXException { + } + + @Override + public void startElement(String namespaceURI, String localName, + String qName, org.xml.sax.Attributes atts) throws SAXException { + + if (bHodiny) { + if (localName.charAt(0) == 'h') { + hodinaData.ID = atts.getValue("id"); + } + } else if (bUcitelia) { + if (localName.charAt(0) == 'u') { + uciteliaData.ID = atts.getValue("id"); + } + } else if (bPredmety) { + if (localName.charAt(0) == 'p') { + predmetyData.ID = atts.getValue("id"); + } + } else if (bMiestnosti) { // setrenie casu + } else if (localName.equals("typ")) { + dbManager.insertTypHodin(atts.getValue("id"), + atts.getValue("popis")); + } else if (localName.equals("typmiestnosti")) { + dbManager.insertTypMiestnosti(atts.getValue("id"), + atts.getValue("popis")); + } else if (localName.equals("hodiny")) { + Log.d("parsovanie", "hodiny"); + bHodiny = true; + } else if (localName.equals("ucitelia")) { + bUcitelia = true; + Log.d("parsovanie", "ucitelia"); + } else if (localName.equals("predmety")) { + bPredmety = true; + Log.d("parsovanie", "predmety"); + } else if (localName.equals("miestnosti")) { + bMiestnosti = true; + Log.d("parsovanie", "miestnosti"); + } + } + + @Override + public void endElement(String namespaceURI, String localName, String qName) + throws SAXException { + + if (bHodiny) { + if (localName.charAt(0) == 'd') + hodinaData.DEN = chars; + else if (localName.charAt(0) == 'z') { + if (localName.charAt(1) == 'a') + hodinaData.ZACIATOK = chars; + } else if (localName.charAt(0) == 'k') + if (localName.charAt(1) == 'o') + hodinaData.KONIEC = chars; + else + hodinaData.KRUZKY = chars; + else if (localName.charAt(0) == 'm') + hodinaData.MIESTNOST = chars; + else if (localName.charAt(0) == 't') + if (localName.charAt(1) == 'r') + hodinaData.TRVANIE = chars; + else + hodinaData.TYP = chars; + else if (localName.charAt(0) == 'p') + if (localName.charAt(1) == 'o') + hodinaData.POZNAMKA = chars; + else + hodinaData.PREDMET = chars; + else if (localName.charAt(0) == 'u') + hodinaData.UCITELIA = chars; + else if (localName.charAt(0) == 'o') + hodinaData.OLDID = chars; + else if (localName.charAt(5) == 'y') + bHodiny = false; + else { + dbManager.insertHodina(hodinaData.ID, hodinaData.DEN, + hodinaData.ZACIATOK, hodinaData.KONIEC, + hodinaData.MIESTNOST, hodinaData.TRVANIE, + hodinaData.PREDMET, hodinaData.UCITELIA, + hodinaData.KRUZKY, hodinaData.TYP, hodinaData.OLDID, + hodinaData.POZNAMKA); + // Log.d("hodina", hodinaData.ID+ hodinaData.DEN+ + // hodinaData.ZACIATOK+ hodinaData.KONIEC+ + // hodinaData.MIESTNOST+ hodinaData.TRVANIE+ + // hodinaData.PREDMET+ hodinaData.UCITELIA+ + // hodinaData.KRUZKY+ hodinaData.TYP+ hodinaData.OLDID+ + // hodinaData.POZNAMKA ); + } + + } else if (bPredmety) { + + if (localName.charAt(0) == 'n') + predmetyData.NAZOV = chars; + else if (localName.charAt(0) == 'r') + predmetyData.ROZSAH = chars; + else if (localName.charAt(2) == 'a') + predmetyData.KRATKYKOD = chars; + else if (localName.charAt(1) == 'o') + predmetyData.KOD = chars; + else if (localName.charAt(0) == 'k') + predmetyData.KREDITY = chars; + else if (localName.length() == 8) + bPredmety = false; + else { + dbManager.insertPredmety(predmetyData.ID, predmetyData.NAZOV, + predmetyData.KOD, predmetyData.KRATKYKOD, + predmetyData.KREDITY, predmetyData.ROZSAH); + // Log.d("predmety", predmetyData.ID + predmetyData.NAZOV + + // predmetyData.KOD + predmetyData.KRATKYKOD + + // predmetyData.KREDITY + predmetyData.ROZSAH); + } + + } else if (bUcitelia) { + + if (localName.charAt(0) == 'm') + uciteliaData.MENO = chars; + else if (localName.charAt(0) == 'i') + uciteliaData.INICIALA = chars; + else if (localName.charAt(0) == 'p') + uciteliaData.PRIEZVISKO = chars; + else if (localName.charAt(0) == 'k') + uciteliaData.KATEDRA = chars; + else if (localName.charAt(0) == 'o') + uciteliaData.ODDELENIE = chars; + else if (localName.charAt(0) == 'l') + uciteliaData.LOGIN = chars; + else if (localName.length() == 8) + bUcitelia = false; + else { + dbManager.insertUcitel(uciteliaData.ID, + uciteliaData.PRIEZVISKO, uciteliaData.MENO, + uciteliaData.INICIALA, uciteliaData.KATEDRA, + uciteliaData.ODDELENIE, uciteliaData.LOGIN); + // Log.d("ucitelia", uciteliaData.ID+ + // uciteliaData.PRIEZVISKO+ uciteliaData.MENO+ + // uciteliaData.INICIALA+ uciteliaData.KATEDRA+ + // uciteliaData.ODDELENIE+ uciteliaData.LOGIN); + } + } else if (bMiestnosti) { + + if (localName.charAt(0) == 'n') + miestnostData.NAZOV = chars; + else if (localName.charAt(0) == 'k') + miestnostData.KAPACITA = chars; + else if (localName.charAt(0) == 'a') + miestnostData.AISKOD = chars; + else if (localName.charAt(0) == 't') + miestnostData.TYP = chars; + else if (localName.length() == 10) + bMiestnosti = false; + else { + dbManager.insertMiestnost(miestnostData.NAZOV, + miestnostData.KAPACITA, miestnostData.TYP, + miestnostData.AISKOD); + // Log.d("miestnosti", miestnostData.NAZOV+ + // miestnostData.KAPACITA+ miestnostData.TYP+ + // miestnostData.AISKOD); + } + + } + } + + @Override + public void characters(char ch[], int start, int length) { + chars = new String(ch, start, length); + // chars = chars.trim(); + } +} diff --git a/src/com/svt/candle/XMLParsing/DataHandlerSlim.java b/src/com/svt/candle/XMLParsing/DataHandlerSlim.java new file mode 100644 index 0000000..3bfbd0a --- /dev/null +++ b/src/com/svt/candle/XMLParsing/DataHandlerSlim.java @@ -0,0 +1,181 @@ +package com.svt.candle.XMLParsing; + +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; +import Database.DatabaseManager; +import android.util.Log; + +/** + * trieda na parsovanie xml a ukladanie do databazy xperia8 1:30, ignoruje tretinu atributov, ktore nemaju pouzitie + * Okresany o atributy: ucitel - iniciala,katedra, oddelenie; miestnost - kapacita, typ, aiskod; predmet - kod, kratkykod, + * kredity, rozsah; hodiny - trvanie, oldid, zviazanehodiny, zviazaneoldid + */ + +public class DataHandlerSlim extends DefaultHandler { + // na vkladanie udajov do databazy + private DatabaseManager dbManager = null; + // zakladne + private Boolean bUcitelia = false; + private Boolean bMiestnosti = false; + private Boolean bPredmety = false; + private Boolean bHodiny = false; + + private HodinaData hodinaData = null; + private PredmetyData predmetyData = null; + private UciteliaData uciteliaData = null; + + String chars = null; + + public DataHandlerSlim(DatabaseManager dbManager) { + this.dbManager = dbManager; + predmetyData = new PredmetyData(); + hodinaData = new HodinaData(); + uciteliaData = new UciteliaData(); + } + + @Override + public void startDocument() throws SAXException { + Log.d("ParserXMl", "Dostal som sa do handlera1"); + } + + @Override + public void endDocument() throws SAXException { + } + + @Override + public void startElement(String namespaceURI, String localName, + String qName, org.xml.sax.Attributes atts) throws SAXException { + + if (bHodiny) { + if (localName.charAt(0) == 'h') { + hodinaData.ID = atts.getValue("id"); + } + } else if (bUcitelia) { + if (localName.charAt(0) == 'u') { + uciteliaData.ID = atts.getValue("id"); + } + } else if (bPredmety) { + if (localName.charAt(0) == 'p') { + predmetyData.ID = atts.getValue("id"); + } + } else if (bMiestnosti) { // setrenie casu + } else if (localName.equals("typ")) { + dbManager.insertTypHodin(atts.getValue("id"), + atts.getValue("popis")); + } else if (localName.equals("typmiestnosti")) { + dbManager.insertTypMiestnosti(atts.getValue("id"), + atts.getValue("popis")); + } else if (localName.equals("hodiny")) { + Log.d("parsovanie", "hodiny"); + bHodiny = true; + } else if (localName.equals("ucitelia")) { + bUcitelia = true; + Log.d("parsovanie", "ucitelia"); + } else if (localName.equals("predmety")) { + bPredmety = true; + Log.d("parsovanie", "predmety"); + } else if (localName.equals("miestnosti")) { + bMiestnosti = true; + Log.d("parsovanie", "miestnosti"); + } + } + + @Override + public void endElement(String namespaceURI, String localName, String qName) + throws SAXException { + + if (bHodiny) { + if (localName.charAt(0) == 'd') + hodinaData.DEN = chars; + else if (localName.charAt(0) == 'z') { + if (localName.charAt(1) == 'a') + hodinaData.ZACIATOK = chars; + } else if (localName.charAt(0) == 'k') + if (localName.charAt(1) == 'o') + hodinaData.KONIEC = chars; + else + hodinaData.KRUZKY = chars; + else if (localName.charAt(0) == 'm') + hodinaData.MIESTNOST = chars; + else if (localName.charAt(0) == 't') { + if (localName.charAt(1) == 'y') + hodinaData.TYP = chars; + + } else if (localName.charAt(0) == 'p') + if (localName.charAt(1) == 'o') + hodinaData.POZNAMKA = chars; + else + hodinaData.PREDMET = chars; + else if (localName.charAt(0) == 'u') + hodinaData.UCITELIA = chars; + else if (localName.charAt(0) == 'o') { + } else if (localName.charAt(5) == 'y') + bHodiny = false; + else { + dbManager.insertHodina(hodinaData.ID, hodinaData.DEN, + hodinaData.ZACIATOK, hodinaData.KONIEC, + hodinaData.MIESTNOST, hodinaData.TRVANIE, + hodinaData.PREDMET, hodinaData.UCITELIA, + hodinaData.KRUZKY, hodinaData.TYP, hodinaData.OLDID, + hodinaData.POZNAMKA); + // Log.d("hodina", hodinaData.ID+ hodinaData.DEN+ + // hodinaData.ZACIATOK+ hodinaData.KONIEC+ + // hodinaData.MIESTNOST+ hodinaData.TRVANIE+ + // hodinaData.PREDMET+ hodinaData.UCITELIA+ + // hodinaData.KRUZKY+ hodinaData.TYP+ hodinaData.OLDID+ + // hodinaData.POZNAMKA ); + } + + } else if (bPredmety) { + + if (localName.charAt(0) == 'n') + predmetyData.NAZOV = chars; + else if (localName.charAt(0) == 'p') { + if (localName.length() == 8) + bPredmety = false; + else { + dbManager.insertPredmety(predmetyData.ID, + predmetyData.NAZOV, null, null, null, null); + // Log.d("predmety", predmetyData.ID + predmetyData.NAZOV + + // predmetyData.KOD + predmetyData.KRATKYKOD + + // predmetyData.KREDITY + predmetyData.ROZSAH); + } + + } + + } else if (bUcitelia) { + + if (localName.charAt(0) == 'm') + uciteliaData.MENO = chars; + + else if (localName.charAt(0) == 'p') + uciteliaData.PRIEZVISKO = chars; + + else if (localName.length() == 8) + bUcitelia = false; + else { + dbManager.insertUcitel(uciteliaData.ID, + uciteliaData.PRIEZVISKO, uciteliaData.MENO, + uciteliaData.INICIALA, uciteliaData.KATEDRA, + uciteliaData.ODDELENIE, uciteliaData.LOGIN); + // Log.d("ucitelia", uciteliaData.ID+ + // uciteliaData.PRIEZVISKO+ uciteliaData.MENO+ + // uciteliaData.INICIALA+ uciteliaData.KATEDRA+ + // uciteliaData.ODDELENIE+ uciteliaData.LOGIN); + } + } else if (bMiestnosti) { + bMiestnosti = false; + + // Log.d("miestnosti", miestnostData.NAZOV+ + // miestnostData.KAPACITA+ miestnostData.TYP+ + // miestnostData.AISKOD); + + } + } + + @Override + public void characters(char ch[], int start, int length) { + chars = new String(ch, start, length); + } + +} diff --git a/src/com/svt/candle/XMLParsing/DataHandlerSwitch.java b/src/com/svt/candle/XMLParsing/DataHandlerSwitch.java new file mode 100644 index 0000000..6d48f4a --- /dev/null +++ b/src/com/svt/candle/XMLParsing/DataHandlerSwitch.java @@ -0,0 +1,269 @@ +package com.svt.candle.XMLParsing; + +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; +import Database.DatabaseManager; +import android.util.Log; +/** + * trieda na parsovanie xml a ukladanie do databazy vsetky udaje, xperia8 2:30, sax parser switch + */ +public class DataHandlerSwitch extends DefaultHandler { + // na vkladanie udajov do databazy + private DatabaseManager dbManager = null; + // zakladne + private Boolean bUcitelia = false; + private Boolean bMiestnosti = false; + private Boolean bPredmety = false; + private Boolean bHodiny = false; + + + private HodinaData hodinaData = null; + private PredmetyData predmetyData = null; + private MiestrnostData miestnostData = null; + private UciteliaData uciteliaData = null; + + String chars = null; + + public enum Tags { + TYP, TYPMIESTNOSTI, UCITEL, MIESTNOST, PREDMET, TYPY, TYPYMIESTNOSTI, UCITELIA, + MIESTNOSTI, PREDMETY, HODINY, ROZVRH, HODINA + } + + public enum TagsTypy { + ID, POPIS + } + + public enum TagsUcitelia { + UCITEL, ID, PRIEZVISKO, MENO, INICIALA, KATEDRA, ODDELENIE, LOGIN, UCITELIA + } + + public enum TagsMiestnosti { + MIESTNOST, NAZOV, KAPACITA, TYP, AISKOD, MIESTNOSTI + } + + public enum TagsPredmety { + PREDMET, NAZOV, KOD, KRATKYKOD, KREDITY, ROZSAH, PREDMETY + } + + public enum TagsHodiny { + HODINA, DEN, ZACIATOK, KONIEC, MIESTNOST, TRVANIE, PREDMET, UCITELIA, KRUZKY, TYP, + OLDID, ZVIAZANEHODINY, ZVIAZANEOLDID, POZNAMKA, HODINY + } + + public DataHandlerSwitch(DatabaseManager dbManager) { + this.dbManager = dbManager; + predmetyData = new PredmetyData(); + hodinaData = new HodinaData(); + miestnostData = new MiestrnostData(); + uciteliaData = new UciteliaData(); + } + + + @Override + public void startDocument() throws SAXException { + Log.d("ParserXMl", "Dostal som sa do handlera1"); + } + + @Override + public void endDocument() throws SAXException {} + + @Override + public void startElement(String namespaceURI, String localName, + String qName, org.xml.sax.Attributes atts) throws SAXException { + + if(bHodiny){ + if (localName.equals("hodina")) { + hodinaData.ID = atts.getValue("id"); + } + } else if(bUcitelia){ + if(localName.equals("ucitel")){ + uciteliaData.ID = atts.getValue("id"); + } + } else if(bPredmety){ + if(localName.equals("predmet")){ + predmetyData.ID = atts.getValue("id"); + } + } else if(bMiestnosti){ //setrenie casu + } else if(localName.equals("typ")){ + dbManager.insertTypHodin(atts.getValue("id"),atts.getValue("popis")); + } else if(localName.equals("typmiestnosti")){ + dbManager.insertTypMiestnosti(atts.getValue("id"),atts.getValue("popis")); + } else if(localName.equals("hodiny")){ + bHodiny = true; + Log.d("parsovanie", "hodiny"); + } else if(localName.equals("ucitelia")){ + bUcitelia = true; + Log.d("parsovanie", "ucitelia"); + } else if(localName.equals("predmety")){ + bPredmety = true; + Log.d("parsovanie", "predmety"); + } else if(localName.equals("miestnosti")){ + bMiestnosti = true; + Log.d("parsovanie", "miestnosti"); + } + } + + @Override + public void endElement(String namespaceURI, String localName, String qName) + throws SAXException { + + if (bHodiny) { + TagsHodiny tag = TagsHodiny.valueOf(localName.toUpperCase()); + + switch (tag) { + case DEN: + hodinaData.DEN = chars; + break; + case ZACIATOK: + hodinaData.ZACIATOK = chars; + break; + case KONIEC: + hodinaData.KONIEC = chars; + break; + case MIESTNOST: + hodinaData.MIESTNOST = chars; + break; + case TRVANIE: + hodinaData.TRVANIE = chars; + break; + case PREDMET: + hodinaData.PREDMET = chars; + break; + case UCITELIA: + hodinaData.UCITELIA = chars; + break; + case KRUZKY: + hodinaData.KRUZKY = chars; + break; + case TYP: + hodinaData.TYP = chars; + break; + case OLDID: + hodinaData.OLDID = chars; + break; + case POZNAMKA: + hodinaData.POZNAMKA = chars; + break; + case HODINY: + bHodiny = false; + break; + case HODINA: + dbManager.insertHodina(hodinaData.ID, hodinaData.DEN, + hodinaData.ZACIATOK, hodinaData.KONIEC, + hodinaData.MIESTNOST, hodinaData.TRVANIE, + hodinaData.PREDMET, hodinaData.UCITELIA, + hodinaData.KRUZKY, hodinaData.TYP, hodinaData.OLDID, + hodinaData.POZNAMKA); + +// String delims = "[,]"; +// String[] ucitelia = hodinaData.UCITELIA.split(delims); +// for (int i = 0; i < ucitelia.length; i++) { +// dbManager.insertHodUcitel(hodinaData.ID, ucitelia[i]); +// } +// String[] kruzky = hodinaData.KRUZKY.split(delims); +// for (int i = 0; i < kruzky.length; i++) { +// dbManager.insertHodKruzok(hodinaData.ID, kruzky[i]); +// } + break; + } + + } else if (bPredmety) { + + TagsPredmety tag = TagsPredmety.valueOf(localName.toUpperCase()); + + switch (tag) { + case NAZOV: + predmetyData.NAZOV = chars; + break; + case KOD: + predmetyData.KOD = chars; + break; + case KRATKYKOD: + predmetyData.KRATKYKOD = chars; + break; + case KREDITY: + predmetyData.KREDITY = chars; + break; + case ROZSAH: + predmetyData.ROZSAH = chars; + break; + case PREDMETY: + bPredmety = false; + break; + case PREDMET: + dbManager.insertPredmety(predmetyData.ID, predmetyData.NAZOV, + predmetyData.KOD, predmetyData.KRATKYKOD, + predmetyData.KREDITY, predmetyData.ROZSAH); + break; + } + + } else if (bMiestnosti) { + + TagsMiestnosti tag = TagsMiestnosti + .valueOf(localName.toUpperCase()); + + switch (tag) { + case NAZOV: + miestnostData.NAZOV = chars; + break; + case KAPACITA: + miestnostData.KAPACITA = chars; + break; + case AISKOD: + miestnostData.AISKOD = chars; + break; + case TYP: + miestnostData.TYP = chars; + break; + case MIESTNOST: + dbManager.insertMiestnost(miestnostData.NAZOV, + miestnostData.KAPACITA, miestnostData.TYP, + miestnostData.AISKOD); + break; + case MIESTNOSTI: + bMiestnosti = false; + break; + } + + } else if (bUcitelia) { +// +// TagsUcitelia tag = TagsUcitelia.valueOf(localName.toUpperCase()); +// +// switch (tag) { +// case MENO: +// uciteliaData.MENO = chars; +// break; +// case PRIEZVISKO: +// uciteliaData.PRIEZVISKO = chars; +// break; +// case KATEDRA: +// uciteliaData.KATEDRA = chars; +// break; +// case ODDELENIE: +// uciteliaData.ODDELENIE = chars; +// break; +// case INICIALA: +// uciteliaData.INICIALA = chars; +// break; +// case LOGIN: +// uciteliaData.LOGIN = chars; +// break; +// case UCITELIA: +// bUcitelia = false; +// break; +// case UCITEL: +// dbManager.insertUcitel(uciteliaData.ID, +// uciteliaData.PRIEZVISKO, uciteliaData.MENO, +// uciteliaData.INICIALA, uciteliaData.KATEDRA, +// uciteliaData.ODDELENIE, uciteliaData.LOGIN); +// break; +// } + } + } + + @Override + public void characters(char ch[], int start, int length) { + chars = new String(ch, start, length); + //chars = chars.trim(); + } +} diff --git a/src/com/svt/candle/XMLParsing/ParserXML.java b/src/com/svt/candle/XMLParsing/ParserXML.java index f392440..e518280 100644 --- a/src/com/svt/candle/XMLParsing/ParserXML.java +++ b/src/com/svt/candle/XMLParsing/ParserXML.java @@ -30,9 +30,7 @@ public void testSpravnehoCitaniaSuboru(){ String line; try { while ((line = r.readLine()) != null) { - total.append(line); - - } + total.append(line); } } catch (IOException e) { Log.e("Parser", e.getMessage()); } @@ -48,11 +46,10 @@ private void parseXml() { SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); - DataHandler dataHandler = new DataHandler(dbManager); + DataHandlerIf dataHandler = new DataHandlerIf(dbManager); xr.setContentHandler(dataHandler); - - InputStreamReader isr = new InputStreamReader(inputStream, "UTF-8"); - InputSource inputSource = new InputSource(isr); + + InputSource inputSource = new InputSource(inputStream); inputSource.setEncoding("UTF-8"); sp.parse(inputSource, dataHandler); } catch (ParserConfigurationException pce) {