在xsd中验证unsignedInt时,我收到以下异常。我无法验证字符串' abce' with unsignedInt类型。 请帮我解决这个问题。
<xsd:simpleType name="DistanceType">
<xsd:restriction base="xsd:unsignedInt">
<enumeration value="4">
</enumeration>
</xsd:restriction>
</xsd:simpleType>
在此限制中,我是整数值的获取错误,如12,13。
**Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'The type is signed integer 16 bits'**
我的输入:
<type:Distance>123</type:Distance>
最终XSD:
<xsd:schema targetNamespace="http://www.example.net/sample/ws/v1/extint/types"
xmlns:extint="http://www.example.net/sample/ws/v1/extint/types"
xmlns:types="http://www.example.net/sample/xsd/v1/types"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:import namespace="http://www.exanoke.net/sample/xsd/v1/types" schemaLocation="CommonTypes.xsd"/>
<xsd:element name="GetSomeRequest">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="types:SomeRequest">
<xsd:sequence>
<xsd:element minOccurs="0" name="SearchDistance" type="types:DistanceType">
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>
CommonTypes.xsd
<xsd:schema targetNamespace="http://www.example.net/example/xsd/v1/types"
xmlns:types="http://www.example.net/sample/xsd/v1/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="DistanceType">
<xsd:restriction base="xsd:unsignedInt">
<enumeration value="4">
</enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
新一:
<xsd:schema targetNamespace="http://www.example.net/sample/ws/v1/extint/types"
xmlns:extint="http://www.example.net/sample/ws/v1/extint/types"
xmlns:types="http://www.example.net/sample/xsd/v1/types"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:import namespace="http://www.example.net/sample/xsd/v1/types" schemaLocation="CommonTypes.xsd"/>
<xsd:element name="GetBranchesRequest">
<xsd:annotation>
<xsd:documentation>INTF#09:
Serach for a list of partner branch data in the vicinity of a given WGS 84
position ordered
by increasing distance. In case a member authentication is contained
within the request the number of coupons available to the member
within
each branch is included within the result.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="types:InitialRequest">
<xsd:sequence>
<xsd:element minOccurs="0" name="Member" type="types:MemberType">
<xsd:annotation>
<xsd:documentation>
Optional data used to identify and authenticate the
member
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Position" type="types:WGS84PositionType">
<xsd:annotation>
<xsd:documentation> WGS 84 position determined by the
consumer
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Partner" type="types:PartnerContextType">
<xsd:annotation>
<xsd:documentation>Filter related to partner.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="MatchLimit" type="types:MatchLimitType">
<xsd:annotation>
<xsd:documentation>Determines the upper limit of matches,
which are returned by ascending distance the
inter-face.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="SearchDistance" type="types:DistanceType">
<xsd:annotation>
<xsd:documentation>The distance (measured in me-ters)
determines the perimeter based from the given
geo-location, where the system searches for branches.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>