Class XmlGenerator

java.lang.Object
org.orekit.files.ccsds.utils.generation.AbstractGenerator
org.orekit.files.ccsds.utils.generation.XmlGenerator
All Implemented Interfaces:
AutoCloseable, Generator

public class XmlGenerator extends AbstractGenerator
Generator for eXtended Markup Language CCSDS messages.
Since:
11.0
Author:
Luc Maisonobe
  • Field Details

    • DEFAULT_INDENT

      public static final int DEFAULT_INDENT
      Default number of space for each indentation level.
      See Also:
    • UNITS

      public static final String UNITS
      Name of the units attribute.
      See Also:
    • NDM_XML_V3_SCHEMA_LOCATION

      public static final String NDM_XML_V3_SCHEMA_LOCATION
      NDM/XML version 3 location.
      Since:
      12.0
      See Also:
  • Constructor Details

    • XmlGenerator

      public XmlGenerator(Appendable output, int indentation, String outputName, double maxRelativeOffset, boolean writeUnits, String schemaLocation, Formatter formatter) throws IOException
      Simple constructor.
      Parameters:
      output - destination of generated output
      indentation - number of space for each indentation level
      outputName - output name for error messages
      maxRelativeOffset - maximum offset in seconds to use relative dates (if a date is too far from reference, it will be displayed as calendar elements)
      writeUnits - if true, units must be written
      schemaLocation - schema location to use, may be null
      formatter - used to convert doubles and dates to string
      Throws:
      IOException - if an I/O error occurs.
      See Also:
    • XmlGenerator

      public XmlGenerator(Appendable output, int indentation, String outputName, double maxRelativeOffset, boolean writeUnits, String schemaLocation) throws IOException
      Simple constructor.
      Parameters:
      output - destination of generated output
      indentation - number of space for each indentation level
      outputName - output name for error messages
      maxRelativeOffset - maximum offset in seconds to use relative dates (if a date is too far from reference, it will be displayed as calendar elements)
      writeUnits - if true, units must be written
      schemaLocation - schema location to use, may be null
      Throws:
      IOException - if an I/O error occurs.
      See Also:
  • Method Details

    • getFormat

      public FileFormat getFormat()
      Get the generated file format.
      Returns:
      generated file format
    • startMessage

      public void startMessage(String root, String messageTypeKey, double version) throws IOException
      Start CCSDS message.
      Parameters:
      root - root element for XML files
      messageTypeKey - key for message type
      version - format version
      Throws:
      IOException - if an I/O error occurs.
    • endMessage

      public void endMessage(String root) throws IOException
      End CCSDS message.
      Parameters:
      root - root element for XML files
      Throws:
      IOException - if an I/O error occurs.
    • writeComments

      public void writeComments(List<String> comments) throws IOException
      Write comment lines.
      Parameters:
      comments - comments to write
      Throws:
      IOException - if an I/O error occurs.
    • writeOneAttributeElement

      public void writeOneAttributeElement(String name, String value, String attributeName, String attributeValue) throws IOException
      Write an element with one attribute.
      Parameters:
      name - tag name
      value - element value
      attributeName - attribute name
      attributeValue - attribute value
      Throws:
      IOException - if an I/O error occurs.
    • writeTwoAttributesElement

      public void writeTwoAttributesElement(String name, String value, String attribute1Name, String attribute1Value, String attribute2Name, String attribute2Value) throws IOException
      Write an element with two attributes.
      Parameters:
      name - tag name
      value - element value
      attribute1Name - attribute 1 name
      attribute1Value - attribute 1 value
      attribute2Name - attribute 2 name
      attribute2Value - attribute 2 value
      Throws:
      IOException - if an I/O error occurs.
    • writeEntry

      public void writeEntry(String key, String value, Unit unit, boolean mandatory) throws IOException
      Write a single key/value entry.
      Parameters:
      key - the keyword to write
      value - the value to write
      unit - output unit (may be null)
      mandatory - if true, null values triggers exception, otherwise they are silently ignored
      Throws:
      IOException - if an I/O error occurs.
    • enterSection

      public void enterSection(String name) throws IOException
      Enter into a new section.
      Specified by:
      enterSection in interface Generator
      Overrides:
      enterSection in class AbstractGenerator
      Parameters:
      name - section name
      Throws:
      IOException - if an I/O error occurs.
    • exitSection

      public String exitSection() throws IOException
      Exit last section.
      Specified by:
      exitSection in interface Generator
      Overrides:
      exitSection in class AbstractGenerator
      Returns:
      section name
      Throws:
      IOException - if an I/O error occurs.