API examples for .NET
The samples/cs
directory contains an example application written in C#,
designed to illustrate use of the Saxon API available in the Saxon.Api
namespace. The application is named Examples.cs
; it shows various ways of
invoking XSLT, XQuery, XPath, and schema validation. 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. The easiest (or most productive) way to run the example application is
to create a command-line application in your IDE (for example, Visual Studio), copy the
Example.cs
source code into the IDE as your entry module, and add a
dependency on SaxonCS. A quick look at the comments in the source should enable you to see
how they are executed.
The example application can be run from the command line. It takes the following arguments:
-
-dir:samples - provides the name of the samples directory from the
saxon-resources
download. -
-ask:yes|no - with ask:yes (the default), the application prompts after each test to ask if you want to continue.
-
-test:testname - supplies the name of the test you want to run, or "all" (the default) to indicate all tests.