Java “元素类型”的内容;不动产;必须匹配
问题: 这是我的XML文件。在第6行,我得到错误“元素类型的内容”属性“必须匹配”(描述?,元*,(bean | ref | idref | value | null | list | set | map|Java “元素类型”的内容;不动产;必须匹配,java,xml,spring,Java,Xml,Spring,问题: 这是我的XML文件。在第6行,我得到错误“元素类型的内容”属性“必须匹配”(描述?,元*,(bean | ref | idref | value | null | list | set | map| 我认为您实际上并没有创建一个列表(如果这是设置点所期望的)。试试这样的东西(摘自): 第一点 第2点 第3点 您的版本与xml版本不匹配,您必须尝试下面的doctype声明 <?xml version="1.0" encoding="UTF-8"?> <beans xml
我认为您实际上并没有创建一个列表(如果这是设置点所期望的)。试试这样的东西(摘自):
第一点
第2点
第3点
您的版本与xml版本不匹配,您必须尝试下面的doctype声明
<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<beans>
<bean id= "point1" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point2" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point3" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<util:list id="pointList" value-type="bean.Point">
<value>point1</value>
<value>point2</value>
<value>point3</value>
</util:list>
<bean id="triangle" class="bean.Trinangle">
<property name="points" value="pointList" />
</bean>
<bean id= "point1" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point2" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point3" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
</beans>
那么您的bean上有类似于设置点(列表点)的东西?如果是,看看这个:我的回答有用吗?如果是,请接受。
<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<beans>
<bean id= "point1" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point2" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point3" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<util:list id="pointList" value-type="bean.Point">
<value>point1</value>
<value>point2</value>
<value>point3</value>
</util:list>
<bean id="triangle" class="bean.Trinangle">
<property name="points" value="pointList" />
</bean>
<bean id= "point1" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point2" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
<bean id= "point3" class="bean.Point">
<property name="x" value="10"/>
<property name="y" value="20"/>
</bean>
</beans>
<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-3.0.xsd " default-lazy-init="true">