how to use Microsoft.XMLDOM to validate xml doc against xml schema

Does anyone here know how to use VBA with Microsoft.XMLDOM to validate an xml document against an xml schema?
The code here creates an xml document from an Access query, then does a load but it does not validate the document during
the load (I have proved this by pausing and invalidating the xml file manually).
Any ideas on how I can validate the xmlFile (test.xml) against the schemaFile (C:aptx_dvl32CAXML_schemasxx-006.xsd)?

Thanks very much if you can point me to some resource on how to do this,
Jay

Dim xmlhttp, doc
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
Set doc = CreateObject("Microsoft.XMLDOM")

' *** prepare schema (.xsd) and xml (.xml) files
Dim myDir, schemaFile, xmlFile
myDir = "C:aptx_dvl32CAXML_schemas"
schemaFile = myDir & "xx-006.xsd"
xmlFile = myDir & "test.xml"

' *** export a query to the xml file
Application.ExportXML objectType:=acExportQuery, DataSource:="xml_q", DataTarget:=xmlFile, Encoding:=acUTF8, OtherFlags:=1 'access2003
doc.resolveExternals = True
doc.validateOnParse = True
doc.Load (xmlFile)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories