MarkLogic XCC/.Net Library |

# Marklogic.Xcc.Examples Namespace

The Marklogic.Xcc.Examples namespace contains example code to illustrate some usages of XCC/.NET.

Namespace hierarchy

### Classes

Class | Description
--- | ---
ContentFetcher | This class fetches documents from the conentbase and writes their serialized contents to a provided {@link OutputStream}.
ContentLoader | This program accepts a server URI (in the format expected by ContentSourceFactory.newContentSource(URI)}) and one or more file pathnames of documents to load. The main() method in this example leaves the ContentCreateOptions value set to null which will apply defaults when documents are loaded. This means that document type (XML, text() or binary()) may be determined by URI extention. If you instantiate this class from another class, you can set explicit options via the Options property before calling Load(). The main() method uses the absolute pathname of each file as its URI for loading. There is also a method provided which takes parallel arrays of URI strings and File objects.
HelloWorld | The obligatory Hello World example.
ModuleRunner | This is a very simple class that will invoke a named XQuery module on the server and return the result. The main() method looks for two command-line args, a URL for the server (ContentSourceFactory.newContentSource(URI)}) and theURI of a module to invoke. This URI should be relative to the "Library" path set in the XDBC server configuration for the content server you're connection to (arg #1). This program invokes the named module and then prints the result sequence to stdout, one item per line. The class has methods the could be used to set request options and to obtain the results as an array of Strings or as a real ResultSequence. If you want to set external variables for a request, you can fetch the Request property to obtain a reference to the internal Request object and set the variable values on it before calling Invoke().
QueryHelper | This is a staitc helper class with some common code routines used by the examples in this package. Click here for the source code for this class
SimpleQueryRunner | This is a very simple class that will submit an XQuery string to the server and return the result. The main() method looks for two command-line args, a URL for the server (ContentSourceFactory.NewContentSource(URI)}) and a filename to read a query from. It loads the file, submits its contents to the server for evaluation and then prints the result sequence to stdout, one item per line. The class has methods the could be used to set request options and to obtain the results as an array of Strings or as a real {@link ResultSequence}. If you want to set external variables for a request, you can user the Request property to obtain a reference to the internal Request object and set the variable values on it before invoking Execute().