java - xml文件解析疑问?
本文介绍了java - xml文件解析疑问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
"
default-autowire="byName">
<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
<property name="scopes">
<map>
<entry key="pvgscope">
<bean class="com.alibaba.tboss.common.auth.scope.PvgScope" />
</entry>
</map>
</property>
</bean>
</beans>
如上是一段xml配置文件,beans这个标签是被xsi:schemaLocation=这个里面的来解析的么?它是如何解析的?<bean>标签呢?它又是如何被解析的呢?是被spring中的bean来解析的么?<bean>里面的这些<property><map><entry>标签是如何解析呢?
解决方案
xsi:schemaLocation里面的几个URI是对xml文档结构的标准定义
相当于你本地的spring框架JAR包里面会对这个XML进行解析,解析的标准就是这个xml文档,比如http://www.springframework.org/schema/beans/spring-beans-3.0.xsd里面就说明了顶级标签是beans
如果你不符合他的标准就报错,相当于解析不到一些配置数据,程序流程也就无法流转
你其他的标签都有定义
这个应该算是xml基础
http://www.w3school.com.cn/x.asp 这里有一个教程可以看下
这篇关于java - xml文件解析疑问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文