如何指定XML schemaLocation [英] How to Specify XML schemaLocation

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

问题描述



我有一个XML文档,该文档引用同一个目录中的单个XSD模式文件.在XML文件中引用架构时,可以使用相对URL吗?如果没有,是否有办法解决必须在本地开发计算机和生产服务器上维护XML文件的不同版本的问题?


亲切的祝福,帕特里克

Hi,

I have an XML document which references a single XSD schema file which are both in the same directory. When referencing the schema in the XML file, is it possible to use a relative URL? If not, is there a way round the problem of having to maintain different versions of the XML file on my local development machine and on the production server?


Kind wishes, Patrick

推荐答案

没问题:

Not a problem:

xsi:schemaLocation="http://MYNAMESPACE ../../folder/relative/schema.xsd"



但是要注意:http://MYNAMESPACE必须替换为模式的targetNamespace URI.



But remeber: http://MYNAMESPACE must be replaced with the targetNamespace URI of your schema.


现在就知道了,谢谢.您的回复让我放心,因为我已经阅读了很多(有时)关于模式的矛盾信息,并且我访问的至少一个网站说了一些关于不允许使用相对URL的内容,并且大多数只给出了明确的完整URL.

我认为我的本地工作副本实际上正在工作,但是Visual Studio Intellisense直到我明确添加我的架构才知道它.



-帕特里克
Got it now, thanks. Your reply puts my mind at ease because I had read a lot of (sometimes) contradictory information on schemas, and at least one website I visited said something about relative URLs not being allowed and most only gave explicit full URLs.

I think my local working copy was actually working but the Visual Studio Intellisense just hadn''t got it until I explicitly added my schema.



- Patrick


这篇关于如何指定XML schemaLocation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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