XSD. Different between xsd:element and xs:element?

主宰稳场 提交于 2020-01-03 03:36:29

问题


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>

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...

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

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...


回答1:


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.

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

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.



来源:https://stackoverflow.com/questions/7787481/xsd-different-between-xsdelement-and-xselement

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!