title: Generating C# classes from XSD
body: <p>This is xml shema from which I want generate classes for C# using xsd tool:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:b2g="http://www.carina.hr/b2g/v1.0.0#" xmlns:xadesv141="http://uri.etsi.org/01903/v1.4.1#" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.carina.hr/b2g/v1.0.0#" elementFormDefault="qualified"&gt;
     &lt;xsd:import namespace="http://uri.etsi.org/01903/v1.4.1#" schemaLocation="http://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd" /&gt;
     &lt;xsd:import namespace="http://uri.etsi.org/01903/v1.3.2#" schemaLocation="http://uri.etsi.org/01903/v1.3.2/XAdES.xsd" /&gt;
     &lt;xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd" /&gt;
     &lt;element name="B2GDocument" type="b2g:B2GDocumentType" /&gt;
     &lt;complexType name="B2GDocumentType"&gt;
        &lt;sequence&gt;
           &lt;element name="RequestHeader" type="b2g:RequestHeaderType" minOccurs="1" maxOccurs="1" /&gt;
           &lt;element name="ResponseHeader" type="b2g:ResponseHeaderType" minOccurs="0" maxOccurs="1" /&gt;
           &lt;element name="Content" type="b2g:ContentType" minOccurs="1" maxOccurs="1" /&gt;
           &lt;xsd:element ref="ds:Signature" minOccurs="0" maxOccurs="1" /&gt;
        &lt;/sequence&gt;
        &lt;attribute name="version" type="string" fixed="1.0" /&gt;
     &lt;/complexType&gt;
     &lt;complexType name="RequestHeaderType"&gt;
        &lt;annotation&gt;
           &lt;documentation&gt;Header of the document.&lt;/documentation&gt;
        &lt;/annotation&gt;
        &lt;sequence&gt;
           &lt;element name="AppId"&gt;
              &lt;annotation&gt;
                 &lt;documentation&gt;Id of the target application.&lt;/documentation&gt;
              &lt;/annotation&gt;
              &lt;simpleType&gt;
                 &lt;restriction base="string"&gt;
                    &lt;whiteSpace value="collapse" /&gt;
                 &lt;/restriction&gt;
              &lt;/simpleType&gt;
           &lt;/element&gt;
           &lt;element name="TraderId"&gt;
              &lt;annotation&gt;
                 &lt;documentation&gt;Id of the trader.&lt;/documentation&gt;
              &lt;/annotation&gt;
              &lt;simpleType&gt;
                 &lt;restriction base="string"&gt;
                    &lt;xsd:maxLength value="17" /&gt;
                    &lt;whiteSpace value="collapse" /&gt;
                 &lt;/restriction&gt;
              &lt;/simpleType&gt;
           &lt;/element&gt;
           &lt;element name="TraderAppId"&gt;
              &lt;annotation&gt;
                 &lt;documentation&gt;Id of the trader application.&lt;/documentation&gt;
              &lt;/annotation&gt;
              &lt;simpleType&gt;
                 &lt;restriction base="string"&gt;
                    &lt;xsd:maxLength value="48" /&gt;
                    &lt;whiteSpace value="collapse" /&gt;
                 &lt;/restriction&gt;
              &lt;/simpleType&gt;
           &lt;/element&gt;
           &lt;element name="TraderMsgId" maxOccurs="1" minOccurs="0"&gt;
              &lt;annotation&gt;
                 &lt;documentation&gt;Mime type of the document.
  Currently:
  text/xml application/pdf&lt;/documentation&gt;
              &lt;/annotation&gt;
              &lt;simpleType&gt;
                 &lt;restriction base="string" /&gt;
              &lt;/simpleType&gt;
           &lt;/element&gt;
           &lt;element name="DocUuid" type="b2g:DocUuidType" maxOccurs="1" minOccurs="0" /&gt;
        &lt;/sequence&gt;
        &lt;xsd:attribute name="Id" type="xsd:ID" use="required" /&gt;
     &lt;/complexType&gt;
     &lt;complexType name="ContentType"&gt;
        &lt;sequence&gt;
           &lt;element name="DocType" type="string" maxOccurs="1" minOccurs="1" /&gt;
           &lt;element name="MimeType" type="string" maxOccurs="1" minOccurs="1" /&gt;
           &lt;element name="Description" type="string" maxOccurs="1" minOccurs="0"&gt;
              &lt;annotation&gt;
                 &lt;documentation&gt;Opcionalni opis dokumenta. Maksimalna duljina je 255 znakova.&lt;/documentation&gt;
              &lt;/annotation&gt;
           &lt;/element&gt;
           &lt;element name="Data" maxOccurs="1" minOccurs="1"&gt;
              &lt;xsd:complexType mixed="true"&gt;
                 &lt;xsd:sequence minOccurs="0" maxOccurs="unbounded"&gt;
                    &lt;xsd:any namespace="##any" processContents="lax" /&gt;
                 &lt;/xsd:sequence&gt;
                 &lt;xsd:attribute name="encoding" use="required"&gt;
                    &lt;simpleType&gt;
                       &lt;restriction base="string"&gt;
                          &lt;enumeration value="EMBEDDED" /&gt;
                          &lt;enumeration value="BASE64" /&gt;
                       &lt;/restriction&gt;
                    &lt;/simpleType&gt;
                 &lt;/xsd:attribute&gt;
                 &lt;xsd:anyAttribute namespace="##any" /&gt;
              &lt;/xsd:complexType&gt;
           &lt;/element&gt;
        &lt;/sequence&gt;
        &lt;xsd:attribute name="Id" type="xsd:ID" use="required" /&gt;
     &lt;/complexType&gt;
     &lt;complexType name="ResponseHeaderType"&gt;
        &lt;sequence&gt;
           &lt;element name="DocUuid" type="b2g:DocUuidType" /&gt;
           &lt;element name="ReceiveTimestamp" type="dateTime" /&gt;
        &lt;/sequence&gt;
        &lt;xsd:attribute name="Id" type="xsd:ID" use="required" /&gt;
     &lt;/complexType&gt;
     &lt;xsd:simpleType name="DocUuidType"&gt;
        &lt;xsd:restriction base="xsd:string"&gt;
           &lt;xsd:length value="36" /&gt;
           &lt;xsd:pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" /&gt;
        &lt;/xsd:restriction&gt;
     &lt;/xsd:simpleType&gt;
  &lt;/schema&gt;
  </code></pre>
  
  <p>When I try to generate classes using </p>
  
  <pre><code>C:\test&gt;xsd G2BDokument.xsd /Classes
  </code></pre>
  
  <p>I get this message:</p>
  
  <pre><code>Microsoft (R) Xml Schemas/DataTypes support utility
  [Microsoft (R) .NET Framework, Version 2.0.50727.3038]
  Copyright (C) Microsoft Corporation. All rights reserved.
  Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#:Signature' element is not declared. Line 20, position 11.
  
  Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.
  
  Error: Error generating classes for schema 'G2BDokument'.
    - The element 'http://www.w3.org/2000/09/xmldsig#:Signature' is missing.
  
  If you would like more help, please type "xsd /?".
  </code></pre>
  
  <p>I can not figure out what I am doing wrong, so can anyone please help me?
  Thanks!</p>