問題描述
我正在嘗試一些 XML Schema 示例,并且必須使用示例 XML 文件對其進行驗證.架構是一個本地文件 (someFile.xsd).我正在使用 eclipse 并希望在 XML 文件中包含一個引用以指向此本地 xsd 文件,以便 eclipse 可以向我建議元素.
I am trying out some XML Schema examples and have to validate them with a sample XML File. The schema is a local file (someFile.xsd). I am using eclipse and want to include a reference in the XML file to point to this local xsd file so that eclipse can suggest the elements to me.
我發現很難想出包含本地文件的語法.有什么建議嗎?
Am finding it hard to come up with the syntax to include a local file. Any suggestions ?
推薦答案
你使用的是 xsi:schemaLocation
屬性?
Are you using the xsi:schemaLocation
attribute?
例如:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://foo/target/Namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:someNamespace="someFile"
xsi:schemaLocation="
someFile someFile.xsd" >
...
</root>
我相信 someFile.xsd
必須在你的類路徑中
I believe someFile.xsd
has to be in your classpath
這篇關于具有 XML Schema 本地副本的 XML 文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!