18th End-java XML

Source: Internet
Author: User

18th End-java XML
    • Each sentence : We are not short of methods, lack of indomitable's determination and courage

    • Beginner's experience : we should learn from it, not accumulate pain

    • ( Author: jeep/711) [Java Notes | time: 2017-05-21| JAVA XML]


1. What is XML

Extensible Markup Language: translate it over to extensible Markup Language
XML technology is published by the organization, and is currently recommended to follow the XML1.0 specification published by the organization in 2000

In the XML language, it allows the user to customize the label

A label is used to describe a piece of data, a label can be divided into start and end tags, between the opening and closing tags, and other tags can be used to describe other data to achieve the description of the data relationship

For example:

1.<?xml version= "1.0" encoding= "UTF-8"?>2.< China >3.      < Beijing >4.      < Haidian ></Haidian >5.  < Fengtai ></Fengtai >6.  </Beijing >7.      < Hunan >8.      < Changsha ></Changsha >9.  < Yueyang ></Yueyang >10.  </Hunan >11.      < Hubei >12.      < Wuhan ></Wuhan >13.  < Jingzhou ></Jingzhou >14. </Hubei >15.</China >
2.XML Common applications

XML Technology, in addition to preserving relational data, is often used as a software configuration file to describe the relationship between program modules
In a software system, to improve the flexibility of the system, the module it launches is usually determined by its configuration file

3.XML syntax

An XML file is divided into the following sections:

1. Document Declaration

    • XML syntax-Document declaration

    • When you write an XML document, you need to first use the document declaration to declare the type of the XML document

    • The simplest declarative Syntax:

<?xml version= "1.0"?>

Use the Encoding property to describe the character encoding of the document:

<?xml version= "1.0" encoding= "GB2312"?>

use the Standalone property to indicate whether the document is independent:

<?xml version= "1.0" encoding= "GB2312" standalone= "yes"?>

2. Elements

    • An XML element is a label that appears in an XML file, a label that is divided into a start tag and an end tag, and a label that has the following written forms, such as:

    • Include tag body:

    • <a>https://jeep711.github.io/Home/index.html</a>


xml element naming convention : An XML element can contain letters, numbers, and other visible characters, but must adhere to some of the following specifications

  • 1.  For example, <P ;  and < p ;  is a two different tag. 
  • You cannot start with a number or a "_" (underscore).

  • You cannot start with XML (or XML, or XML, and so on).

  • Cannot contain spaces.

  • The middle of the name cannot contain a colon (:)

3. Properties : A label can have multiple properties, each with its own name and value

Attribute values must be enclosed in double quotation marks (") or single quotation marks (').

Defining attributes must follow the same naming conventions as labels


4. Notes
The annotations in the XML file take the following:

<!--annotation--format


5. Processing instructions (processing instruction)

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

For example, you can use the Xml-stylesheet directive in an XML document to notify the XML parsing engine to apply a CSS file to display XML document content

    • The processing instructions must be "<?" As the beginning, with "?>" as the end, the XML declaration statement is the most common kind of processing instructions



4.web.xml File Instance
1.<?xml version= "1.0" encoding= "UTF-8"? >2.<web-app xmlns= "Http://xmlns.jcp.org/xml/ns/javaee" 3.         Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" 4.         xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 5. version= "3.1" >6.</web-app>



Beginner (JAVA XML advanced stage) Difficulty: ★★★★★ Watch this article, you have quietly entered the end of the Java SE Tutorial Thank you for watching and supporting the next tutorial direction: Javaweb Please do please look forward to! Thank you for your reading welcome your message and suggestions
    • Facebook:jeep SevenEleven

    • Twitter: @JEEP7ll

    • Sina official Weibo: @JEEP-711

    • GitHub Blog: Https://github.com/jeep711/jeep711.github.io

    • Blog garden:http://www.cnblogs.com/jeep711/

    • w3c/blog:http://www.w3cschool.cn/jeep711blog/

    • csdn/blog:http://blog.csdn.net/jeep911

    • 51cto/blog:http://jeep711.blog.51cto.com/

    • Code Cloud: Http://git.oschina.net/JEEP711/jeep711.github.io

    • Email: [email protected],[email protected]



This article is from the "JEEP711" blog, make sure to keep this source http://jeep711.blog.51cto.com/12970787/1955821

18th End-java XML

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.