Examples of FeedWriter


Examples of com.colorfulsoftware.atom.FeedWriter

      out.write(feed.toString());
      out.flush();
      out.close();

      // make sure it can also be written afterwards.
      FeedWriter feedWriter = new FeedWriter();
      XMLStreamWriter writer = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(
              new FileOutputStream("target/dump1.xml"));
      feedWriter.writeFeed(writer, feed);

    } catch (Exception e) {
      e.printStackTrace();
      fail("could not read fead.");
    }
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

          "target/rights.xml"));
      out.write(rights.toString());
      out.flush();
      out.close();

      FeedWriter feedWriter = new FeedWriter();
      XMLStreamWriter writer = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(
              new FileOutputStream("target/rights2.xml"));
      feedWriter.writeRights(writer, rights);
      writer.flush();
      writer.close();
    } catch (Exception e) {
      e.printStackTrace();
      fail("could not read and write feed.");
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

   *             if there is an error creating the test data.
   */
  @Before
  public void setUp() throws Exception {
    feedDoc = new FeedDoc();
    feedWriter = new FeedWriter();
    writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
        new FileOutputStream("target/out.xml"));

  }
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

   * test the feed writing functionality.
   */
  @Test
  public void testWriteFeed() {
    try {
      feedWriter = new FeedWriter();
      writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
          new FileOutputStream("target/dump1.xml"));
      Feed feed = feedDoc.readFeedToBean(new URL(
          "http://www.atomenabled.org/atom.xml"));
      feedWriter.writeFeed(writer, feed);
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

   * test the xhtml writing functionality.
   */
  @Test
  public void testWriteXHTML() {
    try {
      feedWriter = new FeedWriter();
      XMLStreamWriter writer2 = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(
              new FileOutputStream("target/xhtml1.xml"));
      feedWriter.writeXHTML(writer2, xhtml1);

      feedWriter = new FeedWriter();
      writer2 = XMLOutputFactory.newInstance().createXMLStreamWriter(
          new FileOutputStream("target/xhtml2.xml"));
      feedWriter.writeXHTML(writer2, xhtml2);

      // test query string attribute.
      FeedWriter feedWriter2 = new FeedWriter();
      writer2 = XMLOutputFactory.newInstance().createXMLStreamWriter(
          new FileOutputStream("target/xhtml.xml"));
      feedWriter2.writeXHTML(writer2, queryStringXHTML);
      writer2.flush();
      writer2.close();

      BufferedWriter fout = new BufferedWriter(new FileWriter(
          "target/xhtmlRegular.xml"));
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

      assertTrue(entries.size() == 1);

      StringWriter theXMLString = new StringWriter();
      XMLStreamWriter writer = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(theXMLString);
      new FeedWriter().writeEntries(writer, entries);
      writer.flush();
      writer.close();
      assertEquals(theXMLString.toString(), entry1Result);

      entries = new FeedReader(feedDoc).readEntry(XMLInputFactory
          .newInstance().createXMLStreamReader(
              new StringReader(entry2)), null);
      assertTrue(entries != null);
      assertTrue(entries.size() == 1);

      theXMLString = new StringWriter();
      writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
          theXMLString);
      new FeedWriter().writeEntries(writer, entries);
      writer.flush();
      writer.close();
      assertEquals(theXMLString.toString(), entry2Result);

      entries = new FeedReader(feedDoc).readEntry(XMLInputFactory
          .newInstance().createXMLStreamReader(
              new StringReader(entry3)), null);
      assertTrue(entries != null);
      assertTrue(entries.size() == 1);

      theXMLString = new StringWriter();
      writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
          theXMLString);
      new FeedWriter().writeEntries(writer, entries);
      writer.flush();
      writer.close();
      assertEquals(theXMLString.toString(), entry3Result);

      entries = new FeedReader(feedDoc).readEntry(XMLInputFactory
          .newInstance().createXMLStreamReader(
              new StringReader(entry3Result)), null);
      assertTrue(entries != null);
      assertTrue(entries.size() == 1);

      entries = new FeedReader(feedDoc).readEntry(XMLInputFactory
          .newInstance().createXMLStreamReader(
              new StringReader(entry4)), null);
      assertTrue(entries != null);
      assertTrue(entries.size() == 1);

      theXMLString = new StringWriter();
      writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
          theXMLString);
      new FeedWriter().writeEntries(writer, entries);
      writer.flush();
      writer.close();
      assertEquals(theXMLString.toString(), entry4Result);

      try {
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

      Extension ext = ent.getExtension("local:element");
      assertNotNull(ext);
      Attribute attr = ext.getAttribute("xmlns:local");
      assertNotNull(attr);

      FeedWriter feedWriter2 = new FeedWriter();
      XMLStreamWriter writer2 = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(
              new FileOutputStream("target/extension2.xml"));
      List<Entry> entries = new LinkedList<Entry>();
      entries.add(ent);
      feedWriter2.writeEntries(writer2, entries);
      writer2.flush();
      writer2.close();
    } catch (Exception e) {
      assertTrue(e instanceof AtomSpecException);
      assertEquals(
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

   *             if there is an error creating the test data.
   */
  @Before
  public void setUp() throws Exception {
    feedDoc = new FeedDoc();
    feedWriter = new FeedWriter();
    writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
        new FileOutputStream("target/out.xml"));

  }
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

   * test the feed writing functionality.
   */
  @Test
  public void testWriteFeed() {
    try {
      feedWriter = new FeedWriter();
      writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
          new FileOutputStream("target/dump1.xml"));
      Feed feed = feedDoc.readFeedToBean(new URL(
          "http://www.earthbeats.net/drops.xml"));
      feedWriter.writeFeed(writer, feed);
View Full Code Here

Examples of com.colorfulsoftware.atom.FeedWriter

   * test the xhtml writing functionality.
   */
  @Test
  public void testWriteXHTML() {
    try {
      feedWriter = new FeedWriter();
      XMLStreamWriter writer2 = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(
              new FileOutputStream("target/xhtml1.xml"));
      feedWriter.writeXHTML(writer2, xhtml1);

      feedWriter = new FeedWriter();
      writer2 = XMLOutputFactory.newInstance().createXMLStreamWriter(
          new FileOutputStream("target/xhtml2.xml"));
      feedWriter.writeXHTML(writer2, xhtml2);

      // test query string attribute.
      FeedWriter feedWriter2 = new FeedWriter();
      writer2 = XMLOutputFactory.newInstance().createXMLStreamWriter(
          new FileOutputStream("target/xhtml.xml"));
      feedWriter2.writeXHTML(writer2, queryStringXHTML);
      writer2.flush();
      writer2.close();

      BufferedWriter fout = new BufferedWriter(new FileWriter(
          "target/xhtmlRegular.xml"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.