Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies 1 Introduction to XML Objectives: This module covers basic knowledge about XML, and its supporting technologies such as DTD, XML Schema, CSS, and XSL. Also, it covers an introduction to an XML editor, Stylus Studio(eXcelon Corp.) (Remark: Only Internet Explorer 5.0 or above supports XML.) References: “XML in a Nutshell” by Elliotte Rusty Harold & W. Scott Means World Wide Web Consortium (W3C) -- http://www.w3.org Part 1. XML Basics In this section, we will introduce some basic knowledge on XML with the use of Notepad, Internet Explorer. A. Create your first XML file 1. Click on START and point to PROGRAMS, then point to Accessories and select Notepad*. 2. In the Notepad type the following codes: 3. Click on FILE in the menu bar and select Save As: 4. In the Save As dialog box select c:\user\demo as the Save In directory. 5. Type hello.xml in the File name box. • Microsoft FrontPage also provides an XML editor, which can verify whether an XML document is well-formed or not, but cannot validate the document with its DTD or XML <?xml version=”1.0” standalone=”yes” ?> <woo>Hello XML </woo>
19
Embed
Introduction to XMLect7010/Materials/Lecture/XML... · 2006-11-06 · Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies 1 Introduction to XML Objectives: This
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies
1
Introduction to XML Objectives:
This module covers basic knowledge about XML, and its supporting technologies such as DTD, XML
Schema, CSS, and XSL. Also, it covers an introduction to an XML editor, Stylus Studio(eXcelon Corp.)
(Remark: Only Internet Explorer 5.0 or above supports XML.)
References:
� “XML in a Nutshell” by Elliotte Rusty Harold & W. Scott Means
� World Wide Web Consortium (W3C) -- http://www.w3.org
Part 1. XML Basics In this section, we will introduce some basic knowledge on XML with the use of Notepad , Internet
Explorer.
A. Create your first XML file
1. Click on START and point to PROGRAMS, then point to Accessories and select
Notepad* .
2. In the Notepad
type the following
codes:
3. Click on FILE in the menu bar and select Save As :
4. In the Save As dialog box select c:\user\demo as the Save In directory.
5. Type hello.xml in the File name box.
• Microsoft FrontPage also provides an XML editor, which can verify whether an XML
document is well-formed or not, but cannot validate the document with its DTD or XML
<?xml version=”1.0” standalone=”yes” ?> <woo>Hello XML </woo>
Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies
2
schema.
B. View your first XML file using a browser
1. Double click the Internet Explorer icon in the Desktop .
In the Address box type c:\user\demo\hello.xml
C. Use different tags
1. Switch to Notepad and change the codes that you have typed to the following
<?xml version=”1.0” standalone=”yes” ?> <Greeting>Hello XML </Greeting>
Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies
3
2. Click on File and
select Save
3. Switch to IE and
press the Refresh
button
You will see:
XML allows you to
create any tag you want. You can change the tag and repeat the steps again and again.
D. Start and End tags of XML
1. Switch to Notepad
2. Change the code
of the file hello.xml
to:
3. Click File and
select Save
4. Switch to IE and press Refresh again and you will see a warning.
If using the XML Editor in FrongPage:
<?xml version=”1.0” standalone=”yes” ?> <Greeting>Hello XML </Greet>
Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies
4
In each XML document should has a pair of Start Tag and End Tag . Start Tag should
match with End Tag .
E. Case Sensitivity of Start and End Tags
1. Switch to the Notepad
2. Change the codes to the following
3. Click on File and
select Save
4. Switch to IE and
press the
Refresh button
You will see a
warning
In each XML
document, Start Tags and
End Tags are
case-sensitive.
F. Comments in XML
1. Switch to the Notepad
2. Add the following codes into the XML file
You will see a page like this.
For Internet Explorer 5.0:
Comment should not come
before. The declaration must be
the very first thing in the XML
document.
<?xml version=”1.0” standalone=”yes” ?> <Greeting>Hello XML </greeting>
<?xml version=”1.0” standalone=”yes” ?> <!-- This is an XML Greeting --> <Greeting>Hello XML </Greeting>
Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies
5
G. Insert Empty Element
1. Switch to Notepad
2. Click on File and select New to open a new document
3. Type the following code in the
Notepad
4. Click on File and select Save
5. In the Save As dialog select
c:\user\demo as the Save in
directory.
6. Type xml2.xml in the File
name box and press
Save
7. Switch to IE, type
c:\user\demo\xml2.xml in
the Address box and
press Enter
H. Tree Structure of XML
1. Switch to the Notepad
2. Change the code of
xml2.xml to the following
3. Click File and select
Save
4. Switch to IE and press
the Refresh button
You will see the following
warning:
In XML only one
top-level element is allowed.
There must be only one root
element in a XML document.
<?xml version=”1.0” standalone=”yes” ?> <root> <full>This is not an element</full> <empty/> </root>
<?xml version=”1.0” standalone=”yes” ?> <root>This is root </root> <full>This is an element</full> <empty/>
An empty element
Introduction to XML ECT7010 – Fundamentals of E-Commerce Technologies