net.sourceforge.java.feednread.backend.exporter
Class OPMLExport

java.lang.Object
  extended bynet.sourceforge.java.feednread.backend.exporter.OPMLExport
Direct Known Subclasses:
NewsFeedFavoritesTreeOPMLExport

public class OPMLExport
extends Object

Exports a hierarchical Category structure to an xml JDOM Document which can on his part be exported to a valid OPML 1.1 File.

Author:
Sebastian Machhausen

Field Summary
private static DateFormat DEFAULT_DATE_FORMATTER
           The default DateFormat object to format dates.
private static String GENERATOR_TEXT
           The export generator text
private static String OPML_VERSION
           The OPML version used for export
private  Category rootCategory
           The Category to export to OPML
 
Constructor Summary
OPMLExport(Category root)
           Creates a new OPMLExport bound to the specified Category.
 
Method Summary
private  void createBody(Element root)
           Creates a default OPML body section.
private  Document createDocument()
           Creates a default OPML Document.
private  void createHead(Element root)
           Creates a default OPML head section.
 void doExport(String fileName)
           Exports the set rootCategory to a File with the specified fileName.
protected  void exportCategory(Category category, Element parent)
           Recursively exports the specified Category to the specified parent Element.
protected  void exportFavorite(Favorite favorite, Element categoryOutline)
           Exports the specified Favorite to the specified categoryOutline Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPML_VERSION

private static final String OPML_VERSION

The OPML version used for export

See Also:
Constant Field Values

GENERATOR_TEXT

private static final String GENERATOR_TEXT

The export generator text

See Also:
Constant Field Values

DEFAULT_DATE_FORMATTER

private static final DateFormat DEFAULT_DATE_FORMATTER

The default DateFormat object to format dates.


rootCategory

private Category rootCategory

The Category to export to OPML

Constructor Detail

OPMLExport

public OPMLExport(Category root)

Creates a new OPMLExport bound to the specified Category.

Parameters:
root - the Category to export
Method Detail

createDocument

private Document createDocument()

Creates a default OPML Document.

Returns:
the created OPML Document

createHead

private void createHead(Element root)

Creates a default OPML head section.

Parameters:
root - the OPML Document root

createBody

private void createBody(Element root)

Creates a default OPML body section.

Parameters:
root - the OPML Document root

exportCategory

protected void exportCategory(Category category,
                              Element parent)

Recursively exports the specified Category to the specified parent Element.

Parameters:
category - the Category to export
parent - the parent Element to export the specified Category to

exportFavorite

protected void exportFavorite(Favorite favorite,
                              Element categoryOutline)

Exports the specified Favorite to the specified categoryOutline Element.

Parameters:
favorite - the Favorite to export
categoryOutline - the outline Element to export the specified Favorite to

doExport

public void doExport(String fileName)
              throws IOException

Exports the set rootCategory to a File with the specified fileName.

Parameters:
fileName - the name of the file to export to
Throws:
IOException - if the export failed due to an IO error