简体   繁体   中英

Multiple annotations found at this line cvc-pattern-valid

In the eclipse , I have a xml ,but it has some errors like : Multiple annotations found at this line: - cvc-pattern-valid: Value 'pf-realtime-security' is not facet-valid with respect to pattern '($| |\\p{L})(\\p{L}|\\p{Nd}| |$)*' for type 'null'. - cvc-complex-type.2.2: Element 'name' must have no element [children], and the value must be valid. Multiple annotations found at this line: - cvc-complex-type.3.2.2: Attribute 'cache-level' is not allowed to appear in element 'int-jms:message-driven-channel-adapter'. - cvc-complex-type.3.2.2: Attribute 'subscription-durable' is not allowed to appear in element 'int-jms:message-driven-channel- adapter'. - cvc-complex-type.3.2.2: Attribute 'durable-subscription-name' is not allowed to appear in element 'int-jms:message-driven-channel- adapter'.

This is a spring boot project with some xml files from old project , I don't know whether here is a same problem in old project. But my project always has this problem.

<web-fragment id="WebFragment_ID" version="3.0"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd">
    <display-name>PF Realtime Services Web Application - Security Module</display-name>
    <name>pf-realtime-security</name>
<int-jms:message-driven-channel-adapter connection-factory="primeLocateConnectionFactory"
        destination="primeLocateTopic" acknowledge="auto" auto-startup="true"
        cache-level="1" channel="primeLocateInChannel" pub-sub-domain="true" 
        durable-subscription-name="prime-locate-#{systemProperties['realtime.hostname']}" subscription-durable="true"/>

I expected here should no errors in the xml files.

I don't understand the multiple annotations part of the error message, but the complaint about the name element is clear enough: the schema requires it to be a valid Java identifier (defined by a regex pattern), and a valid Java identifier cannot contain hyphens.

Since there are multiple errors in the file and they aren't simply typos, it's quite possible that you shouldn't actually be validating this particular XML document against this particular schema (perhaps you're using the wrong schema?). But I'm not sufficiently familiar with the territory to advise you on that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM