Analysis of XML file header in spring standard
This article mainly introduces the example analysis of XML file header of spring standard. It is introduced in great detail through the example code, which has certain reference value for everyone's study or work. Friends in need can refer to it
The code is as follows
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> </beans>
Explanation:
1、【xmlns=" http://www.springframework.org/schema/beans "】
Declare the default namespace of the XML file, which represents the default namespace of all tags that do not use other namespaces.
2、【xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "】
After declaring an XML schema instance, you can use the schemalocation attribute.
3、【xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd 】
Specifies the location of the schema. This property must be used in conjunction with the namespace. This attribute has two values. The first value represents the namespace that needs to be used. The second value represents the location of the XML schema used by the namespace.
The namespace configured above specifies the XSD specification file, so that you will give corresponding prompts according to these XSD specification files when configuring the following specific configuration. For example, you can intelligently prompt how each tag is written and what attributes it has. When starting the service, you will also verify the configuration according to the XSD specification.
Configuration skills: the writing of attribute values is regular, separated by spaces, and the following values are the supplement to the previous ones, that is, the previous values are obtained after removing the XSD file.
The above is the whole content of this article. I hope it will help you in your study, and I hope you will support us a lot.