'==================== ''Set xapp=CreateObject("XMLSpy.Application") ' Or uncomment the following line to try GetObject 'Set xapp=GetObject("", "XMLSpy.Application") ''xapp.Visible = True ''MsgBox "XMLSpy should now be visible" ''xapp.Quit '==================== ' the event handler function Function DocEvent_OnBeforeCloseDocument(objDocument) Call WScript.Echo("received event - before closing document") End Function ' create or connect to XMLSPY Set objWshShell = WScript.CreateObject("WScript.Shell") Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") Set objSpy = WScript.GetObject("", "XMLSpy.Application") ' If only Authentic is installed (and XMLSpy is not installed) use: ' Set objSpy = WScript.GetObject("", "AuthenticDesktop.Application") ' create document object and connect to its events objSpy.Visible = True Set objDoc = objSpy.Documents.OpenFile ("C:\\OrgChart.xml", False) Call WScript.ConnectObject(objDoc, "DocEvent_") 'call the XSD schema file Set appXSD = WScript.CreateObject("XMLSpy.Application") Set ActiveDocument = objSpy ActiveDocument.AssignSchema "C:\\fpml-main-5-1.xsd",true Set objDlg= "c:\\test.html" objSpy.Documents.GenerateSchemaDocumentation objDlg 'objSpy.ActiveDocument.AssignSchema "C:\\fpml-main-5-1.xsd",False ' keep running while waiting on the event ' in the meantime close the document in XMLSPY manually Call WScript.Echo ("sleeping for 10 seconds ...") Call WScript.Sleep (10000) Set objDoc = Nothing Call WScript.Echo ("stopped listening for event") Call objSpy.Quit
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)