001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.examples.core.dto.atom;
014
015import org.apache.juneau.dto.atom.Feed;
016import org.apache.juneau.html.HtmlSerializer;
017
018/**
019 * Atom feed HTML example.
020 *
021 * <h5 class='section'>See Also:</h5><ul>
022 * </ul>
023 */
024public class AtomHtmlExample {
025
026   /**
027    * HTML Atom feed example.
028    *
029    * @param args Unused.
030    * @throws Exception Unused.
031    */
032   public static void main(String[] args) throws Exception {
033
034
035      Feed feed = AtomFeed.getAtomFeed();
036
037      // Example with no namespaces
038      // Create a serializer with readable output, no namespaces yet.
039      HtmlSerializer s = HtmlSerializer.create().sq().ws().build();
040
041      //Produces
042      /**
043       * <table>
044       *  <tr>
045       *      <td>title</td>
046       *      <td>
047       *          <table>
048       *              <tr>
049       *                  <td>text</td>
050       *                  <td>Juneau ATOM specification</td>
051       *              </tr>
052       *          </table>
053       *      </td>
054       *  </tr>
055       *  <tr>
056       *      <td>updated</td>
057       *      <td>2016-01-02T03:04:05Z</td>
058       *  </tr>
059       *  <tr>
060       *      <td>links</td>
061       *      <td>
062       *          <table _type='array'>
063       *              <tr>
064       *                  <th>rel</th>
065       *                  <th>href</th>
066       *                  <th>hreflang</th>
067       *                  <th>type</th>
068       *              </tr>
069       *              <tr>
070       *                  <td>alternate</td>
071       *                  <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
072       *                  <td>en</td>
073       *                  <td>text/html</td>
074       *              </tr>
075       *              <tr>
076       *                  <td>self</td>
077       *                  <td><a href='http://juneau.apache.org/feed.atom'>http://juneau.apache.org/feed.atom</a></td>
078       *                  <td><null/></td>
079       *                  <td>application/atom+xml</td>
080       *              </tr>
081       *          </table>
082       *      </td>
083       *  </tr>
084       *  <tr>
085       *      <td>id</td>
086       *      <td>
087       *          <table>
088       *              <tr>
089       *                  <td>text</td>
090       *                  <td>tag:juneau.apache.org</td>
091       *              </tr>
092       *          </table>
093       *      </td>
094       *  </tr>
095       *  <tr>
096       *      <td>subtitle</td>
097       *      <td>
098       *          <table>
099       *              <tr>
100       *                  <td>text</td>
101       *                  <td>Describes &lt;em&gt;stuff&lt;/em&gt; about Juneau</td>
102       *              </tr>
103       *              <tr>
104       *                  <td>type</td>
105       *                  <td>html</td>
106       *              </tr>
107       *          </table>
108       *      </td>
109       *  </tr>
110       *  <tr>
111       *      <td>generator</td>
112       *      <td>
113       *          <table>
114       *              <tr>
115       *                  <td>version</td>
116       *                  <td>1.0</td>
117       *              </tr>
118       *              <tr>
119       *                  <td>text</td>
120       *                  <td>Juneau</td>
121       *              </tr>
122       *              <tr>
123       *                  <td>uri</td>
124       *                  <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
125       *              </tr>
126       *          </table>
127       *      </td>
128       *  </tr>
129       *  <tr>
130       *      <td>entries</td>
131       *      <td>
132       *          <table _type='array'>
133       *          <tr>
134       *              <th>title</th>
135       *              <th>updated</th>
136       *              <th>links</th>
137       *              <th>contributors</th>
138       *              <th>authors</th>
139       *              <th>id</th>
140       *              <th>content</th>
141       *          </tr>
142       *          <tr>
143       *              <td>
144       *                  <table>
145       *                          <tr>
146       *                              <td>text</td>
147       *                              <td>Juneau ATOM specification snapshot</td>
148       *                          </tr>
149       *                  </table>
150       *              </td>
151       *              <td>2016-01-02T03:04:05Z</td>
152       *              <td>
153       *                  <table _type='array'>
154       *                      <tr>
155       *                          <th>rel</th>
156       *                          <th>href</th>
157       *                          <th>type</th>
158       *                          <th>length</th>
159       *                      </tr>
160       *                      <tr>
161       *                          <td>alternate</td>
162       *                          <td><a href='http://juneau.apache.org/juneau.atom'>http://juneau.apache.org/juneau.atom</a></td>
163       *                          <td>text/html</td>
164       *                          <td><null/></td>
165       *                      </tr>
166       *                      <tr>
167       *                          <td>enclosure</td>
168       *                          <td><a href='http://juneau.apache.org/audio/juneau_podcast.mp3'>http://juneau.apache.org/audio/juneau_podcast.mp3</a></td>
169       *                          <td>audio/mpeg</td>
170       *                          <td>1337</td>
171       *                      </tr>
172       *                  </table>
173       *               </td>
174       *               <td>
175       *                   <table _type='array'>
176       *                      <tr>
177       *                          <th>uri</th>
178       *                          <th>email</th>
179       *                          <th>name</th>
180       *                      </tr>
181       *                      <tr>
182       *                          <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td>
183       *                          <td>janesmith@apache.org</td>
184       *                          <td>Jane Smith</td>
185       *                      </tr>
186       *                   </table>
187       *                </td>
188       *                <td>
189       *                   <table _type='array'>
190       *                      <tr>
191       *                          <th>name</th>
192       *                      </tr>
193       *                      <tr>
194       *                          <td>John Smith</td>
195       *                      </tr>
196       *                   </table>
197       *                </td>
198       *                <td>
199       *                  <table>
200       *                      <tr>
201       *                          <td>text</td>
202       *                          <td>tag:juneau.sample.com,2013:1.2345</td>
203       *                      </tr>
204       *                  </table>
205       *                </td>
206       *                <td>2016-01-02T03:04:05Z</td>
207       *                <td>
208       *                  <table>
209       *                      <tr>
210       *                          <td>lang</td>
211       *                          <td>en</td>
212       *                      </tr>
213       *                      <tr>
214       *                          <td>base</td>
215       *                          <td><a href='http://www.apache.org/'>http://www.apache.org/</a></td>
216       *                      </tr>
217       *                      <tr>
218       *                          <td>text</td>
219       *                          <td>&lt;div&gt;&lt;p&gt;&lt;i&gt;[Update: Juneau supports ATOM.]&lt;/i&gt;&lt;/p&gt;&lt;/div&gt;</td>
220       *                      </tr>
221       *                      <tr>
222       *                          <td>type</td>
223       *                          <td>xhtml</td>
224       *                      </tr>
225       *                   </table>
226       *                </td>
227       *             </tr>
228       *          </table>
229       *       </td>
230       *     </tr>
231       *  </table>
232       */
233      System.out.print(s.serialize(feed));
234   }
235}