Class BusinessCalendarXMLParser

java.lang.Object
io.deephaven.time.calendar.BusinessCalendarXMLParser

public final class BusinessCalendarXMLParser extends Object
A parser for reading business calendar XML files.

Business calendar XML files should be formatted as:

 
 <calendar>
     <name>USNYSE</name>
     <!-- Optional description -->
     <description>New York Stock Exchange Calendar</description>
     <timeZone>America/New_York</timeZone>
     <default>
          <businessTime>
              <open>09:30</open>
              <close>16:00</close>
              <!-- Optional include the close nanosecond in the business time range. -->
              <includeClose>true</includeClose>
          </businessTime>
          <weekend>Saturday</weekend>
          <weekend>Sunday</weekend>
      </default>
      <!-- Optional firstValidDate.  Defaults to the first holiday. -->
      <firstValidDate>1999-01-01</firstValidDate>
      <!-- Optional lastValidDate.  Defaults to the first holiday. -->
      <lastValidDate>2003-12-31</lastValidDate>
      <holiday>
          <date>1999-01-01</date>
      </holiday>
      <holiday>
          <date>2002-07-05</date>
          <businessTime>
              <open>09:30</open>
              <close>13:00</close>
              <!-- Optional include the close nanosecond in the business time range. -->
              <includeClose>true</includeClose>
          </businessTime>
      </holiday>
 </calendar>
 
 
In addition, legacy XML files are supported. These files have dates formatted as `yyyyMMdd` instead of ISO-8601 `yyy-MM-dd`. Additionally, legacy uses `businessPeriod` tags in place of the `businessTime` tags.
 
 <!-- Current format -->
 <businessTime><open>09:30</open><close>16:00</close></businessTime>
 
 
 
 <!-- Legacy format -->
 <businessPeriod>09:30,16:00</businessPeriod>
 
 
The legacy format may be deprecated in a future release.
  • Constructor Details

    • BusinessCalendarXMLParser

      public BusinessCalendarXMLParser()
  • Method Details

    • loadBusinessCalendar

      public static BusinessCalendar loadBusinessCalendar(@NotNull @NotNull String file)
      Loads a business calendar from an XML file.
      Parameters:
      file - XML file
      Returns:
      business calendar.
      Throws:
      RequirementFailure - if the input is null
    • loadBusinessCalendar

      public static BusinessCalendar loadBusinessCalendar(@NotNull @NotNull File file)
      Loads a business calendar from an XML file.
      Parameters:
      file - XML file
      Returns:
      business calendar.
      Throws:
      RequirementFailure - if the input is null
    • loadBusinessCalendar

      public static BusinessCalendar loadBusinessCalendar(@NotNull @NotNull InputStream inputStream)
      Loads a business calendar from an XML input stream.
      Parameters:
      inputStream - XML input stream
      Returns:
      business calendar.
      Throws:
      RequirementFailure - if the input is null
    • loadBusinessCalendarFromResource

      public static BusinessCalendar loadBusinessCalendarFromResource(String resource) throws IOException
      Loads a business calendar from an XML resource.
      Parameters:
      resource - XML input stream
      Returns:
      business calendar.
      Throws:
      IOException