我正在尝试描述一个非常基本的地铁站 map ,其中包含停靠站和时间。 This RDF to Turtle converter可以解析我的 XML,但 W3C 验证器抛出:错误:您的文档不包含任何 RDF 语句。
我不明白为什么我的文档无效,因为它不是一些非常特殊的用例?我的空白节点被描述为 Resource
,according to the specification .或者我必须对多个空白节点使用 nodeID
吗?
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.com/">
<rdf:Description rdf:about="http://example.com/HaltestelleA">
<ex:verbundenMit rdf:parseType="Resource">
<ex:Haltestelle rdf:resource="http://example.com/HaltestelleB" />
<ex:Linie rdf:resource="http://example.com/Linie1" />
<ex:Zeit>2</ex:Zeit>
</ex:verbundenMit>
<ex:verbundenMit rdf:parseType="Resource">
<ex:Haltestelle rdf:resource="http://example.com/HaltestelleB" />
<ex:Linie rdf:resource="http://example.com/Linie2" />
<ex:Zeit>7</ex:Zeit>
</ex:verbundenMit>
</rdf:Description>
</rdf:RDF>
最佳答案
问题出在您的 namespace 声明中:
xmlns:rdf="http://w3.org/1999/02/22-rdf-syntax-ns#"
应该是:
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
关于xml - W3C 验证器无法处理 RDF/XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24527728/