zoukankan      html  css  js  c++  java
  • 以Spring Bean配置文件为例解释 xmlns,xmlns:xsi,xsi:schemaLocation

    一个"形式良好"的XML文档拥有正确的语法。

    • XML 文档必须有一个根元素
    • XML元素都必须有一个关闭标签
    • XML 标签对大小写敏感
    • XML 元素必须被正确的嵌套
    • XML 属性值必须加引号
    <!--以Spring的bean的配置文件为例,解释xml-->
    <? xml version="1.0" encoding="UTF-8" ?><!-- 这是xml文件的开头-->
    <!--
        xml的根结点,所有其他节点必须被根结点所包裹。
        根结点中包含xml的命名空间的定义,一个xmlns定义一个命名空间,不同的命名空间可能有相同的标签,可以通过xmlns:prefix添加自定义前缀来区分不同的命名空间中的标签。
        xmlns:xsi是w3c认证的专用的命名空间,是用来引用XML Schema的,XML Schema是W3C制定的基于XML格式的XML文档结构描述标准,直接点说就是一个xml引入的XML Schema中定义了这个xml的语法(xml作为可扩展标记语言,就是通过引入语法定义文件来实现可扩展性的)。
        通过引入xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"命名空间就可以通过在根结点上使用xsi:schemaLocation属性来指定要引用的XML Schema文件(.xsd文件)格式是:
        xsi:schemaLocation="命名空间 具体文件地址 命名空间 具体文件地址"
    -->
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:util="http://www.springframework.org/schema/util"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/util
           http://www.springframework.org/schema/util/spring-util.xsd">
    </beans>
    
  • 相关阅读:
    6. Flask请求和响应
    5. Flask模板
    FW:Software Testing
    What is the difference between modified duration, effective duration and duration?
    How to push master to QA branch in GIT
    FTPS Firewall
    Query performance optimization of Vertica
    (Forward)5 Public Speaking Tips That'll Prepare You for Any Interview
    (转)The remote certificate is invalid according to the validation procedure
    Change
  • 原文地址:https://www.cnblogs.com/macho8080/p/11255183.html
Copyright © 2011-2022 走看看