XsdTask Class

Summary

The NAnt.Contrib.Tasks.XsdTask generates XML schema or common language runtime classes from XDR, XML, and XSD files, or from classes in a runtime assembly.
Assembly
NAnt.Contrib.dll
Namespace
NAnt.Contrib.Tasks
Base Types
  • ExternalProgramBase
graph BT Type-->Base0["ExternalProgramBase"] Type["XsdTask"] class Type type-node

Syntax

[TaskName("xsd")]
[ProgramLocation(LocationType.FrameworkSdkDir)]
public class XsdTask : ExternalProgramBase

Examples

Compile a XML Schema.

<xsd 
schema="MySchema.xsd" 
element="MyRootElement" 
language="CS" 
namespace="MyCompany.MySchema" 
outputdir="build\bin"
uri="http://MySchema'sTargetNamespace" />

Generate an XML Schema from an assembly.

<xsd assembly="MyAssembly.dll" outputdir="build\Schemas" />

Generate an XML Schema from an XML document.

<xsd xmldoc="MyDoc.xml" outputdir="build\Schemas" />

Generate an XML Schema from an XDR Schema.

<xsd xdr="MyOldSchema.xdr" outputdir="build\Schemas" />

Remarks

The following operations can be performed :

Description Generates an XML schema from an XML-Data-Reduced schema file. XDR is an early XML-based schema format. Generates an XML schema from an XML file. Generates common language runtime classes from an XSD schema file. The generated classes provide a rich object model for regular XML data. Generates runtime classes from an XSD schema file. The generated classes can be used in conjunction with to read and write XML code that follows the schema. Generates an XML schema from a type or types in a runtime assembly file. The generated schema defines the XML format used by .
Operation
XDR to XSD
XML to XSD
XSD to DataSet
XSD to Classes
Classes to XSD

Attributes

Type Description
TaskName
ProgramLocation

Properties

Name Value Summary
Assembly FileInfo
Assembly (.dll or .exe) to generate an XML Schema for.
Element string
XML element in the Schema to process.
Language string
The language to use for the generated code - either CS, VB, JS, VJC or the fully-qualified name of a class implementing System.CodeDom.Compiler.CodeDomProvider.
Managed ManagedExecution
Gets a value indiciating whether the external program is a managed application which should be executed using a runtime engine, if configured.
Namespace string
Specifies the runtime namespace for the generated types. The default namespace is Schemas.
OutputDir DirectoryInfo
The output directory in which to place generated files.
ProgramArguments string
Gets the command-line arguments for the external program.
Schema FileInfo
XML Schema (.xsd) filename.
Target string
Target of XML Schema compilation - either classes or dataset. The default is classes.
Types string
Types in the assembly for which an XML schema is being created. By default all types in the assembly will be included.
Uri string
Specifies the URI for the elements in the NAnt.Contrib.Tasks.XsdTask.Schema to generate code for.
Xdr FileInfo
XDR Schema to generate an XML Schema for.
XmlDoc FileInfo
XML document to generate an XML Schema for.

Methods

Name Value Summary
ExecuteTask() void
Initialize() void
Validates the Task.