具有XML Schema本地副本的XML文件 [英] XML File with local copy of XML Schema

查看:141
本文介绍了具有XML Schema本地副本的XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试一些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文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆