summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/FeedHandler.java12
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/SyndHandler.java3
2 files changed, 12 insertions, 3 deletions
diff --git a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java b/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java
index dfcfcf98d..050daf862 100644
--- a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java
+++ b/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java
@@ -1,12 +1,17 @@
package de.danoeh.antennapod.syndication.handler;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.apache.commons.io.input.XmlStreamReader;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import de.danoeh.antennapod.feed.Feed;
@@ -22,8 +27,13 @@ public class FeedHandler {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
SAXParser saxParser = factory.newSAXParser();
- saxParser.parse(new File(feed.getFile_url()), handler);
+ File file = new File(feed.getFile_url());
+ InputStream inputStream = new FileInputStream(file);
+ Reader inputStreamReader = new XmlStreamReader(file);
+ InputSource inputSource = new InputSource(inputStreamReader);
+ saxParser.parse(inputSource, handler);
+ inputStream.close();
return handler.state.feed;
}
}
diff --git a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
index 31ab0c114..ff7942cdb 100644
--- a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
+++ b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
@@ -47,8 +47,7 @@ public class SyndHandler extends DefaultHandler {
if (!state.tagstack.empty()) {
if (state.getTagstack().size() >= 2) {
if (state.contentBuf != null) {
- String content = new String(ch, start, length);
- state.contentBuf.append(content);
+ state.contentBuf.append(ch, start, length);
}
}
}