Squat Pit Time Fully master XML Nathan Oh

Source: Internet
Author: User

1. Base: XML design is used to transmit and store data; The full name is EXtensible Markup Language. It is designed to transmit data instead of displaying data. XML tags are not predefined and need to be defined by the user themselves. XML is designed to be self-descriptive. XML is not done and does not do anything. XML design is used to structure, transmit and store information. XML is just plain text, and software that has the ability to handle plain text can handle XML. XML is the most commonly used tool for data transfer between various applications. Then there was JSON.

XML is used in many aspects of web development and is often used to simplify the storage and sharing of data. XML makes it easy to exchange data between incompatible systems.

One of the most time-consuming challenges for developers is the exchange of data between incompatible systems on the Internet. Exchanging data in XML reduces this complexity because data can be read through a variety of incompatible applications.

the 2.XML differentiated html:xml design is used to transmit and store data; HTML is designed to display data. tags in HTML are predefined, and tags in XML can be custom-made. It is often seen in HTML that you can omit the close tag, but in an XML document, omitting the close tag four is illegal. It is often seen in HTML that tags are not properly nested, but in XML tags, it is required that tags be properly nested. In HTML, the contiguous number of whitespace characters will be 1, but they will remain in the XML and will not be merged. If you need to display dynamic Data in an HTML document, it will take a lot of time to edit the HTML whenever the data changes. With XML, data can be stored in a separate XML file. This allows you to focus on using HTML for layout and display, and to make sure that modifying the underlying data no longer requires any changes to the HTML. By using a few lines of JavaScript, you can read an external XML file and then update the contents of the data in the HTML.

3. A standard XML file:

<?XML version= "1.0" encoding= "Iso-8859-1"?><Note>< to>George</ to>< from>John</ from><Heading>Reminder</Heading><Body>Don ' t forget the meeting!</Body></Note>

In modern browsers, it is supported to view XML files directly on the page. Note that XML is case sensitive and must use the exact same open label and close tag. In an XML document, you must have a root element. The attribute value of the XML needs to be quoted. Such as

<date= "08/08/2008"><to>George </  to > <  from > John</from></Note>

Without quotation marks, it will not be recognized correctly.

4.xml tree structure: XML has an excellent self-descriptive nature. The elements in the XML document form a document tree. The tree starts at the root and leaves the leaf node. The parent, child, and sibling are used to describe the relationship between elements.

Entity reference:< symbol in 5.xml if used in an XML document, the interpreter is considered to be the beginning of a new label, which leads to the concept of entity references, with a string in place of some specific characters that may cause ambiguity. The specific rules are defined as follows:

&lt; < Less than
&gt; > Greater than
&amp; & and number
&apos; Single quotation marks
&quot; " Quotes

It is a good practice to use entity references instead of these symbols.

6. Using annotations in XML is the same as in HTML, using <!--you is a bad boy-to-.

The 7.xml element is extensible, and one of the advantages of XML is that it can often be extended without interrupting the application.

8. In XML, attribute values must be quoted. Both single and double quotation marks are possible. Take a look at three XML documents:

<NoteDate= "08/08/2008">< to>George</ to>< from>John</ from><Heading>Reminder</Heading><Body>Don ' t forget the meeting!</Body></Note> 
<Note><Date>08/08/2008</Date>< to>George</ to>< from>John</ from><Heading>Reminder</Heading><Body>Don ' t forget the meeting!</Body></Note>
<Note><Date>  < Day>08</ Day>  <Month>08</Month>  < Year>2008</ Year></Date>< to>George</ to>< from>John</ from><Heading>Reminder</Heading><Body>Don ' t forget the meeting!</Body></Note>

The conclusion is to avoid using XML attributes and use XML elements as much as possible.

    • The XML document must have a root element
    • XML document must have a close tag
    • The XML tag is case sensitive
    • XML elements must be nested correctly
    • XML attributes must be quoted

10.

Squat Pit Time Fully master XML Nathan Oh

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.