Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?

VBA

Moderators: PavlinII
Number of threads: 1398
Number of posts: 2677

This Forum Only
Post New Thread

Report
how to use Microsoft.XMLDOM to validate xml doc against xml schema Posted by gunderj on 31 Jul 2008 at 9:22 AM
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_dvl32\CA\XML_schemas\xx-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_dvl32\CA\XML_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)



 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.