xsd中的attributeGroup及其xml表示
鉴于此XSD来自xsd中的attributeGroup及其xml表示,xml,eclipse,spring,xsd,spring-security,Xml,Eclipse,Spring,Xsd,Spring Security,鉴于此XSD来自 .. 等 那么为什么eclipse会给我这个错误呢 cvc复杂类型.2.4.a:发现以元素“jdbc用户服务”开头的无效内容。“{”http:// 应为www.springframework.org/schema/security“:user}” 当我提供以下XML时 <jdbc-user-service data-source-ref="dataSource" users-by-username-query="SELECT u.uname, u.up
.. 等
那么为什么eclipse会给我这个错误呢
cvc复杂类型.2.4.a:发现以元素“jdbc用户服务”开头的无效内容。“{”http://
应为www.springframework.org/schema/security“:user}”
当我提供以下XML时
<jdbc-user-service
data-source-ref="dataSource"
users-by-username-query="SELECT u.uname, u.upwd, u.enabled FROM ucsdb.users u WHERE u.uname = ?"/>
我觉得你把事情搞混了。您可能是从另一个XML中得到这个错误。根据XSD,您发布的XML(假设名称空间是正确的,请参见下文以防万一)是有效的
<jdbc-user-service xmlns="http://www.springframework.org/schema/security" data-source-ref="dataSource" users-by-username-query="SELECT u.uname, u.upwd, u.enabled FROM ucsdb.users u WHERE u.uname = ?"/>
发布的XSD中唯一的“user”元素来自此元素:
<xs:element name="user-service" substitutionGroup="security:any-user-service">
<xs:annotation>
<xs:documentation>Creates an in-memory UserDetailsService from a properties file or a list of "user" child elements. Usernames are converted to lower-case internally to allow for case-insensitive lookups, so this should not be used if case-sensitivity is required.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="user">
<xs:annotation>
<xs:documentation>Represents a user in the application.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="security:user.attlist"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:token">
<xs:annotation>
<xs:documentation>A bean identifier, used for referring to the bean elsewhere in the context.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="security:properties-file"/>
</xs:complexType>
</xs:element>
从属性文件或“用户”子元素列表创建内存中的UserDetailsService。用户名在内部转换为小写,以允许不区分大小写的查找,因此如果需要区分大小写,则不应使用此选项。
表示应用程序中的用户。
bean标识符,用于在上下文中的其他位置引用bean。
因此,您必须验证使用“用户服务”标记的XML
<xs:element name="user-service" substitutionGroup="security:any-user-service">
<xs:annotation>
<xs:documentation>Creates an in-memory UserDetailsService from a properties file or a list of "user" child elements. Usernames are converted to lower-case internally to allow for case-insensitive lookups, so this should not be used if case-sensitivity is required.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="user">
<xs:annotation>
<xs:documentation>Represents a user in the application.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="security:user.attlist"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:token">
<xs:annotation>
<xs:documentation>A bean identifier, used for referring to the bean elsewhere in the context.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="security:properties-file"/>
</xs:complexType>
</xs:element>