Link to home
Start Free TrialLog in
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

ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial