Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //(file test.kcml)
- /*
- <Test>
- <testvar att="attribute" att2="attribute2" att3="attribute3" />
- <testvar att="second variable attribute with spaces" />
- <testvar att="third variable attribute" />
- </Test>
- <UpOneLevel>
- <newvar class="new variable" />
- </UpOneLevel>
- */
- //(file Program_Test_for_kcml.cs)
- using Kinetic_Code_Mark_Up_Language.dll;
- namespace Test
- {
- class Program
- {
- static void Main(string[] args)
- {
- Parser parser = new Parser("Test", "testvar", "att");
- Parser parser2 = new Parser("UpOneLevel", "newvar", "class");
- Console.WriteLine("--- Parsed attributes from variables \"" + parser.variableToParse + "\" with attribute \"" + parser.attributeFromVariable + "\" in \"" + parser.objectToParse + "\" ---");
- foreach (string str in parser.Parse("test.kcml", parser.attributeFromVariable))
- Console.WriteLine(str);
- Console.WriteLine(); Console.WriteLine("--- Parsed attributes from variables \"" + parser2.variableToParse + "\" with attribute \"" + parser2.attributeFromVariable + "\" in \"" + parser2.objectToParse + "\" ---");
- foreach (string str in parser2.Parse("test.kcml", parser2.attributeFromVariable))
- Console.WriteLine(str);
- Console.ReadLine();
- /* output:
- * --- Parsed attributes from variables "testvar" with attribute "att" in "Test" ---
- * attribute
- * second variable attribute with spaces
- * third variable attribute
- *
- * --- Parsed attributes from variables "newvar" with attribute "class" in "UpOneLevel" ---
- * new variable
- */
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement