Class DiaryScanner


  • public class DiaryScanner
    extends java.lang.Object
    This is a DOM tree scanner of diary XML files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) org.w3c.dom.Document document
      XML document that is being loaded.
      private static java.lang.String dtd
      String holding whole content of diary.dtd validation file.
    • Constructor Summary

      Constructors 
      Constructor Description
      DiaryScanner​(org.w3c.dom.Document document)
      Creates new diary scanner.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void createDTD()
      Creates diary.dtd file that is used for automatic XML validation of diary files.
      private boolean loadAutomaticStart​(org.w3c.dom.Element notificationElement)
      Loads automatic start option from given XML element.
      private void loadDay​(org.w3c.dom.Element dayElement, int week_id, int week_year)
      Loads day from given XML element.
      private java.lang.String loadDescription​(org.w3c.dom.Element descriptionElement)
      Loads description from given XML element.
      void loadDocument()
      Loads XML diary document given in the scanner constructor.
      private java.lang.String loadKeyword​(org.w3c.dom.Element keywordElement)
      Loads keyword from given XML element.
      private java.lang.String loadNotes​(org.w3c.dom.Element notesElement)
      Loads notes from given XML element.
      private long loadNotification​(org.w3c.dom.Element notificationElement)
      Loads notification time from given XML element.
      private int loadPriority​(org.w3c.dom.Element priorityElement)
      Loads priority from given XML element.
      private int loadRepetition​(org.w3c.dom.Element repetitionElement)
      Loads repetition from given XML element.
      private Task loadTask​(org.w3c.dom.Element taskElement)
      Loads task from given XML element.
      private void loadWeek​(org.w3c.dom.Element element)
      Loads week from given XML element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • document

        org.w3c.dom.Document document
        XML document that is being loaded.
      • dtd

        private static java.lang.String dtd
        String holding whole content of diary.dtd validation file.
    • Constructor Detail

      • DiaryScanner

        public DiaryScanner​(org.w3c.dom.Document document)
        Creates new diary scanner.
        Parameters:
        document - XML diary document to be loaded.
    • Method Detail

      • loadDocument

        public void loadDocument()
        Loads XML diary document given in the scanner constructor.
      • loadWeek

        private void loadWeek​(org.w3c.dom.Element element)
        Loads week from given XML element.
        Parameters:
        element - XML element representing a week.
      • loadDay

        private void loadDay​(org.w3c.dom.Element dayElement,
                             int week_id,
                             int week_year)
        Loads day from given XML element.
        Parameters:
        dayElement - XML element representing a week.
        week_id - Number of week to which this day belongs.
        week_year - Number of year to which this day belongs.
      • loadTask

        private Task loadTask​(org.w3c.dom.Element taskElement)
        Loads task from given XML element.
        Parameters:
        taskElement - XML element representing a task.
        Returns:
        Task loaded from given XML element.
      • loadPriority

        private int loadPriority​(org.w3c.dom.Element priorityElement)
        Loads priority from given XML element.
        Parameters:
        priorityElement - XML element representing a priority.
        Returns:
        Priority loaded from given XML element.
      • loadDescription

        private java.lang.String loadDescription​(org.w3c.dom.Element descriptionElement)
        Loads description from given XML element.
        Parameters:
        descriptionElement - XML element representing a description.
        Returns:
        Description loaded from given XML element.
      • loadKeyword

        private java.lang.String loadKeyword​(org.w3c.dom.Element keywordElement)
        Loads keyword from given XML element.
        Parameters:
        keywordElement - XML element representing a keyword.
        Returns:
        Keyword loaded from given XML element.
      • loadNotes

        private java.lang.String loadNotes​(org.w3c.dom.Element notesElement)
        Loads notes from given XML element.
        Parameters:
        notesElement - XML element representing a notes.
        Returns:
        Notes loaded from given XML element.
      • loadNotification

        private long loadNotification​(org.w3c.dom.Element notificationElement)
        Loads notification time from given XML element.
        Parameters:
        notificationElement - XML element representing a notification time.
        Returns:
        Notification time loaded from given XML element.
      • loadAutomaticStart

        private boolean loadAutomaticStart​(org.w3c.dom.Element notificationElement)
        Loads automatic start option from given XML element.
        Parameters:
        notificationElement - XML element representing a notification time.
        Returns:
        Automatic start option loaded from given XML element.
      • loadRepetition

        private int loadRepetition​(org.w3c.dom.Element repetitionElement)
        Loads repetition from given XML element.
        Parameters:
        repetitionElement - XML element representing a repetition.
        Returns:
        Repetition loaded from given XML element.
      • createDTD

        public static void createDTD()
        Creates diary.dtd file that is used for automatic XML validation of diary files.