这个xsd可能有什么问题?

3

我有一个xsd文件。当我尝试在BizTalk中进行验证时,会出现以下错误:

error BEC2009: Node "<Schema>" - Schema reference "http://www.w3.org/2001/xml.xsd" is not a valid reference or does not exist in the current project.

error BEC2009: Node "<Schema>" - Schema reference "http://www.w3.org/2001/xml.xsd" is not a valid reference or does not exist in the current project.

warning BEC999: Cannot resolve the 'schemaLocation' attribute.

error BEC3001: The 'http://www.w3.org/XML/1998/namespace:space' attribute is not declared.

warning BEC999: Cannot resolve the 'schemaLocation' attribute.

warning BEC1007: Node "<Schema>" - Target namespace is empty.

我认为它指的是类似这样的命名空间:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>

我不确定这是否足够的信息...
编辑:
我发现根据我使用的程序验证xml,有时会有效。例如,如果我创建一些.net代码来验证模式与xml,则似乎可以正确读取xsd并验证xml。如果我在notepad ++中使用xml验证,它会说无法读取模式。在另一个映射器(WTX)中,他们也说它不起作用。
还有其他我可以尝试缩小可能问题的范围吗?
编辑2:
感谢xcut。发现如果我将模式下载到本地并将其放入BizTalk项目中,则模式可以正常验证,但会出现1个警告: 警告BEC1007:节点“”-目标命名空间为空。

你确定需要显式导入命名空间namespace吗? - AJ.
模式架构是由第三方提供给我们的,但出于某些原因,我们无法在我们的系统中使用它。 - dtc
1个回答

2
除了导入命名空间模式有点奇怪之外,可能是因为BizTalk无法通过URL导入模式(而您的.net代码可以)。
为了排除这个问题,请从w3.org下载模式,将其放入您的项目中,并从那里导入,而不是通过http导入。

你是正确的。下载模式后,它验证通过了,但是有一个警告:警告 BEC1007:节点 "<Schema>"-目标命名空间为空。 - dtc
这可能是因为您的主模式没有声明目标命名空间;不确定为什么在BizTalk中会出现警告,这是完全合法的。 - xcut

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接