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 后,尝试从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()]));
}
}
你见过这个错误吗?
我们尝试将spring版本和xerces版本更新到最新。但我们仍然遇到错误。
“org.xml.sax.SAXParseException”通常表示将数据解析为 XML 时出现问题。它发生在加载模式的行中 - 但是嘿:模式也是一些 XML 文档。因此,问题在于您如何加载数据,或者您加载的数据本身(您只显示您的代码)。
查看完整的错误消息,我认为问题出在您的架构中的第 4268 行。查看“onFallback”或类似元素。