I am writing a backend API that generates a structured textfile. Based off user input certain strings are filled via interpolation
// actual string literal
string message = $@"Version {version} of Markdown Monster is now available.
Released on: {releaseDate:MMM dd, yyyy}
{newStuff}
";
https://weblog.west-wind.com/posts/2016/Dec/27/Back-to-Basics-String-Interpolation-in-C.
I have this creating a 100 LOC text file filling in needed with JSON values I'm passed.
Sometimes only "sections" of the text file will be needed. How can I tokenize and assign a value to a section of the text to be generated if needed? There are a lot of possible permutations, around 30 different text files to be generated by the template.
So imagine an XML file and break it up in your head into 30 separate pieces. Programmatically put some number of pieces in some order via arbitrary user input.
//piece A
<?xml version = "1.0" encoding = "utf-8"?>
<!-- planes.xsd
A simple schema for planes.xml
-->
//piece b
<xsd:element name = "planes">
<xsd:complexType>
<xsd:all>
<xsd:element name = "make"
type = "xsd:string"
minOccurs = "1"
maxOccurs = "unbounded" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>
//piece C
lorem ipsosume....
Formatting and indention must also be preserved.