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 * <ul class='seealso'> 022 * <li class='extlink'>{@source} 023 * </ul> 024 */ 025public class AtomHtmlExample { 026 027 /** 028 * HTML Atom feed example. 029 * 030 * @param args Unused. 031 * @throws Exception Unused. 032 */ 033 public static void main(String[] args) throws Exception { 034 035 036 Feed feed = AtomFeed.getAtomFeed(); 037 038 // Example with no namespaces 039 // Create a serializer with readable output, no namespaces yet. 040 HtmlSerializer s = HtmlSerializer.create().sq().ws().build(); 041 042 //Produces 043 /** 044 * <table> 045 * <tr> 046 * <td>title</td> 047 * <td> 048 * <table> 049 * <tr> 050 * <td>text</td> 051 * <td>Juneau ATOM specification</td> 052 * </tr> 053 * </table> 054 * </td> 055 * </tr> 056 * <tr> 057 * <td>updated</td> 058 * <td>2016-01-02T03:04:05Z</td> 059 * </tr> 060 * <tr> 061 * <td>links</td> 062 * <td> 063 * <table _type='array'> 064 * <tr> 065 * <th>rel</th> 066 * <th>href</th> 067 * <th>hreflang</th> 068 * <th>type</th> 069 * </tr> 070 * <tr> 071 * <td>alternate</td> 072 * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td> 073 * <td>en</td> 074 * <td>text/html</td> 075 * </tr> 076 * <tr> 077 * <td>self</td> 078 * <td><a href='http://juneau.apache.org/feed.atom'>http://juneau.apache.org/feed.atom</a></td> 079 * <td><null/></td> 080 * <td>application/atom+xml</td> 081 * </tr> 082 * </table> 083 * </td> 084 * </tr> 085 * <tr> 086 * <td>id</td> 087 * <td> 088 * <table> 089 * <tr> 090 * <td>text</td> 091 * <td>tag:juneau.apache.org</td> 092 * </tr> 093 * </table> 094 * </td> 095 * </tr> 096 * <tr> 097 * <td>subtitle</td> 098 * <td> 099 * <table> 100 * <tr> 101 * <td>text</td> 102 * <td>Describes <em>stuff</em> about Juneau</td> 103 * </tr> 104 * <tr> 105 * <td>type</td> 106 * <td>html</td> 107 * </tr> 108 * </table> 109 * </td> 110 * </tr> 111 * <tr> 112 * <td>generator</td> 113 * <td> 114 * <table> 115 * <tr> 116 * <td>version</td> 117 * <td>1.0</td> 118 * </tr> 119 * <tr> 120 * <td>text</td> 121 * <td>Juneau</td> 122 * </tr> 123 * <tr> 124 * <td>uri</td> 125 * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td> 126 * </tr> 127 * </table> 128 * </td> 129 * </tr> 130 * <tr> 131 * <td>entries</td> 132 * <td> 133 * <table _type='array'> 134 * <tr> 135 * <th>title</th> 136 * <th>updated</th> 137 * <th>links</th> 138 * <th>contributors</th> 139 * <th>authors</th> 140 * <th>id</th> 141 * <th>content</th> 142 * </tr> 143 * <tr> 144 * <td> 145 * <table> 146 * <tr> 147 * <td>text</td> 148 * <td>Juneau ATOM specification snapshot</td> 149 * </tr> 150 * </table> 151 * </td> 152 * <td>2016-01-02T03:04:05Z</td> 153 * <td> 154 * <table _type='array'> 155 * <tr> 156 * <th>rel</th> 157 * <th>href</th> 158 * <th>type</th> 159 * <th>length</th> 160 * </tr> 161 * <tr> 162 * <td>alternate</td> 163 * <td><a href='http://juneau.apache.org/juneau.atom'>http://juneau.apache.org/juneau.atom</a></td> 164 * <td>text/html</td> 165 * <td><null/></td> 166 * </tr> 167 * <tr> 168 * <td>enclosure</td> 169 * <td><a href='http://juneau.apache.org/audio/juneau_podcast.mp3'>http://juneau.apache.org/audio/juneau_podcast.mp3</a></td> 170 * <td>audio/mpeg</td> 171 * <td>1337</td> 172 * </tr> 173 * </table> 174 * </td> 175 * <td> 176 * <table _type='array'> 177 * <tr> 178 * <th>uri</th> 179 * <th>email</th> 180 * <th>name</th> 181 * </tr> 182 * <tr> 183 * <td><a href='http://juneau.apache.org'>http://juneau.apache.org</a></td> 184 * <td>janesmith@apache.org</td> 185 * <td>Jane Smith</td> 186 * </tr> 187 * </table> 188 * </td> 189 * <td> 190 * <table _type='array'> 191 * <tr> 192 * <th>name</th> 193 * </tr> 194 * <tr> 195 * <td>John Smith</td> 196 * </tr> 197 * </table> 198 * </td> 199 * <td> 200 * <table> 201 * <tr> 202 * <td>text</td> 203 * <td>tag:juneau.sample.com,2013:1.2345</td> 204 * </tr> 205 * </table> 206 * </td> 207 * <td>2016-01-02T03:04:05Z</td> 208 * <td> 209 * <table> 210 * <tr> 211 * <td>lang</td> 212 * <td>en</td> 213 * </tr> 214 * <tr> 215 * <td>base</td> 216 * <td><a href='http://www.apache.org/'>http://www.apache.org/</a></td> 217 * </tr> 218 * <tr> 219 * <td>text</td> 220 * <td><div><p><i>[Update: Juneau supports ATOM.]</i></p></div></td> 221 * </tr> 222 * <tr> 223 * <td>type</td> 224 * <td>xhtml</td> 225 * </tr> 226 * </table> 227 * </td> 228 * </tr> 229 * </table> 230 * </td> 231 * </tr> 232 * </table> 233 */ 234 System.out.print(s.serialize(feed)); 235 } 236}