public class XmlGenerator extends AbstractGenerator
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_INDENT
Default number of space for each indentation level.
|
static String |
UNITS
Name of the units attribute.
|
| Constructor and Description |
|---|
XmlGenerator(Appendable output,
int indentation,
String outputName,
boolean writeUnits)
Simple constructor.
|
| Modifier and Type | Method and 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.
|
close, complain, dateToString, dateToString, doubleToString, getOutputName, newLine, siToCcsdsName, unitsListToString, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeEntry, writeRawData, writeRawData, writeUnitspublic static final int DEFAULT_INDENT
public static final String UNITS
public XmlGenerator(Appendable output, int indentation, String outputName, boolean writeUnits) throws IOException
output - destination of generated outputindentation - number of space for each indentation leveloutputName - output name for error messageswriteUnits - if true, units must be writtenIOException - if an I/O error occurs.DEFAULT_INDENTpublic FileFormat getFormat()
public void startMessage(String root, String messageTypeKey, double version) throws IOException
root - root element for XML filesmessageTypeKey - key for message typeversion - format versionIOException - if an I/O error occurs.public void endMessage(String root) throws IOException
root - root element for XML filesIOException - if an I/O error occurs.public void writeComments(List<String> comments) throws IOException
comments - comments to writeIOException - if an I/O error occurs.public void writeOneAttributeElement(String name, String value, String attributeName, String attributeValue) throws IOException
name - tag namevalue - element valueattributeName - attribute nameattributeValue - attribute valueIOException - if an I/O error occurs.public void writeTwoAttributesElement(String name, String value, String attribute1Name, String attribute1Value, String attribute2Name, String attribute2Value) throws IOException
name - tag namevalue - element valueattribute1Name - attribute 1 nameattribute1Value - attribute 1 valueattribute2Name - attribute 2 nameattribute2Value - attribute 2 valueIOException - if an I/O error occurs.public void writeEntry(String key, String value, Unit unit, boolean mandatory) throws IOException
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 ignoredIOException - if an I/O error occurs.public void enterSection(String name) throws IOException
enterSection in interface GeneratorenterSection in class AbstractGeneratorname - section nameIOException - if an I/O error occurs.public String exitSection() throws IOException
exitSection in interface GeneratorexitSection in class AbstractGeneratorIOException - if an I/O error occurs.Copyright © 2002-2021 CS GROUP. All rights reserved.