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 Summary
Fields Modifier and Type Field Description static int
DEFAULT_INDENT
Default number of space for each indentation level.static String
NDM_XML_V3_SCHEMA_LOCATION
NDM/XML version 3 location.static String
UNITS
Name of the units attribute.
-
Constructor Summary
Constructors Constructor Description XmlGenerator(Appendable output, int indentation, String outputName, double maxRelativeOffset, boolean writeUnits, String schemaLocation)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endMessage(String root)
End CCSDS message.void
enterSection(String name)
Enter into a new section.String
exitSection()
Exit last section.FileFormat
getFormat()
Get the generated file format.void
startMessage(String root, String messageTypeKey, double version)
Start CCSDS message.void
writeComments(List<String> comments)
Write comment lines.void
writeEntry(String key, String value, Unit unit, boolean mandatory)
Write a single key/value entry.void
writeOneAttributeElement(String name, String value, String attributeName, String attributeValue)
Write an element with one attribute.void
writeTwoAttributesElement(String name, String value, String attribute1Name, String attribute1Value, String attribute2Name, String attribute2Value)
Write an element with two attributes.-
Methods inherited from class org.orekit.files.ccsds.utils.generation.AbstractGenerator
close, complain, dateToCalendarString, dateToString, dateToString, doubleToString, getOutputName, newLine, siToCcsdsName, unitsListToString, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeRawData, writeRawData, writeUnits
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.orekit.files.ccsds.utils.generation.Generator
writeEntry
-
-
-
-
Field Detail
-
DEFAULT_INDENT
public static final int DEFAULT_INDENT
Default number of space for each indentation level.- See Also:
- Constant Field Values
-
UNITS
public static final String UNITS
Name of the units attribute.- See Also:
- Constant Field Values
-
NDM_XML_V3_SCHEMA_LOCATION
public static final String NDM_XML_V3_SCHEMA_LOCATION
NDM/XML version 3 location.- Since:
- 12.0
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XmlGenerator
public XmlGenerator(Appendable output, int indentation, String outputName, double maxRelativeOffset, boolean writeUnits, String schemaLocation) throws IOException
Simple constructor.- Parameters:
output
- destination of generated outputindentation
- number of space for each indentation leveloutputName
- output name for error messagesmaxRelativeOffset
- 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 writtenschemaLocation
- schema location to use, may be null- Throws:
IOException
- if an I/O error occurs.- See Also:
DEFAULT_INDENT
,NDM_XML_V3_SCHEMA_LOCATION
-
-
Method Detail
-
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 filesmessageTypeKey
- key for message typeversion
- 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 namevalue
- element valueattributeName
- attribute nameattributeValue
- 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 namevalue
- element valueattribute1Name
- attribute 1 nameattribute1Value
- attribute 1 valueattribute2Name
- attribute 2 nameattribute2Value
- 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 writevalue
- the value to writeunit
- 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 interfaceGenerator
- Overrides:
enterSection
in classAbstractGenerator
- 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 interfaceGenerator
- Overrides:
exitSection
in classAbstractGenerator
- Returns:
- section name
- Throws:
IOException
- if an I/O error occurs.
-
-