org.xml.sax.SAXParseException; lineNumber: 4268; columnNumber: 51; cos-nonambig: "http://camel.apache.org/schema/spring":onFallback and "http://camel.apache.org/schema/spring":onFallback (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.

      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      at org.apache.xerces.impl.xs.XSConstraints.reportSchemaError(Unknown Source)
      at org.apache.xerces.impl.xs.XSConstraints.fullSchemaChecking(Unknown Source)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
      at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)

当我试图在Camel版本更新到4.0.4和Java 17之后从camel—spring.xsd创建一个新的模式时,

代码是这样的,错误发生在最后一行:

import com.google.common.io.Resources;

import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.SchemaFactory;
import java.io.ByteArrayInputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;


public class Camel
{

    public static void main( String[] args ) throws Exception
    {
       SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

       List<Source> tmp = new ArrayList();

       String loc = "camel-spring.xsd";

       URL url = Resources.getResource(loc);
       byte[] bytes = Resources.toByteArray(url);
       StreamSource src = new StreamSource(new ByteArrayInputStream(bytes));
       tmp.add(src);

       schemaFactory.newSchema((Source[]) tmp.toArray(new Source[tmp.size()]));
    }
}

你见过这个错误吗?

我已经看到camel—spring. xsd 4.x(https://camel.apache.org/schema/spring/)在circuit Breakerdef元素上有两个"onFallBack"元素,这是错误的.当我 comments 其中一个时,我没有得到一个错误.但是我不能修改jar,你知道是否有办法从xsd Camel 4.x中获取架构吗?

camel-spring.xsd

推荐答案

您可以try 将此特性设置为false:

schemaFactory.setFeature("http://apache.org/xml/features/validation/schema-full-checking", false);

This(非常古老的)文档提到"独特粒子属性"是关闭的判断之一.

Java相关问答推荐

为什么JFrame paint()多次绘制同一点(或根本不绘制)?

如何为具有多对多关系的实体的给定SQL查询构建JPA规范?

屏蔽字母数字代码的Java正则表达式

如何在Java中声明未使用的变量?

更新AWS凭据

Jenv-相同的Java版本,但带有前缀

如何在Microronaut中将 map 读取为 map

Java连接池无法正常工作

如何在不删除Java中已有内容的情况下覆盖文件内容?

解析方法";javax/imageio/metadata/IIOMetadata.getAsTree(Ljava/lang/String;)Lorg/w3c/dom/Node时加载约束冲突

Oj算法 MatrixR032从字符串、归一化和余弦相似度计算创建

如何在透视表中添加对计数列的筛选?

有谁能帮我修一下这个吗?使输出变得更加整洁

为什么在下面的Java泛型方法中没有类型限制?

组合连接以从两个表返回数据

Win32函数的JNA绑定DwmGetColorizationColor返回E_INVALIDARG错误

为什么JavaFX MediaPlayer音频播放在Windows和Mac上运行良好,但在Linux(POPOS/Ubuntu)上却有问题?

通过/失败的参数化junit测试方法执行数

如何以事务方式向ibmmq发送消息

双对象供应商