关于使用记事本 XML 工具验证 XML 架构时的 xsd:”not a schema document” | 珊瑚贝

“not a schema document” when validating XML schema with notepad++ XML tools


我正在尝试为以下 XML 文档创建 XML 模式。
https://www.nationalbanken.dk/_vti_bin/DN/DataService.svc/CurrencyRatesHistoryXML?lang=en

  • 作为起点,我尝试根据 w3 学校的指南创建一个非常基本的 XML 模式。
  • https://www.w3schools.com/xml/schema_schema.asp

    这导致了这个 – 非常基本的起点。

    1
    2
    3
    4
    5
    6
    7
    <?xml version=“1.0” encoding=“UTF-8”?>

    <xs:schema xmlns:xs=“http://www.gesmes.org/xml/2002-08-01” targetNamespace=“http://www.ecb.int/vocabulary/2002-08-01/eurofxref” xmlns=“http://www.ecb.int/vocabulary/2002-08-01/eurofxref” elementFormDefault=“qualified”>
            <xs:element name=“Envelope”>

            </xs:element>
    </xs:schema>

  • 然后我将 gesmes:schemaLocation 属性添加到原始 XML 文档的根节点。
  • 1
    2
    3
    4
    <gesmes:Envelope
        xmlns=“http://www.ecb.int/vocabulary/2002-08-01/eurofxref”
        xmlns:gesmes=“http://www.gesmes.org/xml/2002-08-01”
        gesmes:schemaLocation=“http://www.ecb.int/vocabulary/2002-08-01/eurofxref ..\\StockDownloadResources\\CurrenciesDownloadMANUAL.XSD”>
  • 然后,我将 XML 工具插件安装到我的记事本中,并尝试根据基本模式验证 XML 文档。
  • 验证导致以下错误:
    架构文件解析期间发生以下错误:XML 文档 \\’\\\\\\\\CurrenciesDownloadMANUAL.XSD\\’ 不是架构文档。

    我错过了什么?


    您的架构文档无效,因为根元素需要具有本地名称 schema 和命名空间 URI http://www.w3.org/2001/XMLSchema。您的文档具有本地名称 schema 和命名空间 URI http://www.gesmes.org/xml/2002-08-01.

    的根

    (在更深的层面上,问题在于您正在尝试从示例中学习,而不是阅读解释概念的东西。W3Schools 就像那些”作弊卡”之一,它提供了一个简单的总结每个命令的效果,但不花时间解释这些示例为什么有效。)

    • 感谢您迅速回复迈克尔。如果您能指出比 W3schools 更好的学习资源的方向,我将不胜感激。
    • 有两本关于 XML Schema 的好书 – Priscilla Walmsley 和 Eric van der Vlist 的。我发现它们相互补充,所以两者兼而有之很有用,但总的来说,Priscilla 更具可读性,而 Eric 更全面。


    来源:https://www.codenong.com/57352243/

    微信公众号
    手机浏览(小程序)

    Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

    Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

    Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9061.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
    0
    分享到:
    没有账号? 忘记密码?