字符集的XSD字符串限制



我们为应用程序定义了一个SOAP接口。几乎任何字符串值都可以是任何Unicode字符,除了一些遗留字段值,其中只接受Latin-1字符集的子集。

是否有可能在XSD模式中定义对字符串值的限制,仅包含来自Latin-1字符集的字符?

当然

<xs:restriction base="xs:string">
  <xs:pattern value="(p{IsBasicLatin}|p{isLatin-1Supplement})*"/>
</xs:restriction>

或者(对于XML 1.0中允许的字符)

<xs:restriction base="xs:string">
  <xs:pattern value="[trn&#x20;-&#xff;]*"/>
</xs:restriction>

最新更新