Class XmlGenerator
java.lang.Object
org.orekit.files.ccsds.utils.generation.AbstractGenerator
org.orekit.files.ccsds.utils.generation.XmlGenerator
- All Implemented Interfaces:
AutoCloseable,Generator
Generator for eXtended Markup Language CCSDS messages.
- Since:
- 11.0
- Author:
- Luc Maisonobe
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXmlGenerator(Appendable output, int indentation, String outputName, double maxRelativeOffset, boolean writeUnits, String schemaLocation) Simple constructor.XmlGenerator(Appendable output, int indentation, String outputName, double maxRelativeOffset, boolean writeUnits, String schemaLocation, Formatter formatter) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidendMessage(String root) End CCSDS message.voidenterSection(String name) Enter into a new section.Exit last section.Get the generated file format.voidstartMessage(String root, String messageTypeKey, double version) Start CCSDS message.voidwriteComments(List<String> comments) Write comment lines.voidwriteEntry(String key, String value, Unit unit, boolean mandatory) Write a single key/value entry.voidwriteOneAttributeElement(String name, String value, String attributeName, String attributeValue) Write an element with one attribute.voidwriteTwoAttributesElement(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, getFormatter, getOutputName, newLine, siToCcsdsName, unitsListToString, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeRawData, writeRawData, writeUnitsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.orekit.files.ccsds.utils.generation.Generator
writeEntry
-
Field Details
-
DEFAULT_INDENT
public static final int DEFAULT_INDENTDefault number of space for each indentation level.- See Also:
-
UNITS
Name of the units attribute.- See Also:
-
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 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 nullformatter- 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 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:
-
-
Method Details
-
getFormat
Get the generated file format.- Returns:
- generated file format
-
startMessage
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
End CCSDS message.- Parameters:
root- root element for XML files- Throws:
IOException- if an I/O error occurs.
-
writeComments
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
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
Enter into a new section.- Specified by:
enterSectionin interfaceGenerator- Overrides:
enterSectionin classAbstractGenerator- Parameters:
name- section name- Throws:
IOException- if an I/O error occurs.
-
exitSection
Exit last section.- Specified by:
exitSectionin interfaceGenerator- Overrides:
exitSectionin classAbstractGenerator- Returns:
- section name
- Throws:
IOException- if an I/O error occurs.
-