ealet
Class XMLer

java.lang.Object
  extended by ealet.XMLer

public class XMLer
extends java.lang.Object

This class is responsible in transforming the calendar, which is in linked list form, to XML. It does so, manually; that is, the structure and elements are hard-coded. If there is any change in the calendar data structure, it will be affected; may be rendering it non-functional.


Constructor Summary
XMLer()
           
 
Method Summary
 void elementContent(int indentLevel, java.lang.String content)
          Places the contents with proper indentation and appends it to the XML document.
 void endElement(int indentLevel, java.lang.String elem)
          Creates the end tag for an element with proper indentation and appends it to the XML document.
 java.lang.String makeIndent(int indentLevel)
          Makes concatinated blank space for indentation
 void startElement(int indentLevel, java.lang.String elem)
          Builds the begin element including attributes if the element has any and appends it to the XML document.
 void startElement(int indentLevel, java.lang.String elem, java.lang.String att, java.lang.String attValue)
          Builds the begin element including attributes if the element has any and appends it to the XML document.
 void to(java.lang.String fileName)
          Writes the document to a file
 void transform(java.util.LinkedList[] calendarYear, java.lang.String propertyFolder)
          Transforms calendar to XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLer

public XMLer()
Method Detail

transform

public void transform(java.util.LinkedList[] calendarYear,
                      java.lang.String propertyFolder)
Transforms calendar to XML document. The calendar comes in linked list form. Saddly, this method is littered with hard-coded stuff, but it works.

Parameters:
calendarYear - A linked list consisting of Ethiopian calendar
propertyFolder - A context path
Since:
2.0

makeIndent

public java.lang.String makeIndent(int indentLevel)
Makes concatinated blank space for indentation

Parameters:
indentLevel - How deep the indent should be
Returns:
An indentation
Since:
2.0

startElement

public void startElement(int indentLevel,
                         java.lang.String elem)
Builds the begin element including attributes if the element has any and appends it to the XML document.

Parameters:
indentLevel - How deep the indent should be
elem - The name of the element
Since:
2.0

startElement

public void startElement(int indentLevel,
                         java.lang.String elem,
                         java.lang.String att,
                         java.lang.String attValue)
Builds the begin element including attributes if the element has any and appends it to the XML document.

Parameters:
indentLevel - How deep the indent should be
elem - The name of the element
att - The name of the attribute
attValue - The value assigned to the attribute
Since:
2.0

elementContent

public void elementContent(int indentLevel,
                           java.lang.String content)
Places the contents with proper indentation and appends it to the XML document.

Parameters:
indentLevel - How deep the indent should be
content - The actual data
Since:
2.0

endElement

public void endElement(int indentLevel,
                       java.lang.String elem)
Creates the end tag for an element with proper indentation and appends it to the XML document.

Parameters:
indentLevel - How deep the indent should be
elem - The name of the element
Since:
2.0

to

public void to(java.lang.String fileName)
        throws java.io.IOException
Writes the document to a file

Parameters:
fileName - A target file in which content is written
Throws:
java.io.IOException
Since:
2.0