the use of xmlspy - hong kong polytechnic …click [schema design] Ł[generate documentation… ]...
TRANSCRIPT
![Page 1: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/1.jpg)
The Use of XMLSpy
COMP5323Web Databases & Applications
![Page 2: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/2.jpg)
User Interface
Info Window, which displays meta
information about the document item being
currently edited.
Main Window, where the document you edit appears.
Entry Helper Windows, which vary
according to the type of document
being viewed and the view
selected in the Main Window.
Output Windows, below the Main Window show the results of Validation, Find in Files, and
XPath evalustions.
Project Window, which allows you to
organize and edit files and groups of files
into projects.
![Page 3: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/3.jpg)
XML Schemas: BasicsCreating a new XML Schema File
To run the application, select [Start] è [Programs] è [Altova
XMLSpy 2008 Enterprise Edition] è[Altova XMLSpy]
![Page 4: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/4.jpg)
XML Schemas: BasicsCreating a new XML Schema File (1)
1. Choose [File] è [New]
1
2. Select [xsd W3C XML Schema]
2
![Page 5: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/5.jpg)
XML Schemas: BasicsCreating a new XML Schema File (2)
21
1. Enter “Company”2. Enter “Root Element”
![Page 6: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/6.jpg)
l Save it first
XML Schemas: BasicsCreating a new XML Schema File (3)
1. Select [File] è [Save]
2. Enter “AddressFirst” in [File name] box.
3. Press [Save] button
![Page 7: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/7.jpg)
XML Schemas: BasicsDefine Namespaces
1. Select [Schema design] è [Schema Settings… ]
2. In [Target namespace] box, enter http://my.company.com/namespace
3. Press [OK]
1
2
3
![Page 8: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/8.jpg)
XML Schemas: BasicsDefine Content Model
Click [Display Diagram] icon of the [Company]
element
![Page 9: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/9.jpg)
XML Schemas: BasicsDefine Content Model (2)
Sequence compositor is generated
Right click on [Company], select [Add child] è [Sequence]
![Page 10: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/10.jpg)
Enter “Address”
Right click the [Sequence] compositor and select [Add child] è [Element]
XML Schemas: BasicsDefine Content Model (3)
![Page 11: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/11.jpg)
XML Schemas: BasicsDefine Content Model (4)
Try to add [Person] yourself.
![Page 12: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/12.jpg)
XML Schemas: BasicsDefine Content Model (5)
Right click [Person] è [Unbounded].
It sets the occurrences:1 to infinity.
![Page 13: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/13.jpg)
XML Schemas: BasicsAdding additional levels
1. Right click [Address] è[Add child] è [Sequence]
2. Right click [Sequence] compositor è [Add child] è [Element]
3. Enter “Name”4. Final layout
1
2
3 4
![Page 14: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/14.jpg)
XML Schemas: BasicsView Schema in TEXT mode
Notice that whenever a Sequence compositorwas inserted, the [xs:sequence] element was
inserted within the [xs:complexType] element.
A complex type element is one which contains attributes or elements.
![Page 15: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/15.jpg)
XML Schemas: BasicsDefine [Name] as [xs:string]
Click the [Name] element.
In ‘Details’Entry Helper, from the dropdown menu of the [type] combo
box, select the [xs:string] entry.
In text mode, [type=“xs:string”] was added in [Name] element.
![Page 16: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/16.jpg)
XML Schemas: BasicsAdd element with Drag-and-Drop
Click the [Name] element and hold down the [Ctrl] key, and drag-and-
drop the element box with the mouse. New element, [Name] is duplicated.
Do it once again therefore, there are three elements for the [Address].
![Page 17: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/17.jpg)
XML Schemas: BasicsName the Duplicated Elements
Double click the duplicated elements
one by one and name them “Street”and “City”respectively.
So that [Address] element has a
sequence of [Name], [Street] and [City]
elements.
![Page 18: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/18.jpg)
[Schema design] è[Configure view… ], then click [Append]
icon
XML Schemas: BasicsConfigure Content Model View (1)
![Page 19: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/19.jpg)
From dropdown menu, select [type], then for each element
select [xs:string]
XML Schemas: BasicsConfigure Content Model View (2)
![Page 20: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/20.jpg)
XML Schemas: BasicsComplete the Basic Schema
1. Right click [Person] è [Add child] è [Sequence]. 2. Right sequence compositorè [Add child] è
[Element].3. Enter “First”as the name.4. Choose [xs:string] as the data type.
1
2
3
4
![Page 21: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/21.jpg)
XML Schemas: BasicsComplete the Basic Schema (2)
Add the following [Last], [Title], [PhoneExt] and [Email].
![Page 22: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/22.jpg)
XML Schemas: BasicsComplete the Basic Schema (3)
Make an element optional. Right click the [Title] element and select [Optional]. In the [Details] Entry Helper, we can see [minOcc] = 0and [maxOcc] = 1, indicating that
the element is optional.
![Page 23: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/23.jpg)
XML Schemas: BasicsComplete the Basic Schema (4)Change data type from [xs:string] to [xs:integer] for [PhoneExt] element.
Click on [PhoneExt], press [tab] and open the dropdown menu. Then, choose [xs:integer] instead of [xs:string]. In the [Facets] Entry Helper, double-click in the [maxIncl] field and enter “99”. This defines that all
phone extensions up to, and including 99 are valid.
[File] è [Save] to save the changes to the schema
![Page 24: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/24.jpg)
XML Schemas: AdvancedWork with Complex Type
Right click [Address] è[Make Global] è[Complex type].
Then a global complex type called [AddressType]
is created.
![Page 25: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/25.jpg)
XML Schemas: AdvancedSchema Overview
Click [Display All Globals] icon to return to the Schema Overview.
![Page 26: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/26.jpg)
XML Schemas: AdvancedExtend Complex Type (1)
1. Click [Append] icon è [Complex Type] to new a component.
2. Enter “US-Address”
1
2
![Page 27: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/27.jpg)
XML Schemas: AdvancedExtend Complex Type (2)
1. Click [Content Model View] icon of [US-Address]
2. In [Details] entry helper, click the [base] combo box and select [AddressType]
1
2
![Page 28: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/28.jpg)
XML Schemas: AdvancedUS-Address uses AddressType
![Page 29: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/29.jpg)
XML Schemas: AdvancedExtend the AddressType
1. Right click [US-Address] è [Add child] è [Sequence]2. Right click [Sequence compositor] è [Add child] è
[Element]3. Enter “Zip”and select [xs:positiveInteger] as type4. Final view
1
2
4
3
![Page 30: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/30.jpg)
XML Schemas: AdvancedCreate a Global Simple Type (1)
1
2
3
1. Click [Append] icon2. Select [Simple Type]3. Enter “US-State”as the name
![Page 31: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/31.jpg)
XML Schemas: AdvancedCreate a Global Simple Type (2)
In [Details] entry helper, open [restr] dropdown
menu, select [xs:string]
![Page 32: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/32.jpg)
XML Schemas: AdvancedApply [US-State] in [US-Address]
1. Switch to [Component Model View] of [US-Address]
2. Right click the lower [sequence compositor] è [Add child] è[Element]
3. Enter “State”as the name4. Select [US-State] as the data type
![Page 33: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/33.jpg)
XML Schemas: AdvancedCreate 2nd Complex Type
Try this out by yourself, to create the second Complex Type, [UK-Address]
![Page 34: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/34.jpg)
XML Schemas: AdvancedReference Global Element (1)
Right click [Person] è [Make Global] è [Element]A small link arrow icon appears in the [Person] element, showing that this element now references the globally declared [Person] element.
![Page 35: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/35.jpg)
XML Schemas: AdvancedReference Global Element (2)
In the [Details] Entry Helper”, the [isRef] check box is now activated.
In the [Components] box, [Person] element is added.
![Page 36: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/36.jpg)
XML Schemas: AdvancedAttributes & Attribute Enumerations (1)
1. Switch to Schema Overview, click [Person] element to make it active
2. Choose [Attributes] tag
3. Click [Append] icon
4. Select [Attribute]
1
43
2
![Page 37: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/37.jpg)
XML Schemas: AdvancedAttributes & Attribute Enumerations (2)
1
2 3
1. Enter “Manager”as the attribute name in the Name field.
2. In the [Type] combo box select [xs:boolean]
3. In the [Use] combo box select [required]
![Page 38: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/38.jpg)
XML Schemas: AdvancedAttributes & Attribute Enumerations (3)
1
1. Repeat previous procedures to create [Programmer]
2. Again, create [Degree] but with Type=xs:string
3. In [Facets] box, choose [Enumerations] tag
4. Add “BA”, “MA”& “PhD”as the enumeration values
2
3
4
![Page 39: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/39.jpg)
XML Schemas: AdvancedSave the Schema
Check that [attributes] are added as below figure.Remember to save the scheme ([File] è [Save]).
Also, save as a new file, “AddressLast.xsd”.
![Page 40: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/40.jpg)
XML Schemas: AdvancedReview
![Page 41: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/41.jpg)
XML Schemas: AdvancedSchema DocumentationClick [Schema design] è [Generate Documentation… ]
Select [HTML], if you want to have an html document.
Or, you may have a Microsoft Word document or even a RTF document
by choosing different radio button of [Output format].
Give it a name to save(e.g. AddressFirst.html).
![Page 42: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/42.jpg)
XML Schemas: AdvancedLook at the Page
![Page 43: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/43.jpg)
Create XML File
[File] è [New] è [XML Document]
![Page 44: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/44.jpg)
Create XML FileChoose Schema File
Select [Schema].
Then, choose “AddressLast.xsd”as the schema file.
![Page 45: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/45.jpg)
Create XML FileGrid View
Check the [Grid] view.
Click [Down] arrow to expand and view the details.
![Page 46: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/46.jpg)
Create XML FileAdd Attribute
Right click on [Name] è [Insert] è [Attribute]
[= xs:type] is added, enter “US-Address”
![Page 47: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/47.jpg)
Create XML FileEnter other details
Enter the following:“US dependency” for [<> Name],“Noble Ave” for [<> Street], and
“Dallas” for [<> City]
![Page 48: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/48.jpg)
Create XML FileValidate the File
Check the “Well-formedness”and “Validate XML” by pressing the
icons belowor
[F7] to check the “Well-formedness”or
[F8] to check “Validate XML”
Element with “!”next to it means that the element
should be included in the form (XML document).
![Page 49: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/49.jpg)
Create XML FileFile Check Results
“Well-formedness”check is OK.
“Validate XML”check is not OK because some required fields missed.
![Page 50: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/50.jpg)
Create XML FileCorrect the File
Double click [<>!Zip] to add the [<> Zip] attribute in [Address]
Note that we need to add [<>!State] too.
So, double click on it too.
![Page 51: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/51.jpg)
Create XML FileEnter Some Data
[<>Zip] and [<>State] are added.
Also, enter “04812” for [Zip] and “Texas” for [State]
![Page 52: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/52.jpg)
Create XML FileEnter Data in Text View
When “<” is entered, “<> Person” appears at once. Click on it, {Person Manager=“”} is automatically added.
Type “t”and then choose [true] from the box.
![Page 53: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/53.jpg)
Create XML FileEnter Details of Rest
Press the spacebar at the end of the line and then select [= Degree] from the box.
Type “b”and then choose [BA] from the list. Press the spacebar at the end of the line and then select [= Programmer] from the box.
Type “f”and then choose [false].
![Page 54: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/54.jpg)
Create XML FileCheck Inputs
Type “f”and then choose [false]. Type “>”at the end of the line.
When “>” is entered, the rest elements are added
automatically and together with the end tag “</Person>”.
Check the inputs at the [Grid] view. It should be viewed as the figure next.
![Page 55: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/55.jpg)
Create XML FileAdd More [Person] (1)
Add more [Person]. First click on [Person] area and then double click [<> Person] under [Elements] window.
![Page 56: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/56.jpg)
Create XML FileAdd More [Person] (2)
Change the view by clicking the [Table] icon or press [F12] key.
![Page 57: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/57.jpg)
Create XML FileAdd More [Person] (3)
Double click [= Degree] and [= Programmer] to add the two attributes.
Double click the box to choose a value from the list or enter value
directly.
![Page 58: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/58.jpg)
Create XML FileAdd More [Person] (4)
Double click [<> Person] to new one more row (record).
Add details as below figure.
![Page 59: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/59.jpg)
Create XML FileCheck Again the Validation
Press [F7] to check the “Well-formedness”.
Press [F8] to check the “Validate XML”.
Both checks arePassed
this time.
![Page 60: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/60.jpg)
Create XML FileSave the File
Remember to save your work.
For example, save it as “Company_org.xml”.
![Page 61: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/61.jpg)
Create XML File from Database- Microsoft Access (1)
Click [Convert] è [Create XML Schema from DB Structure]
![Page 62: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/62.jpg)
Check [Microsoft Access (ADO)]
Click [Next]
Create XML File from Database- Microsoft Access (2)
![Page 63: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/63.jpg)
Use [Browse] button to locate the database file
(DB2schema.mdb),then click [Next]
Create XML File from Database- Microsoft Access (3)
![Page 64: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/64.jpg)
Check [User Tables]
Press [Import]
Create XML File from Database- Microsoft Access (4)
![Page 65: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/65.jpg)
The four tables of the database file are now
converted into four elements in the XML schema
Create XML File from Database- Microsoft Access (5)
![Page 66: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/66.jpg)
Check the [Division] element.
Create XML File from Database- Microsoft Access (6)
![Page 67: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/67.jpg)
The generated schema appears in the Schema Design View.
Click the “Identity constraints” tab, to see the keyref and key fields of
the respective elements.
[key] refers to the [PrimaryKey] field of [Division] itself.
[keyref] refers to [ForeignKey] fields of both [Person] and [VIP]
Create XML File from Database- Microsoft Access (7)
![Page 68: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/68.jpg)
View the content model of [Altova]
Create XML File from Database- Microsoft Access (8)
![Page 69: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/69.jpg)
Details on lower levels
Create XML File from Database- Microsoft Access (9)
![Page 70: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/70.jpg)
Select [Convert] è [Create XML Schema from DB Structure]
Select [IBM DB2 (ODBC)] è [Next]
Create XML File from Database- IBM DB2 (1)
![Page 71: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/71.jpg)
Select [Create a new Data Source Name (DSN) with the driver:] and [IBM DB2 ODBC
DRIVER] è [Next]
Create XML File from Database- IBM DB2 (2)
![Page 72: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/72.jpg)
Register a [Data source name]. For example, [db2source] is used and given “DB2 Sample
Source”as Description.
Create XML File from Database- IBM DB2 (3)
Enter [User ID] and [Password] to connect to the
database .
![Page 73: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/73.jpg)
From the table list, check tables which will be imported into the XML Schema. For
example, check both [DEPARTMENT] and
[EMPLOYEE].
Create XML File from Database- IBM DB2 (4)
![Page 74: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/74.jpg)
In Schema Overview, click [Identity
constraints] tab to see the [keyref] and [key]
fields of respective elements.
Create XML File from Database- IBM DB2 (5)
![Page 75: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/75.jpg)
Check[Content Model]
view
Create XML File from Database- IBM DB2 (6)
![Page 76: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/76.jpg)
Check [Validation] of
both [well-formedness] and [validate
XML].
Create XML File from Database- IBM DB2 (7)
![Page 77: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/77.jpg)
Check the schema in [Text] view.
Remember to save the Schema.
[File] è [Save] to save the schema. For
example, save it as “db2example.xsd”.
Create XML File from Database- IBM DB2 (8)
![Page 78: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/78.jpg)
XML Tutorial
Any question?
![Page 79: The Use of XMLSpy - Hong Kong Polytechnic …Click [Schema design] Ł[Generate Documentation… ] Select [HTML], if you want to have an html document. Or, you may have a Microsoft](https://reader036.vdocuments.site/reader036/viewer/2022070703/5e7a767c98e62c61474c8e25/html5/thumbnails/79.jpg)
XML Tutorial
Good-bye.