Generate C # class from an XSD

1

I need to generate the class from an .XSD file.

Although I have tried everything I knew (used .net tool: xsd.exe, httputility.net and other .cs generators) I did not succeed.

I think the error is in the schema that passed me, but I can not think of what the problem is. Can anyone help? Thanks in advance.

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.cnj.jus.br/replicacao-nacional"
elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cnj="http://www.cnj.jus.br/intercomunicacao-2.2.2" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">

<import schemaLocation="http://www.cnj.jus.br/images/dti/Comite_Gestao_TIC/Modelo_Nacional_Interoperabilidade/versao_07_07_2014/intercomunicacao-2.2.2.xsd"
    namespace="http://www.cnj.jus.br/intercomunicacao-2.2.2"></import>

<element name="processos">
    <complexType>
        <sequence>
            <element minOccurs="1" maxOccurs="unbounded" name="processo" type="cnj:tipoProcessoJudicial" />
        </sequence>
    </complexType>
</element>
</schema>
    
asked by anonymous 15.07.2016 / 20:07

1 answer

2

Do the following:

  • Save the file xsd ( http://www.cnj.jus.br/images/dti/Comite_Gestao_TIC/Modelo_Nacional_Interoperabilidade/versao_07_07_2014/intercomunicacao-2.2.2.xsd ) to your computer.
  • Edit the file and remove the first line <?xml version="1.0" encoding="UTF-8"?> and save.
  • You can now use the file to generate classe .

See part of the generated file:

namespace AutoGeneratedCode
{

   /// 
   [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34283")]
   [System.SerializableAttribute()]
   [System.Diagnostics.DebuggerStepThroughAttribute()]
   [System.ComponentModel.DesignerCategoryAttribute("code")]
   [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.cnj.jus.br/intercomunicacao-2.2.2")]
   [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.cnj.jus.br/intercomunicacao-2.2.2", IsNullable=true)]
   public partial class tipoEndereco
   {
      private string logradouroField;
      private string numeroField;
      private string complementoField;
      private string bairroField;
      private string cidadeField;
      private string estadoField;
      private string paisField;
      private string cepField;
      /// 
    
17.08.2016 / 23:23