Avatar of Hoboly
Hoboly
 asked on

What is the correct way and tools to create xsd file for excel?

I have a Sample.xml file
I used visual studio to create a xsd file as follow:
        Dim DS As New Data.DataSet
        DS.ReadXmlSchema("Sample.xml")
        'DT.TableName = "RobotLog"
        DS.WriteXmlSchema("sample.xsd")

I used Sample.xsd to map sample.xml in excel
and then modify the data in excel and then export to a new xml file

I have encountered this error: "cannot save or export xml data. the xml maps in this workbook are not exportable"


The sample:xsd is


<?xml version="1.0" standalone="yes"?>
<xs:schema id="Logs" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="Logs" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Log">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="RobotID" type="xs:string" minOccurs="0" />
              <xs:element name="TaskID" type="xs:int" minOccurs="0" />
              <xs:element name="TaskLogicalID" type="xs:int" minOccurs="0" />
              <xs:element name="LogType" type="xs:int" minOccurs="0" />
              <xs:element name="TaskStartTime" type="xs:dateTime" minOccurs="0" />
              <xs:element name="TaskEndTime" type="xs:dateTime" minOccurs="0" />
              <xs:element name="Result" type="xs:string" minOccurs="0" />
              <xs:element name="Details" type="xs:string" minOccurs="0" />
              <xs:element name="Config" type="xs:string" minOccurs="0" />
              <xs:element name="Remark" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>


If I don't want to edit the xsd in notepad.
What tools and the correct way can I use to create sample.xsd from sample.xml ??


Thanks!
part of Sample.xml

<?xml version="1.0"?>
<!--log file for Task ID: 77022-->
<Logs>
  <Log>
    <RobotID>ROBOT14</RobotID>
    <TaskID>16005</TaskID>
    <TaskLogicalID>16</TaskLogicalID>
    <LogType>6</LogType>
    <TaskStartTime>2010-09-06 23:43:47</TaskStartTime>
    <TaskEndTime>2010-09-06 23:44:02</TaskEndTime>
    <Result>Success</Result>
    <Details>-</Details>
    <Config>-</Config>
    <Remark>SPA#ST1D Group                                     2010-09-06 23:43:47 ~ 2010-09-06 23:44:02 Result: Successful</Remark>
  </Log>
</Logs>

Open in new window

Microsoft ExcelXMLVisual Basic.NET

Avatar of undefined
Last Comment
Gertone (Geert Bormans)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Gertone (Geert Bormans)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes