Solved

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

Posted on 2010-09-10
1
556 Views
Last Modified: 2012-05-10
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

0
Comment
Question by:Hoboly
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 33644441
I use Trang for autogeneration of schemata
- either in Oxygen IDE (www.oxygenxml.com) That is a very good XML IDE
- or command line (http://www.thaiopensource.com/relaxng/trang.html)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now