XML Session08.pps
XML Session08.pps
Objectives
MSXML parser:
Is the Microsoft implementation of DOM.
Provides fundamental as well as added interfaces to access
documents.
The following figure represents how a DOM tree is used by
applications to access data.
MSXML Library
DOM:
Used to validate XML documents against XML schemas.
Ensures proper grammar and proper formation of the XML
document.
DOMDocument object:
Main object in a DOM.
Represents the top node in every document tree.
Used to load an XML document, parse it, and validate it.
XMLSchemaCache object:
Loads the schema document associated with the XML
document.
Problem Statement:
The head office of CyberShoppe receives data in the form of
XML documents from its branches. In order to ensure the
consistency of data sent by the branches, the head office
maintains the definitions for the structures of documents in
schemas. After receiving data from the branches, the head
office needs to verify that the data conforms to the schema of
the respective document. For this, the head office needs to
write a script that validates the data stored in an XML
document against a schema. You will initially do the testing for
the product.xml file.
Problem Statement:
CyberShoppe sells its products through an e-commerce Web
site. Product details, such as product name, description, price,
and quantity, need to be displayed.
A customer can choose to view the product details either as a
table or as a bulleted list.
Problem Statement:
The following XML document, customer.xml contains
customer details:
<?xml version="1.0"?>
<CUSTOMER>
<CUSTOMERNAME>Harold Johnson</CUSTOMERNAME>
<ADDRESS>56, Regent Road</ADDRESS>
<CITY>London</CITY>
<COUNTRY>UK</COUNTRY>
<PHONE>444-425-2355</PHONE>
</CUSTOMER>
Create a Web page that accepts the name of the XML file in a
text box. When you click the Submit hyperlink, a JavaScript
code should load the XML document and extract the
CUSTOMERNAME element. The address and phone number
should be changed to 94, McFarlane Avenue and 412-233-
2344, respectively, by using XML DOM objects.
Answer:
c. createNode()
Answer:
a. async
Answer:
d. nodeValue
Answer:
a. srcText
Answer:
b. DOMDocument