类库中 XSD 文件的 URI
我有一个存储多个 XSD 文件的类库。在同一库中创建 XmlSchema 类时,我想知道如何获取 XSD 文件的 URI。
该库正在通过 Web 应用程序进行部署。有没有办法从 Web 应用程序获取 URI?
谢谢。
I have a class library that stores several XSD files. When creating an XmlSchema class in the same library, I would like to know how to get the URI to the XSD file.
The library is being deployed with a web application. Is there a way to get the URI from the web application as well?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XSD 架构的 URI 通常显示在 SchemaLocation="" 属性中。该属性由至少由一个空格字符分隔的一对字符串组成;每对中的第一个字符串是名称空间,第二个字符串是 XSD 架构的 URI。
该 URI 可以指向 XML 使用者可访问的任何位置。将它们作为静态文件放在网站的单独目录中似乎是一个不错的选择。
例如
The URI to the XSD schema is usually shown in the SchemaLocation="" attribute. This attribute is made of pairs of strings separated by at least one whitespace character; the first string in each pair is the NameSpace and the second string the URI to the XSD schema.
This URI can point to any location accessible to the consumers of your XML. Serving them as static files in a separate directory of the web site seems to be a good choice.
For example