XML Getting Started Introduction

xiaoxiao2021-03-06  15

XML Getting Started Introduction

-------------------------------------------------- ------------------------------

XML can be used to describe data, the focus is' data.

HTML is used to display data, the focus is 'how to display data'.

-------------------------------------------------- ------------------------------

The knowledge you should already know before learning XML, you should have some basic knowledge before you continue:

Www, html, and design web page basic knowledge web script language, such as JavaScript or VBScript, you'd better understand the above before learning XML, because these knowledge will be used during XML learning.

-------------------------------------------------- ------------------------------

What is XML? XML is an abbreviation XML of Extensible Markup Language is a tag language XML similar to HTML is used to describe the xml tag of the data is not predefined in XML. You must define your own tag XML Use document type definition (DTD) or schema (Schema) to describe the language of the data XML using DTD or Schema

-------------------------------------------------- ------------------------------

The main difference between XML and HTML is what XML is used to store data.

XML is not an alternative to HTML, XML and HTML are two different languages.

XML is designed to describe data, the focus is: What is data, how to store data. HTML is designed to display data, the focus is: display data and how to display data better.

HTML is related to display information, XML is related to the description information.

-------------------------------------------------- ------------------------------

XML does not do XML and not doing anything.

Maybe it seems difficult to understand, but in fact, XML does not do anything. XML is only used to organize, store, and send information.

The following example is the notem of the ORDM to the Lin, use XML format:

lin ordm reminder don't forget me this weekend!

This note has information heads, and the information main body, and also includes senders and recipients. Despite this, this XML document still does not do anything, he is just using the XML to mark the file file. Some people have written out software that sends and receive and display this format information.

-------------------------------------------------- ------------------------------

XML is free, and the XML tag that can be extended is not pre-specified, you must create your own tag.

You must use the rules in the HTML documentation. For example,:


, etc.

XML allows you to define your own tag and document structure.

For example, "", "" tag in the above example is not predefined in the XML specification. These markers are the author of the XML document "creation". -------------------------------------------------- ------------------------------

XML is HTML supplement XML is not an alternative to HTML.

XML is not an alternative to HTML, which is very important to understand this. In future web development, XML will be used to describe, store data, and HTML is used to format and display data.

The best description for XML may be: XML is a tool cross-platform, unrelated to soft, hardware, processing information.

-------------------------------------------------- ------------------------------

XML in future web development XML is everywhere

XML development is very rapid, which is really surprised, and there are a lot of software developers use XML standards.

We believe that in future web development, XML will pay attention to HTML, and they are the foundation of Web technology. XML will become the most common tools for data manipulation and data transmission.

-------------------------------------------------- ------------------------------

XML joke Q: When should I use XML?

A: You can write you XML in your personal resume.

How to use XML? -------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------

The first thing to be clear is that XML is designed to store data, carry data, and exchange data, and he is not designed to display data.

-------------------------------------------------- ------------------------------

XML can separate data from HTML through XML, you can store data outside the HTML file.

When not using XML, HTML is used to display data, and the data must be stored within the HTML file; XML, the data can be stored in the separate XML document. This approach allows you to concentrate to use HTML to make data display and layout, and ensure that the HTML file will also be changed when data changes will also be changed. This makes it easy to maintain the page.

XML data can also be stored in the HTML page in the form of "data island". You can still concentrate to format and display data using HTML.

-------------------------------------------------- ------------------------------

XML is used to exchange data via XML, we can exchange data between incompatible systems.

In real life, the data stored in computer systems and database systems has N ^ n forms. For developers, the most time consuming is to exchange data between systems throughout the network.

Conversion of data to XML format storage will greatly reduce exchange data is complex, and can also be read by different programs.

-------------------------------------------------- ------------------------------

XML and B2B use XML to exchange financial information in the network.

In the near future, we can expect many applications for XML and B2B (Business to Business).

XML is becoming the main language used by the exchange of financial information between the commercial systems of the network. Many complete XML-based applications related to B2B are under development.

-------------------------------------------------- ---------------------------- XML ​​can be used to share data through XML, and the plain text file can be used to share data.

Since XML data is stored in a plain text format, XML provides a shared data method that is unrelated to software and hardware.

This creates a data file that can be read by different applications. Similarly, our provincial operating system, upgrade server, upgrade application, updating browser is much easier.

-------------------------------------------------- ------------------------------

XML can be used to store data using XML, and the plain text file can be used to store data.

A large amount of data can be stored in an XML file or in a database. The application can read and write data, and the general program can display data.

-------------------------------------------------- ------------------------------

XML can make full use of data using XML, your data can be used by more users.

Since XML is independent of software, hardware, and applications, you can make your data can be used in more users, more devices, not just HTML standard browsers.

Other clients and applications can process your XML documents as data sources, just like they treat the database, your data can be handled by a variety of "readers", at this time, for some people It is very convenient, such as blind or disabled.

-------------------------------------------------- ------------------------------

XML can be used to create a new language XML is a mother of WAP and WML languages.

Wireless Markup Language (WML, THE WIRELESS MARKUP LANGUAGE) is used to identify Internet programs running on hand-held devices (such as: mobile phones).

WML uses XML standards. You can learn more in the WML guide.

-------------------------------------------------- ------------------------------

Looking ahead If developers have sufficient foresight, then future applications should be stored in the form of XML.

The word processor, spreadsheet software, and database we use will be able to read data in plain text, without the need to transform the process.

We can only look forward to Microsoft and other software developers agree with this. // In fact Microsoft is vigorously developing XML applications.

XML syntax ------------------------------------------------ --------------------------------

XML's grammar rules are simple and strict, very easy to learn and use.

Because of this, software written and operates XML is also relatively easy.

-------------------------------------------------- ------------------------------

An example of an XML document XML document uses the self-description and simple syntax.

lin ordm reminder don 't forget me this weekend!

Documentation Line 1: XML Declaration - Defines the version of the XML standard following this document, in this example is the standard of version 1.0, use ISO-8859-1 (Latin-1 / West European "character set. The second line of the document is the root element (like this document is a note "):

Documentation 3-6 describes four child nodes of the root element (to, from, heading, and body):

lin ordm reminder don't forget me this weekend!

The last line of the document is the end of the root element:

Can you see this document? Is this a note for LIN? Can you recognize that XML is a beautiful self-description language?

-------------------------------------------------- ------------------------------

All XML documents must have an end tag in the XML document, ignore the end tag is not compliant.

In the HTML document, some elements can be no end tags. The following code is completely legal in HTML:

this is a paragraph

this is another paragraph

But in the XML document, there must be an end tag, like the following example:

this is a paragraph

this is another paragraph

Note: You may have noticed that the first line in the above example does not end the mark. This is not an error. Because the XML declaration is not part of the XML document, he is not an XML element, and there should not be an end tag.

-------------------------------------------------- ------------------------------

XML tags are sensitive. This is different from HTML, and XML tag is sensitive.

In XML, tag and tag is two different tags.

Therefore, the case where the labeling and end tags starting in the XML document must remain consistent.

this is incorrect // Error this is concerning // correct

-------------------------------------------------- ------------------------------

All XML elements must be reasonably included in the XML that is not allowed to be incorrectly included.

In HTML, there are some incorrect included, such as the following code can be parsed by browser:

this text is bold and italic

All elements in XML must be correctly nested, the above code should be written:

this text is bold and italic

-------------------------------------------------- ------------------------------

All XML documents must have an root element XML document is the root element. All XML documents must contain a separate tag to define that all other elements must be nest in the root element. The XML document has only one root element.

All elements can have sub-elements, the child element must be correctly nested in the parent element, the following code can be imaged:

.....

-------------------------------------------------- ------------------------------

The attribute value must use quotation marks "" In XML, the attribute value of the element is not in line with the quotation mark.

Like HTML, XML elements can also have attributes. The properties of the XML element are in the appearance of name / value. XML syntax specification requires XML element attribute values ​​to be drawn by quotation marks. Please see the two examples below, the first is wrong, the second is correct.

lin Ordm Reminder < / Heading> don't doget me this weekend!

-------------------------------------------------- ------------------------------

With XML, blank will be retained in an XML document, and the blank portion will not be automatically removed by the parser.

This is different from HTML. In HTML, such a sentence:

"Hello My Name Is ORDM" will be displayed: "Hello My Name is Ordm",

Because the HTML parser automatically removes the blank parts in the sentence.

-------------------------------------------------- ------------------------------

Using XML, Cr / LF is converted to LF using XML, and the new row is always identified as LF (Line Feed, wrap).

Do you know what the typewriter is it? Oh, the typewriter is a special typing machine used in the last century. ^ & ^

When you use a type of type, you usually have to move the word head to the left side of the paper.

In a Windows application, new lines in text are usually identified as Cr Lf (Carriage Return, Line Feed, Enter, Return). In UNIX applications, the new line is usually identified as LF. There are also applications to use CR to represent a new line. -------------------------------------------------- ------------------------------

Note in XML is basically the same as the syntax in XML.

-------------------------------------------------- ------------------------------

XML is nothing special, XML does not have any special place. He is just some ordinary plain text with a sharp bracket.

Editing a common text can also edit an XML document.

However, in a support for XML, XML tags often correspond to special operations, and some markers may be visible, and some markers may not be displayed without any special operations.

XML elements ------------------------------------------------ --------------------------------

The XML element is scalable, and there is associated between them.

XML elements have a simple naming rule.

-------------------------------------------------- ------------------------------

The XML element is an extended XML document that can be extended while carrying more information.

Please see the XML notebook below:

lin ordm don't forget me this weekend!

Let's imagine software that can read this XML document and can interpret the software of the XML element (, , and ), which may be as follows:

Message to: linfrom: Ordm

Don't forget me this weekend!

Let's envision, if the author of the note is added to this XML document, as shown below:

2002-12-24 lin ORDM reminder don't forget me this weekend!

So is the original application interrupt or collapse?

will not. The application will still interpret the , , and and other elements, and generate the same output.

XML documentation can be expanded!

-------------------------------------------------- ------------------------------

The XML element is the relationship between the parent element and the child element between the XML elements.

In order to better understand the XML terminology, you must understand how the relationship between XML elements, and how the elements are described.

Imagine such a book:

Administration: XML Guide

Chapter 1: Introduction to XML Getting Started

What is html What is XML Chapter 2: XML syntax XML elements must have end tag XML elements must be correctly nested

We can use XML documents to describe this book:

XML guide </ title> <prod ID = "33-657" Media = "paper"> </ prod> <chapter> XML Getting Started <PARA> What is HTML </ Para> <Para> What is XML </ Para> </ Chapter> <Chapter> XML Syntax <Para> XML element must have end tag </ para> <para> XML element must be correctly nested </ para> </ chapter> </ book ></p> <p>In the above code, the BOOK element is the root element of the XML document, the title element and the Chapter element are the child elements of the BOOK element. Book elements are the parent element of the Title element and the chapter element. Title elements, PROD elements and chapter elements are flat-level elements because they have the same parent element.</p> <p>-------------------------------------------------- ------------------------------</p> <p>The content XML element of the XML element has different content.</p> <p>The XML element refers to this part of the content between the beginning of the end marker from the beginning of the element.</p> <p>XML elements have element content, mixed content, simple content or empty content. Each element can have its own properties.</p> <p>In the above example, the BOOK element has an element content, and the BOOK element should contain other elements. The Chapter element has a mixed content because it contains text and other elements. The PARA element has a simple content because there is only a simple text. The PROD element is empty because he does not carry any information.</p> <p>In the above example, only the PROD element has attributes, the id attribute value is 33-657, and the MedIA property value is Paper.</p> <p>-------------------------------------------------- ------------------------------</p> <p>XML element name XML element naming must abide by the following rules:</p> <p>The name of the element can contain a child, numbers, and other characters. The name of the element cannot be started with a number or punctuation. The name of the element cannot be started at XML (or XML, XML, XML ...). The name of the element cannot contain spaces. The XML element of "invent" must also pay attention to some simple rules:</p> <p>Any name can be used, no reserved word (except XML), but should make the name of the element be readable, the name is useful to use the underscore is a nice choice.</p> <p>For example: <first_name>, <last_name>.</p> <p>Try to avoid using "-", "." Because it is possible to cause confusion.</p> <p>As long as you like the name of the elements can be very long, don't be too exaggerated. Naming should follow the principle of simple and easy-to-read, for example: <book_title> is a good name, and <the_title_of_the_book> looks like it.</p> <p>XML documents often correspond to the data sheet, we should try to make the name of the field in the database and the naming in the corresponding XML document, so that it can be easily data transform.</p> <p>Non-English / characters / strings can also be used as the name of the XML element, such as <Blue Ideal> <Classic Forum> This is a completely legal name. But some software can't support this name, so try to use English letters to name.</p> <p>Do not use ":" in the XML element name, because XML namespace needs to be used in this very special character.</p> <p>XML properties -------------------------------------------------- --------------------------------</p> <p>Like HTML, the XML element re-labeled can be by the element properties.</p> <p>Attributes typically contain additional information about elements.</p> <p>-------------------------------------------------- ------------------------------</p> <p>XML attribute XML elements can have properties.</p> <p>You must remember such an HTML code: <img src = "computer.gif">. The SRC is the properties of the IMG element, providing additional information about the IMG element.</p> <p>In HTML (the same in XML) The properties of the elements provide additional information of the elements.</p> <p><img src = "computer.gif"> <a href="demo.asp"></p> <p>The information provided by the letter is usually not part of the data. In the following example, the type and data are not related, but it is quite important to the software that operates this element.</p> <p><file type = "gif"> computer.gif </ file></p> <p>-------------------------------------------------- ------------------------------</p> <p>Quote style "female" or 'female'? The property value must be attached with quotation marks. Single quotes, double quotes can be used. For example, a person's gender, the Person element can write this:</p> <p><Person Sex = "FeMale"></p> <p>You can also write this:</p> <p><pers reside = 'female'></p> <p>The above two ways are in general, and the use of double quotes is more common. However, in some special cases, single quotes must be used, such as the following example:</p> <p><gangster name = 'george "shotgun" ziegler' "-------------------------------------------------------------------- ------------------------------------------</p> <p>Using sub-elements or using attribute data can be stored in child elements or in the property.</p> <p>Please see the example below:</p> <p><Person Sex = "female"> <firstname> Anna </ firstname> <lastname> smith </ lastname> </ person></p> <p><Person> <sex> female </ sex> <firstname> Anna </ firstname> <lastname> smith </ lastname> </ person></p> <p>In the first example, SEX is an attribute, in the second example, SEX is a child element. Both examples provide the same information.</p> <p>When is the property, when do you use child elements, there is no ready-made rule, you can follow. My experience is that attributes may be very convenient in HTML, but in XML, you'd better avoid use.</p> <p>-------------------------------------------------- ------------------------------</p> <p>I like the style I am more willing to store data into child elements.</p> <p>The following three XML documents contain the same information:</p> <p>The first example uses the DATA attribute:</p> <p><Note Date = "12/11/99> <to> Tove </ to> <from> jani </ from> <heading> reminder </ heading> <body> don't doget me this weekend! </ body > </ Note></p> <p>The second example uses the DATA element:</p> <p><Note> <date> 12/11/99 </ date> <to> tove </ to> <from> jani </ from> <heading> reminder </ heading> <body> don't forget me this weekend! </ body> </ Note></p> <p>The third example uses an extended Data element: (this is the style I recommend):</p> <p><Note> <DATE> <day> 12 </ day> <month> 11 </ month> <year> 99 </ year> </ date> <to> Tove </ to> <from> jani </ from> <Heading> Reminder </ Heading> <Body> Don't forget me this weekend! </ body> </ note></p> <p>-------------------------------------------------- ------------------------------</p> <p>Avoid using properties? Should you avoid the use of properties?</p> <p>There are some problems that use attributes here:</p> <p>Attributes cannot contain multiple values ​​(sub-elements). Attributes are not easy to expand. Attributes cannot describe structures (child elements). The attribute is difficult to process the program code. The attribute value is difficult to test by DTD. If you use properties to store data, then the written XML document must be difficult to read and operate. Try to describe the data as much as possible, using only attributes to describe additional information that is not large with data relationships.</p> <p>Don't like the example below (if you do it, you haven't understood the above views).</p> <p><Note Day = "12" MONTH = "11" Year = "99" to = "TOVE" from = "jani" Heading = "Reminder" body = "DON 'THIS Weekend!"> </ Note></p> <p>-------------------------------------------------- ------------------------------</p> <p>The exceptional rules of the attribute rules are always exceptional.</p> <p>There is also an exception about the rules about attributes:</p> <p>Sometimes you should design an ID reference for an element, you can reference the specific XML element, just like the Name and ID attributes in HTML. Please see the example below:</p> <p><Messages> <Note ID = "501"> <to> Tove </ to> <from> jani </ from> <heading> reminder </ heading> <body> don't forget me this weekend! </ body> </ Note> <Note ID = "502"> <to> jani </ to> <from> tove </ from> <heading> Re: reminder </ heading> <body> i will not! </ body> < / Note> </ messages> In the above example, the id attribute is equivalent to a counter, or a unique identifier identifies different note information in the XML document, and he is not part of the note information.</p> <p>What we have to try to explain to the reader: metadata (data related to data) should store attributes, and the data itself should be stored in the form of an element.</p> <p>XML confirmation ---------------------------------------------- --------------------------------</p> <p>The syntax XML document is called a well-structured XML document.</p> <p>The XML document verified by DTD is called a valid XML document.</p> <p>-------------------------------------------------- ------------------------------</p> <p>"Good structure" XML document A good structure of XML documents should use the correct syntax.</p> <p>A well-structured XML document should comply with XML syntax rules, and the example given in the previous chapter is a good structure XML document:</p> <p><? XML Version = "1.0" encoding = "ISO-8859-1"?> <Note> <to> Tove </ to> <from> jani </ from> <heading> reminder </ heading> <body> don 't forget me this weekend! </ body> </ Note></p> <p>-------------------------------------------------- ------------------------------</p> <p>"Effective" XML document A valid XML document should comply with DTD description.</p> <p>An effective XML document is also a well-structured XML document, but also must comply with DTD rules.</p> <p><? XML Version = "1.0" Encoding = "ISO-8859-1"?> <! doctype Note System "InterNalNotE.dtd"> <Note> <to> Tove </ to> <from> jani </ from> < Heading> Reminder </ Heading> <body> Don't forget me this weekend! </ body> </ note></p> <p>-------------------------------------------------- ------------------------------</p> <p>The XML DTD DTD defines the legal elements available in the XML document. The intent of DTD is to define the legitimate building module of the XML document. He determines the internal structure of the XML document by defining a series of legal elements. Good structure XML document is not necessarily an effective XML document, but the effective XML document must be a well-structured XML document. If you want to know more about DTD, you can refer to the DTD guide.</p> <p>-------------------------------------------------- ------------------------------</p> <p>XML Schema XML Schema (XML Mode) is an alternative to XML-based DTD.</p> <p>W3C allows DTD and Schema to replace each other, and readers can learn more in the Schema Guide.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Error What happens in the XML document will cause the XML program to stop.</p> <p>W3C's XML specification statement: If the program finds an effective error in the processing XML document, then this program should be terminated. This is why XML software is easy to write relative to it. All XML documents should be coordinated.</p> <p>In HTML, the HTML file may contain a lot of errors, (such as an element having a start tag without end tag) This is also a great reason why the HTML browser is very much. When they find errors, they have their own different ways. Decide how this HTML file should be displayed.</p> <p>This will not happen in XML.</p> <p>XML browser (Netscape, Explorer) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p> <p>In our XML guide, we put the focus on Internet Explorer 5.0 and its later versions.</p> <p>-------------------------------------------------- ------------------------------</p> <p>XML many applications on the Web site support XML. We mainly study Internet Explorer 5.x </p> <p>Some people may complain about this, but we only want to simplify things, in the network environment, the only way we know this is the only real test XML example.</p> <p>-------------------------------------------------- ------------------------------</p> <p>XML Netscape 6NetScape 6 supports XML.</p> <p>In Netscape 6, see the XML source file can be right-click on the page, then select "Source File".</p> <p>-------------------------------------------------- ------------------------------</p> <p>XML Internet Explorer 5.0ie 5.0 supports XML 1.0 standard.</p> <p>Internet Explorer 5.0 supports international standards for XML1.0 standards and XML DOM (Document Object Model). These standards are W3C released (World Wide Web Consortium).</p> <p>Internet Explorer 5.0 supports the following XML features:</p> <p>The XML document is viewed on the W3C DTD standard to embed XML in the HTML page in the HTML page to bind XML data to the HTML element. Use the XSL program to convert and display the XML document. Using the CSS display XML Document support XML Dom Internet Explorer 5.0 also support XML behavior (XML BEHAVIORS):</p> <p>Behavior is that Microsoft's unique technical behavior can be separated from the HTML page. Script Behavior can see data stored on the client's hard disk on the next chapter to give some related examples. If you want to know more about NTERNET Explorer, you can go to W3Schools' Browser Information to browse the latest information.</p> <p>See XML file ----------------------------------------------- ---------------------------------</p> <p>The original XML file can be viewed with IE 5.0 (or higher) or Netscape 6, but if you want the XML document like the web page, you must add some additional display information.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Look at XML files We can use IE5.0 (or higher versions) to browse XML documents. You can click a hyperlink or enter the URL address in the browser's address bar, or double-click the XML document in the folder. If you use IE to open the XML document, it is found that the browser with color identifies the root element and child elements of the XML document. There is a " " number on the left side of the XML element, then you can click this " ", expand this element. Next Level structure; if there is a "-" on the left side of the element, then you can click this "-", gather the next level of this element, if you are willing to look at the source file of the XML document, then you can right click Select "Source File" in the menu.</p> <p>We can also use NetScape 6 to open an XML document, and you can also use the right click to "View the Source File" When you open the XML document with Netscape 6, the browser will display the root element and child elements with color code.</p> <p>Let's take a look at an XML file: Note.xml</p> <p>Note: Do not expect XML documents to format it as html files.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Browse unqualified XML documents If you open an incorrect XML document with the IE browser, the browser will report an error.</p> <p>Look at the following example: Note_ERROR.XML</p> <p>-------------------------------------------------- ------------------------------</p> <p>Other examples Browse some XML documents to help you find the feeling of learning XML.</p> <p>We collected some XML information for you:</p> <p>An XML CD Catalog This is my father's CD collection record, stored into XML data format.</p> <p>An XML Plant Catalog This is a plant product catalog of a plant store and is also stored in XML format.</p> <p>A Simple Food Menu This is a restaurant's breakfast book, which is also an XML format.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Why is XML look like this in the browser? A simple XML document does not contain information about how data is displayed.</p> <p>Since the XML tag is "created" and "invention" by the XML document author, then we can't know that a <table> tag refers to the form in HTML or a wooden table.</p> <p>In the case where there is no additional information indicates how data is displayed, the IE browser generally displays XML data in the form of a tree view.</p> <p>In the following, we will describe some scenarios to solve the XML document display problem, including CSS, XSL, JavaScript, and XML data island.</p> <p>Use CSS to display XML ------------------------------- ---------------------------------- Cascading Style Sheets, you can add an XML document Additional realistic information.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Use CSS to display future XML documents? Should CSS to display your future XML document?</p> <p>No, we don't recommend this! But we should still experiment:</p> <p>Let's take a simple XML document: The CD Catalog</p> <p>Then let's see the CSS style form file: The CSS file</p> <p>Finally, let's see the XML documentation displayed with CSS: The CD Catalog Formatted with the CSS File</p> <p>This is a small part of the code snippet with the XML document with CSS style.</p> <p><? XML Version = "1.0" encoding = "ISO-8859-1"?> <? Xml-stylesheet type = "text / css" href = "cd_catalog.css"?> <catalog> <cd> <title> Empire Burlesque </ title> <artist> Bob Dylan </ Artist> <country> USA </ country> <company> Columbia </ company> <price> 10.90 </ price> <year> 1985 </ year> </ cd> <CD> <title> Hide Your Heart </ Title> <Artist> Bonnie Tyler </ Artist> <country> UK </ country> <company> CBS Records </ company> <price> 9.90 </ price> <year> 1988 </ year> </ cd> .... </ catalog></p> <p>Even if the display effect of CSS is very good, we don't think that the use of CSS style will display XML documents is the trend of future web development. We believe that using the XSL program formatting XML documents will be a future trend, and the most important browser is currently supporting this technology.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Create future homepage with XML? Are you willing to use XML to create your future website?</p> <p>No, I don't think this is a good idea. We also don't refuse to do such an attempt: a homepage Written in XML.</p> <p>We don't believe that XML will be used directly to create a future web page.</p> <p>We still believe that XHTML - HTML-redefined HTML with XML may be a better choice: read our XHTML guide.</p> <p>Use XSL to display XML data -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------</p> <p>Use XSL to add display information to the XML document.</p> <p>-------------------------------------------------- ------------------------------ Use XSL to display the XML document XSL is an Extensible style single language of XML.</p> <p>XSL (full name: scalable style single language, The Extensible Stylesheet Language) is much stronger than the CSS style single function. One of the main purposes of XSL is to convert XML documents into an HTML format file, and then deliver to the browser, display the result of the conversion by the browser:</p> <p>If you have a netizen 6 or IE 5 (or higher version), you can watch the Xml File and the xsl style sheet.</p> <p>Display results in IE6: View The Result In IE 6</p> <p>Display results in IE5: View The Result In IE 5</p> <p>Note the second line in the code segment below:</p> <p><? XML Version = "1.0" encoding = "ISO-8859-1"?> <? Xml-stylesheet type = "text / xsl" href = "simple.xsl"?> <Breakfast_Menu> <food> <name> Belgian Waffles </ name> <Price> $ 5.95 </ price> <description> Two Our Famous Belgian Waffles </ Description> <Calories> 650 </ Calories> </ Food> </ BREAKFAST_MENU></p> <p>If you want to know more about XSL, please read our XSL Guide. XML Data Island ----------------------------------------------- ---------------------------------</p> <p>Using IE5.0 or higher, XML data can be embedded in the HTML page in the form of data islands.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Embed an XML data in an HTML page Use an unofficial standard <xml> tag to embed an XML data into the HTML page.</p> <p>XML data can be embedded in the HTML page as the example below:</p> <p><XML ID = "Note"> <Note> <to> TOVE </ to> <from> jani </ from> <heading> reminder </ heading> <body> don't forget me this weekend! </ body> </ Note> </ XML></p> <p>Or like an external separate XML file that is embedded below:</p> <p><XML ID = "Note" src = "Note.xml"> </ xml></p> <p>Note that <xml> tag is an HTML element, not an XML element.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Data binding XML data island can be bound to HTML elements (such as tables).</p> <p>In the following example, an XML data island (ID = CDCAT) is loaded from the external XML document. An HTML table is bound to this data island. The SPAN elements in the HTML table are bound to each other using the DataFLD attribute and the XML document corresponding to the XML document. <html> <body> <xml id = "cdcat" src = "cd_catalog.xml"> </ xml> <table border = "1" DATASRC = "# CDCAT"> <TR> <TD> <span datafld = " Artist "> </ span> </ td> <td> <span datafld =" title "> </ span> </ td> </ tr> </ table> </ body> </ html></p> <p>If you are using IE 5.0 or higher, you can try Try IT Yourself.</p> <p>If you are using IE 5.0 or later, you can watch the External XML file.</p> <p>You can also experiment with this Example, demonstrate the element <THEAD>, <TBODY>, AND <TFOOT>.</p> <p>Microsoft's XML parser --------------------------------------------- -----------------------------------</p> <p>The XML parser can read, update, create, and operate an XML document.</p> <p>-------------------------------------------------- ------------------------------</p> <p>The XML parser using the XML parser is bundled with the IE5.0 browser.</p> <p>Once you have installed IE5.0, you will get an XML parser. This browser can also be called in the script or in the program in addition to the internal calls inside the browser. This parser is characterized by supporting programming models that are independent of programming language, and he supports the following technologies:</p> <p>JavaScript, VBScript, Perl, VB, Java, C , etc. W3C XML 1.0 and XML DOM DTD and XML documents to verify if the browser using JavaScript as a scripting language, so you can use the following code to create an XML document object:</p> <p>VAR Xmldoc = New ActiveXObject ("Microsoft.xmldom")</p> <p>If the browser uses VBScript as a scripting language, you can create an XML document object with the following code:</p> <p>Set Xmldoc = CreateObject ("Microsoft.xmldom")</p> <p>If you use the VBScript scripting language in the ASP program, you can use the following code form:</p> <p>Set Xmldoc = Server.createObject ("Microsoft.xmldom")</p> <p>-------------------------------------------------- ------------------------------</p> <p>Use script code to load an XML document to load an XML document into a parser.</p> <p>The following code can load an XML document into the parser:</p> <p><script type = "text / javascript"> var xmldoc = new activeXObject ("Microsoft.xmLDom") xmldoc.async = "false" xmldoc.load ("Note.xml") // ....... processing the Document Goes Here </ script> The second line of code creates an instance of the Microsoft XML parser.</p> <p>The third line of code turns off asynchronous load, ensuring that the XML parser is paid to the XML document before loading the XML document.</p> <p>The fourth line tells the parser to load the XML document name is Note.xml.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Pure XML documents by the character load parser parser can load XML text from a text string.</p> <p>The following code demonstrates the copy of the text string to the parser:</p> <p><script type = "text / javascript"> var text = "<Note>" text = text "<to> TOVE </ to> <from> jani </ from>" text = text "<Heading> Reminder </ Heading > "text = text " <body> Don't forget me this weekend! </ body> "text = text " </ note> "var xmldoc = new activXObject (" Microsoft.xmLDom ") xmldoc.async =" false " XmlDoc.LoadXml (Text) // ....... processing the document goes here </ script></p> <p>Note that the loaded string is used "LOADXML ()" method) (not the previous "LOAD ()" method), "LOADXML ()" is used to load the string, "LOAD ()" is Used to load an XML document.</p> <p>-------------------------------------------------- ------------------------------</p> <p>Use the JavaScript language to display XML data to display XML data using the JavaScript language.</p> <p>JavaScript (or VBScript) can import data from the XML document and display these data in the HTML page.</p> <p>Let's take a look at how XML and HTML make each other, first look at an XML document (Note.xml), then we look at a JavaScript script code that contains imported XML documents displayed in the HTML page. HTML Document (Note.htm).</p> <p>Go see how he works, try it.</p> <p>You can learn more about JavaScript in our Dom School.</p> <p>XML in real life ------------------------------------------------------------------------- -----------------------------------</p> <p>An example of an XML is to load information.</p> <p>-------------------------------------------------- ----------------------------- Example: XML News XML News is a specification for exchange news and other information.</p> <p>Use such a specification to make news work producers and news consumers across different hardware, software, programming languages, receive, and archive a wide variety of news information make simple and easy.</p> <p>-------------------------------------------------- ------------------------------</p> <p>An example of an XML news document: <? XML Version = "1.0" eNCoding = "ISO-8859-1"?> <Nitf> <head> <title> Colombia EarthQuake </ title> </ head> <body> <body> .head> <headline> <hl1> 143 dead in colombia Earthquake </ hl1> </ head> <byline> <bytag> by jared kotler, associated press writer </ bytag> </ byline> <dateline> <location> bogota Colombia </ location> <story.date> Monday January 25 1999 7:28 et </story.date> </ dateline> </ body.head> </ body> </ nitf></p> <p>More information about XML News can be visited: http://www.xmlnews.org/</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-47964.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="47964" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.047</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'uOCVRhZabS97KfcQSLoShMVrzaI_2BzzoXy7XeK9EzAIvRZg3ggs1HmyMC8K5xEjCZSqS4XQClyKpbvYh6'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>