Currently, the content data of many Web sites are stored in databases or data files. For Web program developers, if they want to extract useful information from the database, the traditional method is to write scripts on the server side (such as VBScript, javaScript, CGI, asp, Perl, etc.) and execute the database The SQL query obtains relevant records, and then organizes the query results into HTML pages and returns them to the client. The user uses the browser to observe the final results.
In order to improve the flexibility and scalability of system services and enable a wider range of service targets, many commercial websites try their best to provide business rules, original data and presentation forms as independent services. HTML's way of embedding data in display obviously does not meet this need. Therefore, storing original data in XML documents and using style sheets to display content are the advantages of XML technology suitable for e-commerce. But in essence, XSL technology is not oriented to data display. It is a format conversion technology that is far less rich than HTML in terms of display means and methods. For programmers, a more ideal solution is to combine the two technologies of HTML and XML to complement each other's advantages, so that the real original data can maintain its original meaning and structure while making full use of the ever-changing display of HTML. Skill. XML Data Island is the product of this technology fusion. It uses the
How to handle data islands in IE
In order to be able to handle this kind of HTML page with embedded XML code, Internet Explorer 4.0 (hereinafter referred to as IE 4.0) introduced DSO (Data Source Objects, data source objects) Technology, implemented using Java Applet.
For example:
<APPLET CODE=“com.ms.xml.dso.XMLDSO.class” ID=“xmldso” WIDTH=0 HEIGHT=0 MAYSCRIPT=TRUE> <PARAM NAME=“URL” VALUE=“myXML.xml”> </APPLET>
In the above example, the CODE attribute specifies the DSO Java applet, the MAYSCRIPT attribute ensures that the user-side script can process the data object, and the PARAM tag specifies the location of the XML document.
The limitation of using Java is that it can only describe the URL address of XML in the HTML document, but cannot directly embed the XML tag into it. This is still far behind the real data island solution. Microsoft has expanded DSO technology in Internet Explorer 5.0 (hereinafter referred to as IE 5.0), breaking through previous limitations and truly integrating HTML and XML. HTML pages support direct use of
For example:
<HTML> <XML ID=“xmldso”> <?xml version=“1.0”?> some XML…… </XML>
As long as the ID of each data island is unique, you can embed data islands wherever necessary in the page, and these DSOs are independent of each other.
In addition to the direct embedding method in the above example, you can also use external references to link data islands.
For example:
<XML ID=“xmldso” SRC=“myXML.xml”> </XML>
In this way, only when the company's customer objects continue to use IE 4.0, and in order to solve the compatibility problems of these customers, Java Applet is what programmers need. Options to consider.
In the DSO technology implemented by IE 5.0, if the data is the result of querying the database through SQL language, then they are stored in the ADO (ActiveX Data Objects) record set. The server sends this ActiveX control (usually an ADO recordset) to the client, where the client script program performs further processing. In fact, IE 5.0 handles XML data islands as a special ADO record set.
XML data binding
1. ADO recordset mapping
Every main element in XML is mapped to a record in the ADO recordset, and the sub-elements are correspondingly mapped to fields in the recordset (also called domains).
For example, the XML data island books.xml exists as follows:
<XML ID=“xmldso”> <?xml version=“1.0”?> <booklist> <book> <title>Straight Talk About Computers</title> <isbn>72-80088-005</isbn> </book> <book> <title> Gourmet Microwave </title> <isbn>72-80081-082</isbn> </book> </booklist> </XML>
At this time, the mapped ADO record set is:
title isbn
Straight Talk About Computers 72-80088-005
Gourmet Microwave 72-80081-082
2. Binding to HTML elements
After embedding the data island in the HTML document, you can bind the XML data island to the HTML element. Each DSO entry (ie, data island) has a unique ID number. First, set the DATASRC attribute in the HTML element to the corresponding ID to associate the HTML element with the data island. Then determine the extracted XML element by setting the DATAFLD attribute value.
For example, the code bound to the p element is as follows:
<p ID=title DATASRC=#xmldso DATAFLD=“title”></p> <p ID=PRice DATASRC=#xmldso DATAFLD=“isbn”></p>
Note: Not all HTML elements can be bound to XML data islands. Currently, the elements that support this DSO binding mechanism are as follows:
A, APPLET, BUTTON, p, FRAME, IFRAME, IMG, INPUT (the types here are: CHECKBOX, HIDDEN, LABEL, PASSWord, RADIO and TEXT), LABEL, MARQUEE, SELECT, SPAN, TABLE and TEXTAREA.
3. Explicit XML data in tabular format
If XML data is bound to the TABLE element, it can be automatically displayed in a multi-row tabular format.
For example, the code for binding XML data to TABLE elements is as follows:
<TABLE BORDER=1 DATASRC=“#xmldso”> <THEAD> <TR><TH>Title</TH> <TH>ISBN</TH></TR> </THEAD> <TBODY> <TR><TD><p DATAFLD=“title”></p></TD> <TD><p DATAFLD=“isbn”> </p></TD></TR> </TBODY> 1 </TABLE>
这样,通过将TABLE元素中的DATASRC属性设定为#xmldso,把两者绑定起来。表格内部分为表头(THEAD)和表体(TBODY)两部分。每一个
The above is the detailed content of Complementary advantages between HTML and XML (Part 1). For more information, please follow other related articles on the PHP Chinese website!

Self-closingtagsinHTMLandXMLaretagsthatclosethemselveswithoutneedingaseparateclosingtag,simplifyingmarkupstructureandenhancingcodingefficiency.1)TheyareessentialinXMLforelementswithoutcontent,ensuringwell-formeddocuments.2)InHTML5,usageisflexiblebutr

To build a website with powerful functions and good user experience, HTML alone is not enough. The following technology is also required: JavaScript gives web page dynamic and interactiveness, and real-time changes are achieved by operating DOM. CSS is responsible for the style and layout of the web page to improve aesthetics and user experience. Modern frameworks and libraries such as React, Vue.js and Angular improve development efficiency and code organization structure.

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
