NAntContrib Help Task Reference <xsd> | v0.92-rc1 |
[This is preliminary documentation and subject to change.]
The <xsd> task generates XML schema or common language runtime classes from XDR, XML, and XSD files, or from classes in a runtime assembly.
The following operations can be performed :
Operation | Description |
---|---|
XDR to XSD | Generates an XML schema from an XML-Data-Reduced schema file. XDR is an early XML-based schema format. |
XML to XSD | Generates an XML schema from an XML file. |
XSD to DataSet | Generates common language runtime DataSet classes from an XSD schema file. The generated classes provide a rich object model for regular XML data. |
XSD to Classes | Generates runtime classes from an XSD schema file. The generated classes can be used in conjunction with XmlSerializer to read and write XML code that follows the schema. |
Classes to XSD | Generates an XML schema from a type or types in a runtime assembly file. The generated schema defines the XML format used by XmlSerializer. |
Attribute | Type | Description | Required |
---|---|---|---|
assembly | file | Assembly (.dll or .exe) to generate an XML Schema for. | False |
element | string | XML element in the Schema to process. | False |
language | string | The language to use for the generated code - either CS , VB , JS , VJC or the fully-qualified name of a class implementing CodeDomProvider. |
False |
namespace | string | Specifies the runtime namespace for the generated types. The default namespace is Schemas . |
False |
outputdir | directory | The output directory in which to place generated files. | False |
schema | file | XML Schema (.xsd) filename. | False |
target | string | Target of XML Schema compilation - either classes or dataset . The default is classes . |
False |
types | string | Types in the assembly for which an XML schema is being created. By default all types in the assembly will be included. | False |
uri | string | Specifies the URI for the elements in the schema to generate code for. |
False |
xdr | file | XDR Schema to generate an XML Schema for. | False |
xmldoc | file | XML document to generate an XML Schema for. | False |
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False |
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False |
timeout | int | The maximum amount of time the application is allowed to execute, expressed in milliseconds. Defaults to no time-out. | False |
unless | bool | Opposite of if . If false then the task will be executed; otherwise, skipped. The default is false. |
False |
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False |
Attribute | Type | Description | Required |
---|---|---|---|
exename | string | The name of the executable that should be used to launch the external program. | False |
useruntimeengine | bool | Deprecated. Specifies whether the external program is a managed application which should be executed using a runtime engine, if configured. The default is false. | False |
Represents a command-line argument.
When passed to an external application, the argument will be quoted when appropriate. This does not apply to the line
parameter, which is always passed as is.
Attribute | Type | Description | Required |
---|---|---|---|
dir | directory | The value for a directory-based command-line argument; will be replaced with the absolute path of the directory. | False |
file | file | The name of a file as a single command-line argument; will be replaced with the absolute filename of the file. | False |
if | bool | Indicates if the argument should be passed to the external program. If true then the argument will be passed; otherwise, skipped. The default is true. | False |
line | string | List of command-line arguments; will be passed to the executable as is. | False |
path | <path> | The value for a PATH-like command-line argument; you can use : or ; as path separators and NAnt will convert it to the platform's local conventions, while resolving references to environment variables. | False |
unless | bool | Indicates if the argument should not be passed to the external program. If false then the argument will be passed; otherwise, skipped. The default is false. | False |
value | string | A single command-line argument; can contain space characters. | False |
A single command-line argument containing a space character.
<arg value="-l -a" />
Two separate command-line arguments.
<arg line="-l -a" />
A single command-line argument with the value \dir;\dir2;\dir3
on DOS-based systems and /dir:/dir2:/dir3
on Unix-like systems.
<arg path="/dir;/dir2:\dir3" />
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" />