入力XMLを投稿した場合は、より具体的になる可能性があります。
異なるサンプル入力XMLを想定して、回答を投稿しています。
サンプル入力XML:
<?xml version="1.0" encoding="utf-8"?>
<testing>68</testing>
XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="testing" type="citycode" />
<xs:simpleType name="citycode">
<xs:restriction base="xs:int">
<xs:pattern value="68"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
サンプル入力XML:
<?xml version="1.0" encoding="utf-8"?>
<testing>Blah blah City code is: 68</testing>
XSD [正規表現パターンを使用]:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="testing" type="pattern" />
<xs:simpleType name="pattern">
<xs:restriction base="xs:string">
<xs:pattern value=".*68"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
ここ.*
で、任意の文字(改行を除く)、68-数値68
もう1つのサンプル入力XML:
<?xml version="1.0" encoding="utf-8"?>
<testing>Blah blah City code is: '68' and something else</testing>
XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="testing" type="pattern" />
<xs:simpleType name="pattern">
<xs:restriction base="xs:string">
<xs:pattern value=".*68.*"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>