Advertisement
Spectrewiz

Kinetic Code Mark Up Language Test

Jun 30th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. //(file test.kcml)
  2. /*
  3. <Test>
  4.     <testvar att="attribute" att2="attribute2" att3="attribute3" />
  5.     <testvar att="second variable attribute with spaces" />
  6.     <testvar att="third variable attribute" />
  7. </Test>
  8.  
  9. <UpOneLevel>
  10.     <newvar class="new variable" />
  11. </UpOneLevel>
  12. */
  13.  
  14. //(file Program_Test_for_kcml.cs)
  15. using Kinetic_Code_Mark_Up_Language.dll;
  16.  
  17. namespace Test
  18. {
  19.     class Program
  20.     {
  21.         static void Main(string[] args)
  22.         {
  23.             Parser parser = new Parser("Test", "testvar", "att");
  24.             Parser parser2 = new Parser("UpOneLevel", "newvar", "class");
  25.             Console.WriteLine("--- Parsed attributes from variables \"" + parser.variableToParse + "\" with attribute \"" + parser.attributeFromVariable + "\" in \"" + parser.objectToParse + "\" ---");
  26.             foreach (string str in parser.Parse("test.kcml", parser.attributeFromVariable))
  27.                 Console.WriteLine(str);
  28.             Console.WriteLine(); Console.WriteLine("--- Parsed attributes from variables \"" + parser2.variableToParse + "\" with attribute \"" + parser2.attributeFromVariable + "\" in \"" + parser2.objectToParse + "\" ---");
  29.             foreach (string str in parser2.Parse("test.kcml", parser2.attributeFromVariable))
  30.                 Console.WriteLine(str);
  31.             Console.ReadLine();
  32.  
  33.             /* output:
  34.              * --- Parsed attributes from variables "testvar" with attribute "att" in "Test" ---
  35.              * attribute
  36.              * second variable attribute with spaces
  37.              * third variable attribute
  38.              *
  39.              * --- Parsed attributes from variables "newvar" with attribute "class" in "UpOneLevel" ---
  40.              * new variable
  41.              */
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement