Refine search
public static SusiThought readRSS(String url) { SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null; XmlReader xmlreader = new XmlReader(connection.getInputStream()); feed = input.build(xmlreader); } catch (Exception e) { e.printStackTrace();
private void doHttpStream(InputStream is,String httpContentType,boolean lenient) throws IOException { BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE); String cTMime = getContentTypeMime(httpContentType); String cTEnc = getContentTypeEncoding(httpContentType); String bomEnc = getBOMEncoding(pis); String xmlGuessEnc = getXMLGuessEncoding(pis); String xmlEnc = getXmlProlog(pis,xmlGuessEnc); String encoding = calculateHttpEncoding(cTMime, cTEnc, bomEnc, xmlGuessEnc, xmlEnc, pis,lenient); prepareReader(pis,encoding); }
private void doRawStream(InputStream is,boolean lenient) throws IOException { BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE); String bomEnc = getBOMEncoding(pis); String xmlGuessEnc = getXMLGuessEncoding(pis); String xmlEnc = getXmlProlog(pis,xmlGuessEnc); String encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, pis); prepareReader(pis,encoding); }
private SyndFeed readSyndFeedFromStream(InputStream inputStream, URLConnection connection) throws IOException, IllegalArgumentException, FeedException { BufferedInputStream is; if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) { // handle gzip encoded content is = new BufferedInputStream(new GZIPInputStream(inputStream)); } else { is = new BufferedInputStream(inputStream); } //InputStreamReader reader = new InputStreamReader(is, ResponseHandler.getCharacterEncoding(connection)); //SyndFeedInput input = new SyndFeedInput(); XmlReader reader = null; if (connection.getHeaderField("Content-Type") != null) { reader = new XmlReader(is, connection.getHeaderField("Content-Type"), true); } else { reader = new XmlReader(is, true); } SyndFeedInput syndFeedInput = new SyndFeedInput(); syndFeedInput.setPreserveWireFeed(isPreserveWireFeed()); return syndFeedInput.build(reader); }
URL feedSource = new URL("http://...."); feed = new SyndFeedInput().build(new XmlReader(feedSource)); List<SyndEntryImpl> entries = (List<SyndEntryImpl>)feed.getEntries(); for(SyndEntryImpl entry : entries){ System.out.println(entry.getDescription().getValue()); }
URL url = new URL("http://feeds.feedburner.com/javatipsfeed"); XmlReader reader = null; try { reader = new XmlReader(url); SyndFeed feeder = new SyndFeedInput().build(reader); System.out.println("Feed Title: "+ feeder.getAuthor()); for (Iterator i = feeder.getEntries().iterator(); i.hasNext();) { SyndEntry syndEntry = (SyndEntry) i.next(); System.out.println(syndEntry.getTitle()); } } finally { if (reader != null) reader.close(); }
public void loadQuests() { XmlReader r = new XmlReader(); Element e = null; try { e = r.parse(Gdx.files.internal("quest/quest.xml")); } catch (IOException a) { } if (e != null) { for (int i = 0; i < e.getChildCount(); i++) { m_quests.add(new Quest(e.getChild(i))); //has reference to the core class } } }
XmlReader readXML = new XmlReader(); var data = readXML.RetrunListOfProducts();
boolean appXml = isAppXml(cTMime); boolean textXml = isTextXml(cTMime); if (appXml || textXml) { if (cTEnc==null) { if (appXml) { encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, is);
if (conn instanceof HttpURLConnection) { try { doHttpStream(conn.getInputStream(),conn.getContentType(),lenient); doLenientDetection(conn.getContentType(),ex); if (conn.getContentType()!=null) { try { doHttpStream(conn.getInputStream(),conn.getContentType(),lenient); doLenientDetection(conn.getContentType(),ex); doRawStream(conn.getInputStream(),lenient); doLenientDetection(null,ex);
XmlReader reader = new XmlReader(is); WireFeedInput input = new WireFeedInput(); Feed atom = (Feed) input.build(reader);
private void doLenientDetection(String httpContentType,XmlReaderException ex) throws IOException { if (httpContentType!=null) { if (httpContentType.startsWith("text/html")) { httpContentType = httpContentType.substring("text/html".length()); httpContentType = "text/xml" + httpContentType; try { doHttpStream(ex.getInputStream(),httpContentType,true); ex = null; } catch (XmlReaderException ex2) { ex = ex2; } } } if (ex!=null) { String encoding = ex.getXmlEncoding(); if (encoding==null) { encoding = ex.getContentTypeEncoding(); } if (encoding==null) { encoding = (_defaultEncoding == null) ? UTF_8 : _defaultEncoding; } prepareReader(ex.getInputStream(),encoding); } }
_defaultEncoding = (defaultEncoding == null) ? _staticDefaultEncoding : defaultEncoding; try { doRawStream(is,lenient); doLenientDetection(null,ex);
_defaultEncoding = (defaultEncoding == null) ? _staticDefaultEncoding : defaultEncoding; try { doHttpStream(is,httpContentType,lenient); doLenientDetection(httpContentType,ex);
private SyndFeed readSyndFeedFromStream(InputStream inputStream, URLConnection connection) throws IOException, IllegalArgumentException, FeedException { BufferedInputStream is; if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) { // handle gzip encoded content is = new BufferedInputStream(new GZIPInputStream(inputStream)); } else { is = new BufferedInputStream(inputStream); } //InputStreamReader reader = new InputStreamReader(is, ResponseHandler.getCharacterEncoding(connection)); //SyndFeedInput input = new SyndFeedInput(); XmlReader reader = null; if (connection.getHeaderField("Content-Type") != null) { reader = new XmlReader(is, connection.getHeaderField("Content-Type"), true); } else { reader = new XmlReader(is, true); } SyndFeedInput syndFeedInput = new SyndFeedInput(); syndFeedInput.setPreserveWireFeed(isPreserveWireFeed()); return syndFeedInput.build(reader); }
byte[] data = ... bytes for the feed ... SyndFeedInput input = new SyndFeedInput() input.allowDoctypes = true SyndFeed sf = input.build(new XmlReader(new ByteArrayInputStream(data))) Document doc = new MyWireFeedInput().getDocument(new XmlReader(new ByteArrayInputStream(data))) Element channel = doc.rootElement.getChild("channel") List<Element> items = channel ? channel.getChildren("item") : null List<SyndEntry> entries = sf.entries for (int i = 0; i < entries.size(); i++) { SyndEntry entry = entries[i] Element item = items ? items[i] : null if (item) { Element image = item.getChild("image") ... add it to enclosures or whatever ... } }
reader = new XmlReader(url); SyndFeed feed = new SyndFeedInput().build(reader); reader.close();
boolean appXml = isAppXml(cTMime); boolean textXml = isTextXml(cTMime); if (appXml || textXml) { if (cTEnc==null) { if (appXml) { encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, is);
if (conn instanceof HttpURLConnection) { try { doHttpStream(conn.getInputStream(),conn.getContentType(),lenient); doLenientDetection(conn.getContentType(),ex); if (conn.getContentType()!=null) { try { doHttpStream(conn.getInputStream(),conn.getContentType(),lenient); doLenientDetection(conn.getContentType(),ex); doRawStream(conn.getInputStream(),lenient); doLenientDetection(null,ex);