Xml
var xmlfile=new activexobject ("Microsoft.XMLDOM");
Xmlfile.load ("2.xml");
var xslfile=new activexobject ("Microsoft.XMLDOM");
Xslfile.load ("first.xsl");
Document.All.Item ("Dom application"). Innerhtml=xmlfile.transformnode (xslfile.documentelement);
〈/script〉
〈/head〉
〈body〉
〈div id= "Dom Application" 〉〈/div〉
〈/body〉
〈/heml〉
Namespaces
Consider that when we build XML applications, we create specific DTDs for specific industry applications that specify the elements that are available. Sometimes the following situation occurs-two elements with the same name may have different meanings in different places. For example, we define 〈title〉 this tag, in the bookstore application, the character meaning of this tag is the name of the book, and in the Personnel department, the character meaning in this tag is a person's title, title. If we write an XML file that contains information such as the title, author, and identity of the author, the same 〈title〉 mark will be used in the title and author's identity two places, but they have different meanings, and the computer program cannot tell which is the title and which is the author's identity. This brings us to the problem of automated processing, which is namespaces to solve. The concept of namespaces is very straightforward--for each set of specific application DTDs, give it a unique flag to represent, if you use the elements defined in the DTD in the XML file, you need to use the DTD's flags and element names and attributes, which is the equivalent of indicating where the element comes from, This will not be confused with other elements of the same name (like our phone number, two cities may have the same number, but we have in front of the area code to limit it, a local area code in a country is unique). In XML, a ready-made, globally unique "domain name" is used as the namespaces, that is, the URL is used as the namespaces of XML. When we first learned about XSL, we actually came in contact with a "xsl:" in front of the tag name in the Namespaces,xsl file, which is actually the namespaces of the elements in the XSL. The declaration statement is: 〈xsl:stylesheet xmlns:xsl= "Http://www.w3.org.TR.WD-xsl", the Xmlns:xsl= "...". Where the XSL in the Declaration is called the predecessor string, and the preceding string is added to the file when referencing the element, such as: 〈xsl:templed〉.
Cases:
〈?xml version= "1.0" encoding= "GB2312"?
〈c: Customer list xmlns:c= "Http://www.aaa.com/custom.dtd"
xmlns: worker = "http://www.aaa.com/employee.dtd〉
〈c: Customer
〈c: Name John 〈/C: Name
〈C: Telephone 〉028-6666666〈/Telephone
〈c: Reception Person
Employee: Name Dick 〈/Employee: Name
Staff: Telephone 〉5555555〈/staff: Telephone
〈/C: Reception Person
〈/C: Customer
.......
This example defines two namespaces--c in front: and workers:. When you apply an element, a specific namespaces is added to the front. Then the application will be able to tell which is the customer's name and telephone number, and which one is the name of the employee, and the telephone number, when reading the same element, such as "name" and "Telephone".
With namespaces, we can also use HTML tags directly in XML files without using XLink or xpionter, and make XML files have hyperlinks and display pictures. Before you use an HTML tag, you must declare its namespaces. The following example is a mixed use of XML and HTML.
Cases:
〈?xml version= "1.0" encoding= "GB2312"?
〈?xml-stylesheet href= "First.css" type= "Text/css"?
〈data xmlns:html= "Http://www.w3.org/TR/XHTM1"
〈book〉
〈title〉xml Introductory Fine Solution 〈/title〉
〈html:a href= "Mailto:lionliao@yeah.net"
〈author〉 Author: John 〈/author〉
〈/html:a〉
〈picture〉
〈html:img src= "zhangsan.jpg" width= "80" height=
〈/picture〉
〈price unit= "RMB" Price: $20.00〈/price〉
〈content〉
〈html:a href= "http://www.cbi.com" Click to view the main content 〈/html:a〉
〈/content〉
〈/book〉
〈/data〉
Note: When using HTML in XML, you must strictly follow the syntax of the XML, and the elements should be properly closed.
This XML file can be displayed through CSS or XSL, as shown in Figure 1.
XHTML
XHTML is first called HTML in XML, which is to redefine XML in the past with SGML defined (don't forget that XML is a language for defining languages). In fact, the tags in xhtml are basically the ones in HTML 4.0, and the usage of the various tags and attributes is essentially the same. Just because it is defined through XML, you must strictly follow the rules of XML, not as casually as in the past. So why should we develop XHTML?
Now, mobile Internet, information appliances, such as speculation in full swing, as if anything should be connected to the Internet. XHTML is the kind of trend that comes with it. As you know, the HTML is becoming more and more complex, and there are a lot of nonstandard HTML pages (not able to be in IE, Netscape correctly displayed even the canonical pages), and browsers in order to be able to adapt to this situation, inclusive of a large number of HTML Web pages, has become very bloated (which is why, although your HTML syntax is wrong, sometimes it can be correctly displayed, the designer of the design explorer racked his brains to adapt and tolerate errors). For PCs, this is nothing, because PC performance has been greatly improved, and for those palm devices, information appliances, can not have so much storage space available. XML standard is simple but very strict, the main purpose is to reduce the parser, browser development burden and the volume of these software. The general XML parser is hundreds of KB in size. XHTML, as defined by the XML standard, certainly inherits the attributes of XML, while preserving the superiority of HTML in its presentation, discarding the "dirty" code in HTML and providing good scalability, which can be large and small.
XHTML divides the past HTML functionality into modules based on the needs of the user and the capabilities of the browser, with each set of modules supporting only some HTML tags. The parser and browser developed for a particular module are obviously much smaller than the all-inclusive parser and browser size. This achieves the goal of "small". For example: the handheld screen itself is very small, it is obvious that when browsing the Web page does not need to use the "frame" function in HTML, then for this device, there is a special set of it applicable, does not contain "frame" tag. Of course, each module needs to have their own DTD to declare which tags can be used. Now the consortium has defined several specialized DTDs.
"Can be Big"? is actually taking advantage of the characteristics of XML, what is XML? Extensible Markup Language Yes! Previously, tags in HTML had been defined, could not be changed, only used, and XHTML could customize markup like XML.
Using XHTML is basically the same as using HTML, but be aware that we can't afford to be lazy any more. XHTML, like XML, must first be well-formed. The rules are as follows:
1. Mark must be completed correctly.
2. Cross nesting is not allowed between tags and tags. Like the previous "〈i〉 italic 〈b〉 Bold Italic 〈/i〉〈/b〉" Such statements are not possible, but must be written as "〈i〉 italic 〈b〉 Bold Italic 〈/b〉〈/i〉" to qualify.
3. Empty elements (no content between the start and end tags) must be written in the terms of the XML as an element name/〉.
4. The attribute value must be enclosed with the "" number, as the previous "〈TD width=100〉" statement must be rewritten as "〈TD width=" 100 ".
5. Properties are assigned values. A previously marked property, if not assigned, takes a default value, and in XHTML, it must be explicitly assigned a value.
6. Tag names, property names are in lowercase letters.
7. Use the correct root element plus namespaces.
8.〈head〉〈body〉 can not be omitted. The 〈title〉 must be the first child element that appears in the 〈head〉.
9. The VBScript, JavaScript, and stylesheet areas of the original HTML Web page must be packaged like the CDATA area of XML, such as:
〈script language= "JavaScript"
〈! [cdata[
......
if (i〈3 &&&& ...)
]]〉
〈/script〉
Satisfying the above criteria does not mean that XHTML is the best, but only well-formed XHTML files that need to refer to the DTD correctly to become truly correct XHTML. The consortium has defined three XHTML DTDs for everyone to use, namely strict, transitional, Frameset. From now on, you need to write HTML pages in accordance with the requirements of XHTML, and it is best not to use the tags such as font, as far as possible using CSS to express your HTML page. By the time XHTML and XML become popular, you'll be laughing, because it's very easy for you to implement Web conversion.
This series of lectures introduces the syntax, structure, and some related techniques of XML. Not knowing this, you can use XML. There are also a lot of discussions about the specific development of XML, such as: XML for e-business, XML for document management, XML for data-driven applications, and so on. We learn XML, the key is to use it in future development, understand the basic knowledge of XML, will play an important role in the application development.