Pax 4 Posted March 27, 2017 Report Share Posted March 27, 2017 (edited) May be used for reading certain forums within IPB, or other web/software. import java.net.URL; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public class RSSFeed { /** * @author: Pax M */ /** * The URL that we want to read from */ public static String URL = " This is the hidden content, please Sign In or Sign Up "; /** * Read the RSS * * @param read element * @param read tagName * @return element * @return tagName */ public static String read(String element, String tagName) { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new URL(URL).openConnection() .getInputStream()); doc.getDocumentElement().normalize(); for (int temp = 0; temp < doc.getElementsByTagName(tagName) .getLength(); temp++) { Node nNode = doc.getElementsByTagName(tagName).item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; return eElement.getElementsByTagName(element).item(0) .getTextContent(); } } } catch (Exception e) { e.printStackTrace(); } return null; } } Usage: RSSFeed.read(element, tagName); Edited March 27, 2017 by Pax 1 Link to comment Share on other sites More sharing options...
torque0 1 Posted July 24, 2017 Report Share Posted July 24, 2017 great stuff Link to comment Share on other sites More sharing options...
josh555 3 Posted February 1, 2020 Report Share Posted February 1, 2020 I like this, can be helpful to plenty that are traveling this path Link to comment Share on other sites More sharing options...
Origin 1,877 Posted June 10, 2020 Report Share Posted June 10, 2020 appreciate you contribution! Link to comment Share on other sites More sharing options...
khepius 0 Posted November 25, 2022 Report Share Posted November 25, 2022 sanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now