Prev | Current Page 849 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

It is easy to
create complex rules, by far easier than writing an equivalent in XML Schema and for sure more complex
rules than the ones definable with DTDs. The use of regular expressions in the rules is really
fundamental; more information on the regular expressions can be found in Chapter 8 in the ??? Regular
Expressions ??? section.
XML Proxy
In version 1.14 of haXe, the haxe.xml.Proxy class has been added. The idea behind the class is to add a
type check at compile time that is based on an XML resource. The proxy class must always be extended
to be used, and when you are extending a haxe.xml.Proxy, two type parameters must be declared.
The first is a Const type parameter whose value must be the filename of an existing XML file. The XML
file must be reachable at compile time and, thus, can be placed anywhere as far as the folder is in the
compiler class path. The second type parameter denotes the type of the fields defined by the proxy.
In the following example, an XML Proxy is used to be sure that the data loaded from the XML file
is really available and can be used in code.


Pages:
837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861