You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

XmlSchemaSet添加含xs:override元素的XSD文件失败问题求助

XmlSchemaSet添加含xs:override元素的XSD文件失败问题求助

各位好,我最近在处理XSD文件解析的时候碰到个棘手的问题,想过来请教下大家。

我有个example.xsd文件,里面包含这段XSD片段:

<xs:override schemaLocation="../base/definitions.xsd">
  <xs:simpleType name="MessageTypeEnum">
    <xs:annotation>
      <xs:documentation>List of all message types</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="ACCESS_TRACKING">
        <xs:annotation>
          <xs:documentation>See SMT type for annotation.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      ...
  </xs:restriction>
</xs:simpleType>
</xs:override>

然后我运行下面这段C#代码来加载这个XSD:

XmlSchemaSet schemas = new XmlSchemaSet { XmlResolver = new XmlUrlResolver() };
schemas.Add("https://www.something.something.com/something", "example.xsd");

结果直接报错了:

The 'http://www.w3.org/2001/XMLSchema:override' element is not supported in this context

我想问问大家,xs:override这个指令到底支不被支持啊?如果支持的话,我需要做些什么配置才能让它正常工作?我翻了手里能找到的所有相关文档,完全没找到相关说明,实在没办法了才来求助。

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 10:09:32