Outline: 1: Example Effect 2: Instance Analysis 1. Define the new identity. 2. Establish an XML document. 3. Establish a corresponding HTML file. XML has a wide range of applications in different fields, such as Mathml, wireless communication applications in technology, SVG in network images, etc., we focus on the application of XML on the Web. The application of XML on the web is mainly used with its powerful data operation capabilities. Generally use server-side program such as JavaScript and ASP to implement almost all applications on the network. Consider explaining convenience, we will introduce a simple example below and does not include server-side programs. The purpose is to let you have a sensibility to XML's data operation capacity. Ok, we first [click here] to see the effects of the instance. (Please open with IE5.0 or later) This is a simple CD record data search function. You can see the information about the single CD by clicking "Previous", "Next". Such an effects can be implemented in two ways: 1. Take DHTML, hide data in different layers, sequentially displayed by mouse events; 2. Use background programs (such as ASP, CGI, PHP, JSP, etc.), call Server data. But in this example, we open the page original code, where there is no DIV of DHTML, there is no form of action, which is fully implemented with XML. Let's analyze its production process: Step 1: Define new logos. According to the actual CD data, first create an identifier named
Program code: [Copy code to clipboard]
This code indicates that the element Catalog contains multiple CD child elements, while the child element CD contains Title, Artist, Year, Country, Company, Price six sub-elements, and their content is defined as text (character, number, text) . (Note: The specific grammatical description can look at the introduction of DTD) Step 2: Establish an XML document.
Program code: [Copy code to clipboard]
XML Version = "1.0"?>
Program code: [Copy code to clipboard]
5 sets of data were defined. We will save the above code as a CD.xml file for an order. Step 3: Establish a corresponding HTML file. 1. Import XML data. We know that in the current popular browser, we temporarily only have Microsoft IE5.0 or higher browser support XML. IE is imported into the Object object in HTML and is imported into the XML and through the XMLDocument.Load () method of JS. We look at the code:
Program code: [Copy code to clipboard]
Program code: [Copy code to clipboard]