Hi All,

I have been using eclipse and MS visual studio .net. I am looking for a way to generate a schema based on the input xml. Visual studio generated as shown below. However, is there a way to mention the below properties through GUI.
properties
<xs:whiteSpace value="collapse"></xs:whiteSpace>
<xs:maxLength value="16"></xs:maxLength>

xml

<dsureq>
    <request_id>DSUPROFILE4REQ</request_id>
    <control_data>12345</control_data>
    <plastic_number>1234567890</plastic_number>
    <cycle_date>Test</cycle_date>
    <echo_common>A</echo_common>
    <echo_reposition>0</echo_reposition>
    <correlation_id>Test</correlation_id>
</dsureq>

xsd using MS visual studio

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="dsureq">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="request_id" type="xs:string" />
                <xs:element name="control_data" type="xs:unsignedShort" />
                <xs:element name="plastic_number" type="xs:unsignedInt" />
                <xs:element name="cycle_date" type="xs:string" />
                <xs:element name="echo_common" type="xs:string" />
                <xs:element name="echo_reposition" type="xs:unsignedByte" />
                <xs:element name="correlation_id" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

create your own simpleType
in this type you can define restiction
http://www.datypic.com/books/defxmlschema/chapter09.html

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:simpleType name="request_id">
		<xs:restriction base="xs:string">
			<xs:enumeration value="DSUPROFILE4REQ"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="plastic_number">
		<xs:restriction base="xs:int">
			<xs:enumeration value="1234567890"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="echo_reposition">
		<xs:restriction base="xs:byte">
			<xs:enumeration value="0"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="echo_common">
		<xs:restriction base="xs:string">
			<xs:enumeration value="A"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="cycle_date">
		<xs:restriction base="xs:string">
			<xs:enumeration value="Test"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="correlation_id">
		<xs:restriction base="xs:string">
			<xs:enumeration value="Test"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="control_data">
		<xs:restriction base="xs:short">
			<xs:enumeration value="12345"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="dsureq">
		<xs:sequence>
			<xs:element ref="request_id"/>
			<xs:element ref="control_data"/>
			<xs:element ref="plastic_number"/>
			<xs:element ref="cycle_date"/>
			<xs:element ref="echo_common"/>
			<xs:element ref="echo_reposition"/>
			<xs:element ref="correlation_id"/>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="request_id" type="request_id"/>
	<xs:element name="plastic_number" type="plastic_number"/>
	<xs:element name="echo_reposition" type="echo_reposition"/>
	<xs:element name="echo_common" type="echo_common"/>
	<xs:element name="dsureq" type="dsureq"/>
	<xs:element name="cycle_date" type="cycle_date"/>
	<xs:element name="correlation_id" type="correlation_id"/>
	<xs:element name="control_data" type="control_data"/>
</xs:schema>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.