16-1-8 Java Learning Note (1) XML syntax

Source: Internet
Author: User
Tags cdata processing instruction

I. XML syntax

1.xml document declaration, declaring basic properties, having and only one document life, must be on the front end: <?xml version= "1.0" encoding= "Utf-8" standalone= "yes"?>;

2.xml element, an XML tag is an XML element, a label is divided into the start tag and the end tag, between the start tag and the end tag can contain text, the file content becomes the label body,

If an XML tag does not include the tag body and does not contain other elements, then the start tag can be merged with the end tag, called the:<a></a> ===> <a/>

Tags can contain any number of sub-labels, note that labels must be reasonably nested. A good XML document has only one root tag:

Label case-sensitive,<p> and <p> are different two tags; cannot start with a number or punctuation mark or "_";

Cannot contain a space, not a colon (:);

3. Properties, a label can have multiple properties, each of which has its own name and value: <person name= "Chen"/> the value of the attribute needs to be enclosed in single or double quotation marks;

4. Note,<!--Note Memory---note content can appear anywhere in the document, except that it cannot appear at the top of the declaration document, and annotations cannot be nested;

5.CDATA zone/Escape character <! [cdata[escaped content]]> When a piece of XML does not want to be parsed by the parser, it can be wrapped using CDATA, for example: <! [Cdata[Zhang <name>]]>;

Escape characters: &-&amp;

< &lt;

> &gt;

"-&quot;

'-&apos;

6. Processing instructions, referred to as pi (processing instruction), are used to direct the parsing engine to parse XML document content.

16-1-8 Java Learning Note (1) XML syntax

Related Article

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.