Java Foundation 70 is responsible for static Web page authoring language XML (Web knowledge)

Source: Internet
Author: User
Tags cdata xml parser

HTML: Responsible for the structure of the Web page
CSS: Responsible for the style of the Web page (beautiful)
JavaScript: Responsible for client (browser) side interacting with users

1, the characteristics of HTML language

1. Made up of labels
2. Loosely structured syntax
3. Case-insensitive
4. The end tag does not necessarily match the start tag

2. Characteristics of XML language

The XML file is terminated with an XML suffix
XML files need to be parsed using an XML parser. XML parser built into the browser

Syntax:<student>student</student> start tag tag content end tag
1.xml labels are case-sensitive.
2.xml labels must be paired correctly
3. Cannot start with a number
4.xml tags cannot have spaces in the middle

3. The difference between HTML and XML
HTML (Hyper-text markup Language) XML (extensible Tag language)
Label: The label is made up of the group designation, is fixed, about 100 This is custom-defined by the developer (to be defined by a certain syntax)
Role: Responsible for the structure of the Web page Responsible for the relational data (as a configuration file for the software): as shown below
Properties File: Key-value
<user>
  <name>Jack</name>
  <passworld>123456</passworld>
</user>
As a carrier of a database (storing data, a small "database") "In fact, not a database"
4. Attributes of XML

1. Attribute values must be enclosed in quotation marks, cannot be omitted, and cannot be mixed with single or double!!!
2. There can be multiple attributes in a tag, but duplicate attribute names cannot occur!!!

5. Special characters (escape characters)
  <           &lt;  >         &gt;   "         &quot; Space        &nbsp;
6. Example

Example 1:

1 <?XML version= "1.0" encoding= "Utf-8"?><!--Specify the encoding form -2 3 <!--CDATA BLOCK: The function is to display the contents of the block as text4 5 special characters (escape characters):6 < &lt;7 > &gt; 8 "&quot;9 spaces &nbsp;Ten  -     One <contactlist> A     < Contact> -         <Num>007</Num> -         <name>Tom</name> the         < Age>500</ Age> -         <Phone>18164109591</Phone> -         <Email>[Email protected]</Email> -         <QQ>872855221</QQ> +     </ Contact> -     < Contact> +         <! [Cdata[ A <num>008</num> at <name> John Doe </name> - <age>18</age> - <phone>13884109591</phone> - <email>[email protected]</email> - <QQ>152755221</QQ> -         ]]> in     </ Contact> -         &lt;P&gt;Hello&lt;/P&gt; to </contactlist>

Example 1 result diagram

Example 2:

1 <?XML version= "1.0" encoding= "Utf-8"?><!--Specify the encoding form -2 <?xml-stylesheet type= "text/css" href= "Contacts.css "?> <!--function: When displayed in a browser, only the contents of the label are displayed, not the label. The content in the back href is the CSS file used to tune the style. -3 <!--4 Requirements: Contacts system5 Contact Data: number, (unique) name age phone mailbox QQ6 Requirements:7 1. Design an XML file to store contact information data8 2. This XML file is the one that can store multiple contacts9  -Ten  One <contactlist> A     < Contact> -         <Num>007</Num> -         <name>Tom</name> the         < Age>500</ Age> -         <Phone>18164109591</Phone> -         <Email>[Email protected]</Email> -         <QQ>872855221</QQ> +     </ Contact> -     < Contact> +         <Num>008</Num> A         <name>John doe</name> at         < Age>18</ Age> -         <Phone>13884109591</Phone> -         <Email>[Email protected]</Email> -         <QQ>152755221</QQ>     -     </ Contact> -         &lt;P&gt;Hello&lt;/P&gt; in </contactlist>

CONTACS.CSS file

Example 2 result diagram

Original Dshore

Author's homepage:http://www.cnblogs.com/dshore123/

Source:https://www.cnblogs.com/dshore123/p/9541309.html

Welcome reprint, reprint must explain the source. ( If this article is helpful to you, you can click on the lower right corner of the recommendation , or comments, thank you!) )

Java Foundation 70 is responsible for static Web page authoring language XML (Web knowledge)

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.