Hello everybody,


I use msxml version4 and I want to validate a xml file against a XDR file.
When I change for example this to type int <ElementType name="CompanyName" dt:type="string" /> then I would expect to receive an error... but I don't get any errors at all !

Does anyone know what should be wrong ?

I hope someone could help me out !

Thanks,

Bjorn

here's my XDR file :
VB Code:
  1. <?xml version="1.0" ?>
  2. <Schema xmlns="urn:schemas-microsoft-com:xml-data"
  3.         xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"  
  4.         xmlns:sql="urn:schemas-microsoft-com:xml-sql">
  5.  
  6.    <ElementType name="CustomerID" dt:type="int" />
  7.    <ElementType name="CompanyName" dt:type="int" />
  8.    <ElementType name="City" dt:type="string" />
  9.  
  10.    <ElementType name="ROOT" sql:is-constant="1">
  11.       <element type="Customers" />
  12.    </ElementType>
  13.  
  14.    <ElementType name="Customers"  sql:relation="Cust" >
  15.       <element type="CustomerID"  sql:field="CustomerID" />
  16.       <element type="CompanyName" sql:field="CompanyName" />
  17.       <element type="City"        sql:field="City" />
  18.  
  19.    </ElementType>
  20. </Schema>

This is my XML file :
VB Code:
  1. <ROOT>
  2.   <Customers>
  3.     <CustomerID>1111</CustomerID>
  4.     <CompanyName>Sean Chai</CompanyName>
  5.     <City>NY</City>
  6.   </Customers>
  7.   <Customers>
  8.     <CustomerID>1112</CustomerID>
  9.     <CompanyName>Tom Johnston</CompanyName>
  10.      <City>LA</City>
  11.   </Customers>
  12.   <Customers>
  13.     <CustomerID>1113</CustomerID>
  14.     <CompanyName>Institute of Art</CompanyName>
  15.   </Customers>
  16. </ROOT>

And this is my code to validate :
VB Code:
  1. Dim xmlschema As MSXML2.XMLSchemaCache40
  2.         xmlschema = New MSXML2.XMLSchemaCache40()
  3.         xmlschema.add("", "c:\temp\temp2\SampleSchema.xml")
  4.  
  5.         'Create an XML DOMDocument object.
  6.         Dim xmldom As MSXML2.DOMDocument40
  7.         xmldom = New MSXML2.DOMDocument40()
  8.  
  9.         'Assign the schema cache to the DOM document.
  10.         'schemas collection.
  11.         xmldom.schemas = xmlschema
  12.  
  13.  
  14.         'Load books.xml as the DOM document.
  15.         xmldom.async = False
  16.         xmldom.validate()
  17.  
  18.         xmldom.load("c:\temp\temp2\Samplexml.xml")
  19.  
  20.         'Return validation results in message to the user.
  21.         If xmldom.parseError.errorCode <> 0 Then
  22.             MsgBox(xmldom.parseError.errorCode & " " & _
  23.             xmldom.parseError.reason)
  24.         Else
  25.             MsgBox("No Error")
  26.         End If