XSD files (schema)

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,913
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have the following schema but when I try to validate it, using a tool such as:

Code:
https://www.w3schools.com/xml/xml_validator.asp

I get an error message:

Code:
error on line 37 at column 17: opening and ending tag mismatch. sequence line 0 and element.

Here is the code:

Code:
<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.joe.bloggs.org/2020/XMLSchema" >

 

<xs:element name="Employee_Data" type="EmployeeDataType" />

<xs:complexType name="EmployeeDataType">

  <xs:sequence>

   <xs:element ref="Employee" minOccurs="0" maxOccurs="unbounded" />

  </xs:sequence>

</xs:complexType>

 

<xs:element name="Employee" type="EmployeeType" />

<xs:complexType name="EmployeeType">

  <xs:sequence >

   <xs:element ref="Name" />

   <xs:element ref="Age" />

   <xs:simpleType>
   <xs:restriction base="xs:integer">
   <xs:minInclusive value="0"/>
   <xs:maxInclusive value="120"/>
   </xs:restriction>
   </xs:simpleType>
   </xs:element>

  

   <xs:element ref="Start Date" />

   <xs:element ref="Annual Income” />

         <xs:complexType>

            <xs:simpleContent>

                <xs:extension base="xs:double">

                    <xs:attribute name="currency">

                        <xs:simpleType>

                            <xs:restriction base="xs:string">

                                <xs:enumeration value="Pounds" />

                                <xs:enumeration value="Euros" />

                                <xs:enumeration value="USdollars" />

                            </xs:restriction>

                        </xs:simpleType>

                    </xs:attribute>

                </xs:extension>

            </xs:simpleContent>

        </xs:complexType>

    </xs:element>

   <xs:element ref="Department" />

   <xs:simpleType>
   <xs:restriction base="xs:string">
   <xs:enumeration value="Sales"/>
   <xs:enumeration value="Marketing"/>
   <xs:enumeration value="IT"/>
   </xs:restriction>
   </xs:simpleType>
   </xs:element>

 

<xs:element name="Name" type="xs:string" />

<xs:element name="Start Date" type="xs:date" />

 

</xs:schema>

Can someone tell me what is the problem?

Thanks
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
see this
Rich (BB code):
<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.joe.bloggs.org/2020/XMLSchema" >

<xs:element name="Employee_Data" type="EmployeeDataType" ></xs:element>
<xs:complexType name="EmployeeDataType">
  <xs:sequence>
   <xs:element ref="Employee" minOccurs="0" maxOccurs="unbounded" ></xs:element>
  </xs:sequence>
</xs:complexType>
<xs:element name="Employee" type="EmployeeType" ></xs:element>
<xs:complexType name="EmployeeType"></xs:complexType>
  <xs:sequence >
   <xs:element ref="Name" ></xs:element>
   <xs:element ref="Age" ></xs:element>
   <xs:simpleType>
   <xs:restriction base="xs:integer">
   <xs:minInclusive value="0"></xs:minInclusive>
   <xs:maxInclusive value="120"></xs:maxInclusive>
   </xs:restriction>
   </xs:simpleType>
  </xs:sequence >
   <xs:element ref="Start Date" ></xs:element>
   <xs:element ref="Annual Income" ></xs:element>
         <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:double">
                    <xs:attribute name="currency">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="Pounds" ></xs:enumeration>
                                <xs:enumeration value="Euros" ></xs:enumeration>
                                <xs:enumeration value="USdollars" ></xs:enumeration>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
   <xs:element ref="Department" >
   <xs:simpleType>
   <xs:restriction base="xs:string">
   <xs:enumeration value="Sales"></xs:enumeration>
   <xs:enumeration value="Marketing"></xs:enumeration>
   <xs:enumeration value="IT"></xs:enumeration>
   </xs:restriction>
   </xs:simpleType>
   </xs:element>
<xs:element name="Name" type="xs:string" ></xs:element>
<xs:element name="Start Date" type="xs:date" ></xs:element>

</xs:schema>
 
Upvote 0
see this
Rich (BB code):
<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.joe.bloggs.org/2020/XMLSchema" >

<xs:element name="Employee_Data" type="EmployeeDataType" ></xs:element>
<xs:complexType name="EmployeeDataType">
  <xs:sequence>
   <xs:element ref="Employee" minOccurs="0" maxOccurs="unbounded" ></xs:element>
  </xs:sequence>
</xs:complexType>
<xs:element name="Employee" type="EmployeeType" ></xs:element>
<xs:complexType name="EmployeeType"></xs:complexType>
  <xs:sequence >
   <xs:element ref="Name" ></xs:element>
   <xs:element ref="Age" ></xs:element>
   <xs:simpleType>
   <xs:restriction base="xs:integer">
   <xs:minInclusive value="0"></xs:minInclusive>
   <xs:maxInclusive value="120"></xs:maxInclusive>
   </xs:restriction>
   </xs:simpleType>
  </xs:sequence >
   <xs:element ref="Start Date" ></xs:element>
   <xs:element ref="Annual Income" ></xs:element>
         <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:double">
                    <xs:attribute name="currency">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="Pounds" ></xs:enumeration>
                                <xs:enumeration value="Euros" ></xs:enumeration>
                                <xs:enumeration value="USdollars" ></xs:enumeration>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
   <xs:element ref="Department" >
   <xs:simpleType>
   <xs:restriction base="xs:string">
   <xs:enumeration value="Sales"></xs:enumeration>
   <xs:enumeration value="Marketing"></xs:enumeration>
   <xs:enumeration value="IT"></xs:enumeration>
   </xs:restriction>
   </xs:simpleType>
   </xs:element>
<xs:element name="Name" type="xs:string" ></xs:element>
<xs:element name="Start Date" type="xs:date" ></xs:element>

</xs:schema>

Thanks for correcting.

Using that schema, I would like to generate an xml file.

Using this:

Code:
https://www.liquid-technologies.com/online-xsd-validator

it says the webpage is invalid (as it's made up).

How can I generate an xml file from this schema without a valid webpage?

Thanks
 
Upvote 0
Upvote 0
hm, it works to me

xmlgrid.png
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top