XML preference series (3)

Source: Internet
Author: User
Tags processing instruction xsl file
Series 7: XMLDOMXML file object model in the previous article, the XML interpreter can be used to program a file to be loaded into an XML file. after this document is loaded, we can use XMLDMO to obtain and control the information of all documents. you can Series 7: XML DOM

XML Document Object Model
In the previous article, the XML interpreter can use programming methods.
To load an XML document. when this document is loaded,
We can use xml dmo to obtain and control information of all documents.
You can visit the ChildNodes attribute. this is an import of all nodes in your document.
This node interface is used to read and write a single node in the tree structure of the XML document.
The Microsoft XML interpreter currently supports 13 types of nodes.
The list below lists the most common node types.

Node type example
Document type
Processing instruction
Element Carlsberg
Attribute type = 'beer'
Text Carlsberg

DOM applications display XML documents in three ways.
DocumentElement is the highest level of the XML document tree.
Elements with childNodes or more child nodes.
It is also used to move the tree structure, visit nodes and their attribute values, insert or delete nodes
And the function that converts the tree structure into XML.
All Microsoft XML annotator functions demonstrated here
They are all recommended by the W3C xml dom specification, except the loadXML function.
Whether you trust it or not: the official DOM does not contain a scale function for loading XML documents.
(The translator understands that: there is no formal function, as long as the xml file is given, it can display all
Tree structure, but must all be carried in the process, and then programmed to display the meaning of this tree structure)

Browse node tree
The following code browses all node trees,
And display the results in the browser:
Set xmlDoc = CreateObject ('Microsoft. XMLDOM ')
XmlDoc. async = 'false'
XmlDoc. load ('XML _ note. XML ')
For each x in xmlDoc.doc umentElement. childNodes
Document. write (x. nodename)
Document. write (':')
Document. write (x. text)
Next

Translation: Batman
Series 8: XSL-The Style Sheet Language of XML)

HTML page application tags (tags) are used to display data, and all tags are well understood.
For example

Is a presentation section, presentation title, and a browser
You also know how to display these tags on the page.
In XML, we apply custom tags.
The browser cannot understand. for example, a tag in XML























Zacx corp
ZCXM
28.875


Zaffymat inc
ZFFX
92.250












Can be understood as a table tag in HTMLBut it can also be understood as a kind of wooden furniture.Therefore, an XML document must be displayed.Describes how these documents are displayed.This mechanism is XSL (eXtensible Stylesheet Language)It is the style table description language of XML.The history of XSL is longer than that of CSS used in HTML (Cascading Style Sheet.XSL contains two parts:A method used to convert XML documentsA method for structuring XML documentsIf you cannot understand it, you can convert XSL into a language that can convert XML into HTML.A language that can filter and sort data in XML documents,A language that visualizes XML data based on XML data values (for example, displaying negative numbers in red ).Convert XML documentsSuppose you want to convert the following XML document (open IE5) to HTML:The file is portfolio. xml. Remember the Consequence 1.Then you can try the following XSL document (open in IE 5)It is a template that converts your XML data into HTML documents that can be read by everyone.The file is portfolio. xsl.













Symbol Name Price





In the above file, The element locates the element in the XML document and reapplies each element in the template.
Because XSL itself is also an XML file, the beginning of this file is also
The famous application of XML, Element defines this document
Is a style sheet,
You must have a coat. It corresponds
The.
Remember the second consequence.

Now you reference this xsl file in the second line of the XML document in your source file.
Then your xml file will be converted to HTML (open this file in IE5 ):
The file is portfolio. xml.




Zacx corp
ZCXM
28.875


Zaffymat inc
ZFFX
92.250



A cross-browser solution:
After you use XSL to convert an XML document to HTML,
Didn't you really think that you have already achieved that various browsers can browse your data?
Is the solution planned?
This solution plan is so simple:
You only need to convert XML into HTML on your SERVER and
HTML document passed to BROWSER.
This is the beauty of XSL, which enables the transformation of the data pattern from one pattern
Another pattern, and returns readable data to all browsers

Series 9: XML Behaviors-new DHTML?

Behaviors-what is this?
Behavior is a new CSS selection attribute.
A behavior can be directed to a single
Files that contain code (can fulfill XML or elements in HTML pages)

Do you understand? Is it a way to completely remove the script code in HTML?
It seems like this!
Now we can write our own script library and apply these script libraries to us.
Any element.

How does it work?
Let the example clarify the title:
The following is an HTML file:






Hello World



This HTML file has

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.