Generate C # Class from an XSD
I am needing to generate the class from a file .XSD.
Although I have already tried everything I knew (used .NET tool: xsd.exe, httputility.net and other generators .cs) did not succeed.
I believe that the error is in the schema they passed to me, but I can not idetify what the problem is. Can anyone help? I appreciate it now.
<?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>
1
Author: rubStackOverflow, 2016-07-15
1 answers
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
) on your computer. - edit the file and remove 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;
///
2
Author: rubStackOverflow, 2016-08-17 21:23:47