Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with XSD Pattern Facet

1 view
Skip to first unread message

James Hardy

unread,
Nov 6, 2002, 4:09:41 PM11/6/02
to
Hello,
I am trying to restrict data by using the Pattern
restriction, no matter what pattern (reg exp) I set the
doc loads with non matching data.

XSD Sample:
<xsd:element name="est_ph1" type="phoneType"/>
....
<xsd:simpleType name="phoneType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]{3}-[0-9]{7}"/>
</xsd:restriction>
</xsd:simpleType>


VB Code Sample:

Set doc.schemas = schemaCache
doc.async = False
doc.validateOnParse = True
strXMLin = "<est_ph1>asdkfjhasdjh</ext_ph1>"
If Not doc.loadXML(strXMLIn) Then do something

no parse error is raised.

Any help would be greatly appreciated.
Thanks

Han

unread,
Nov 6, 2002, 11:40:57 PM11/6/02
to
I tried the following with your pattern, though not with exactly same schema
as yours. Anyway it works.

set xmldoc = createobject("Msxml2.FreeThreadedDOMDocument.4.0")
set SchemaCache = createobject("Msxml2.XMLSchemaCache.4.0")
xmldoc.async = false
SchemaCache.add "", "pattern.xsd"
xmldoc.schemas = SchemaCache
if not xmldoc.load("pattern.xml") then msgbox "err"

--
Han Pohwan, Microsoft MVP, Seoul, Korea
Mail with any alphabets in the title will be removed. Use only numbers.
"James Hardy" <james...@adp.com> wrote in message
news:864801c285d8$d2995710$36ef2ecf@tkmsftngxa12...

0 new messages