XSD.xsd:element 和 xs:element 之间的区别? [英] XSD. Different between xsd:element and xs:element?

查看:57
本文介绍了XSD.xsd:element 和 xs:element 之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 w3schools 上阅读了关于 XSD 的文章,这里有很多例子.例如这个:

I reading articles about XSD on w3schools and here many examples. For example this:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>

但是在我尝试将这个 .xsd 文件放入 xjc 之后 - 我看到错误日志,圆顶像这样:

But after I tried put this .xsd file in xjc - I see error log, dome like this:

The prefix "xs" for element "xs:schema" is not bound...

但是当我在 xsd 前缀上更改 xs 时,一切正常.

But all work correct when I change xs on xsd prefix.

那么,有人可以帮我澄清一下 xsxsd 之间的区别吗?

So, can somebody, clarify for me what is different between xs and xsd?

也许,一个前缀 - 它是旧版本,另一个是新版本......

Maybe, one prefix - it is old version and other for new version...

推荐答案

xsxsd 是与限定名称一起使用的 XML 前缀;每个前缀必须与一个命名空间相关联.关联是通过一个看起来像 xmlns:xs="..." 的属性完成的.xsxsd 最常见于 XML 架构文档.

xs and xsd are XML prefixes used with qualified names; each prefix must be associated with a namespace. The association is done with an attribute that looks like xmlns:xs="...". xs and xsd are most common for XML Schema documents.

如果您选择 sns1,它应该不会对您的场景中的任何工具产生任何影响.

Should you choose s or ns1, it shouldn't make any difference to any tool for your scenario.

该错误不是由您的 XML 架构文件引起的.我怀疑您的设置中可能还有其他内容,可能是自定义绑定文件.请检查或发布其他信息.

The error is not caused by your XML Schema file. I suspect there might be something else in your setup, maybe a custom binding file. Please check that or post additional information.

这篇关于XSD.xsd:element 和 xs:element 之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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