Microsoft Office Tutorials and References
In Depth Information
To save your data as an XML file, follow these steps in Notepad:
1 Click File, Save.
2 Click the Save As Type down arrow and click All Files.
3
Type the name of the file in the File Name box. For example, if the name of the file you
want to save as an XML file is MySuppliers.xml, you would type MySuppliers.xml .
There are several aspects of the data in the MySuppliers.xml file that you should notice. For
example, the first two lines of the data file provide information similar to the first two lines in
the schema file.
<?xml version="1.0” encoding="UTF-8” ?>
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”
<;$RD> xsi:noNamespaceSchemaLocation="MySuppliers.xsd">
The first line indicates the XML version and the text-encoding scheme used in the file, and the
second line indicates the base element in the schema ( Root ), the URL indicating the standards
document to which the data file conforms, and the name of the schema file (MySuppliers.xsd).
Note You can use the first two lines of the sample MySuppliers.xml file in your own XML
files. All you need to do is open the MySuppliers.xml file in a text editor, copy the lines,
paste them into your other XML file, and replace MySuppliers.xsd with the name of your
schema file.
The next section of the file contains the data used to populate your worksheet; it’s no surprise
that the structure of the data in MySuppliers.xml conforms exactly to the structure of the
schema presented in MySuppliers.xsd (which you can find on the companion CD-ROM).
For example, the schema file has the CompanyName element defined in the following line:
<element name="CompanyName” type="string"/>
And the data file has a corresponding line in each set of supplier data:
<CompanyName>New Orleans Cajun Delights</CompanyName>
Not every element has to contain data, but every element does need to occur within each rep­
etition of the Supplier element. For example, the Fax element in both of the sample data sets
contains no value, but the tags do have to occur in the XML data file so that the sequence of
elements occurs exactly as defined in the schema file.
Adding XML to a Workbook Manually
Once you have created an XML schema and an associated XML data file, you need to add the
structure of the schema to a worksheet. To do so, you establish a data map , or pattern of data
represented in a file, in your worksheet.
Search JabSto ::




Custom Search