XSD with Schema with restriction "pattern, enumeration, max and min" Java

2

I'm trying to generate a wsdl where it will generate xsd reflecting entity classes.

The problem is that I can not generate the restriction in xsd as needed by each property of the appropriate classes.

What I'm generating:

<xs:complexType name="apolice">
<xs:sequence>
<xs:element name="CD_SISTEMA_ORIGEM" type="xs:string"/>
<xs:element name="CD_PRODUTO" type="xs:short"/>
<xs:element name="NRO_PROPOSTA" type="xs:long"/>
<xs:element name="DT_PERIODO_INI" type="xs:int"/>
<xs:element name="DT_PERIODO_FIM" type="xs:int"/>
</xs:sequence>
</xs:complexType>

Class I use to generate:

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="PropostaSeguro")

public class Apolice {

public Apolice(){

}


@XmlElement(name = "CD_SISTEMA_ORIGEM", required = true)
public String cdSistemaOrigem;

@XmlElement(name = "CD_PRODUTO", required = true)
public short cdProduto;

@XmlElement(name = "NRO_PROPOSTA", required = true)
public long nroProposta;

@XmlElement(name = "DT_PERIODO_INI", required = true)
public Integer dtPeriodoIni;

@XmlElement(name = "DT_PERIODO_FIM", required = true)
public Integer dtPeriodoFim;

More get and set methods of the class

What I need to generate:

<xs:element name="car">
 <xs:simpleType>
  <xs:restriction base="xs:string">
   <xs:enumeration value="Audi"/>
   <xs:enumeration value="Golf"/>
   <xs:enumeration value="BMW"/>
  </xs:restriction>
 </xs:simpleType>
</xs:element>

<xs:element name="letter">
 <xs:simpleType>
  <xs:restriction base="xs:string">
   <xs:pattern value="[a-z]"/>
 </xs:restriction>
</xs:simpleType>

 <xs:element name="password">
 <xs:simpleType>
  <xs:restriction base="xs:string">
   <xs:minLength value="5"/>
   <xs:maxLength value="8"/>
  </xs:restriction>
 </xs:simpleType>
</xs:element>

Thanks in advance for your help!

    
asked by anonymous 23.08.2018 / 16:08

0 answers