title: Personal Project "RSS FEED" XML Parser
body: <p>I am relatively new to Java and I have been trying to figure out how to reach the following tags for output for a couple of long, LONG days now. I would really appreciate some insight into the problem. It seems like everything I could find and or try just does not pan out right. (Excuse the cheesy news articles)</p>
  
  <pre><code>&lt;item&gt;
  &lt;pubDate&gt;Sat, 21 Sep 2013 02:30:23 EDT&lt;/pubDate&gt;
  &lt;title&gt;
  &lt;![CDATA[
  Carmen Bryan Lashes Out at Beyonce Fans for Throwing Shade (@carmenbryan)
  ]]&gt;
  &lt;/title&gt;
  &lt;link&gt;
  http://www.vladtv.com/blog/174937/carmen-bryan-lashes-out-at-beyonce-fans-for-throwing-shade/
  &lt;/link&gt;
  &lt;guid&gt;
  http://www.vladtv.com/blog/174937/carmen-bryan-lashes-out-at-beyonce-fans-for-throwing-shade/
  &lt;/guid&gt;
  &lt;description&gt;
  &lt;![CDATA[
  &lt;img ... /&gt;&lt;br /&gt;.
   &lt;p&gt;In response to someone who reminded Bryan that Jay Z has Beyonce now, she tweeted.&lt;/p&gt;
   &lt;p&gt;Check out what else Bryan had to say above.&lt;/p&gt;
   &lt;p&gt;Source: &lt;/p&gt;
  ]]&gt;
  &lt;/description&gt;
  &lt;/item&gt;
  </code></pre>
  
  <p>I have managed to parse the XML and print out the content in both the title and description element tags, however the output for the description element tag also includes all its child element tags. I would like to use this project in future to build on my Java portfolio, please help!</p>
  
  <p>My code so far:</p>
  
  <pre><code>public class NewXmlReader
      {
  
          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
                  try {
  
                          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                          DocumentBuilder builder = factory.newDocumentBuilder();
                          Document docXml = builder.parse(NewXMLReaderHandlers.inputHandler());
                          docXml.getDocumentElement().normalize();
  
                          NewXMLReaderHandlers.handleItemTags(docXml, "item");
  
                  } catch (ParserConfigurationException | SAXException parserConfigurationException) {
                          System.out.println("You Are Not XML formated !!");
                          parserConfigurationException.printStackTrace();
                  } catch (IOException iOException) {
                          System.out.println("URL NOT FOUND");
                          iOException.getCause();
                  }
          }
  
      }
  
  public class NewXMLReaderHandlers {
  
      private static int ARTICLELENGTH;
  
      public static String inputHandler() throws IOException {
          InputStreamReader inputStream = new InputStreamReader(System.in);
          BufferedReader bufferRead = new BufferedReader(inputStream);
          System.out.println("Please Enter A Proper URL: ");
          String urlPageString = bufferRead.readLine();
          return urlPageString;
      }
  
      public static void handleItemTags( Document document, String rssFeedParentTopicTag){
          NodeList listOfArticles = document.getElementsByTagName(rssFeedParentTopicTag);
          NewXMLReaderHandlers.ARTICLELENGTH = listOfArticles.getLength();
          String rootElement = document.getDocumentElement().getNodeName();
          if (rootElement == "rss"){
              System.out.println("We Have An RSS Feed To Parse");
  
              for (int i = 0; i &lt; NewXMLReaderHandlers.ARTICLELENGTH; i++) {
                  Node itemNode = (Node) listOfArticles.item(i);
                  if (itemNode.getNodeType() == Node.ELEMENT_NODE) {
                      Element itemElement= (Element) itemNode;
                      tagContent (itemElement, "title");
                      tagContent (itemElement, "description");
                  }
              }
          }
  
      }
  
      public static void tagContent (Element item, String tagName) {
              NodeList tagNodeList = item.getElementsByTagName(tagName);
              Element tagElement = (Element)tagNodeList.item(0);
              NodeList tagTElist = tagElement.getChildNodes();
              Node tagNode = tagTElist.item(0);
  
  //          System.out.println( " - " + tagName + " : " + tagNode.getNodeValue() + "\n");
              if(tagName == "description"){
                  System.out.println( " - " + tagName + " : " + tagNode.getNodeValue() + "\n\n");
                  System.out.println(" Do We Have Any Siblings? " + tagNode.getNextSibling().getNodeValue() + "\n");
              }
          }
      }
  </code></pre>