Example applications for .NET

The samples/cs directory contains some sample applications written in C#, designed to illustrate use of the Saxon API available in the Saxon.Api namespace. In particular there are three programs ExamplesHE.cs, ExamplesPE.cs, and ExamplesEE.cs relevant to Saxon-HE, Saxon-PE, and Saxon-EE respectively; each shows various ways of invoking XSLT, XQuery, XPath, and schema validation where appropriate. The idea is that you should be able to cut and paste a suitable fragment of code into your own application as a quick way of getting started.

The main value of these samples is in reading the source code rather than in actually running them; however, running them is also a good check that your installation has been set up correctly. A quick look at the comments in the source should enable you to see how they are executed. Note that they all require the environment variable SAXON_HOME to be set to the directory where Saxon is installed: this is used to find the sample data files.

The example applications can be run from the command line (executables are found in the samples/cs/bin directory). They take the following arguments:

Also in the same directory is an application TestRunner which is a test harness for running the XSLT, XQuery, and XSD test suites published by W3C (in the case of XSLT, the test data is available to W3C members only); and an application XPathExample which illustrates the use of Saxon's JAXP XPath API from C# (see Shakespeare Example for more information).