Testing our sample

The following is a sample main function if you want to try this code. It may also help you to understand how to use it:

public static function main(): Void
{
   trace('Hello World');
   trace(Page.fromXMLFile("/Users/benjamin/example.xml"));
   trace(Page.fromXMLFile("/Users/benjamin/example.xml"));
   
   var p = new Page();
   p.name = "Page de test";
   
   var l1 = new Layer();
   l1.id="l1";
   var l2 = new Layer();
   l2.id="l2";
   
   p.layers.add(l1);
   p.layers.add(l2);
   
   p.toXMLFile("/Users/benjamin/page1.xml");
}

Get haXe 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.