问题
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