Click here to Skip to main content
15,894,017 members

VB script with XML Spy

maithili koli mehta asked:

Open original thread
ERRROR:
object doesnt support this property or method.
ActiveDocument.AssignSchema ANY THOUGHT?

VB
'====================
''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


PLEASE REPLACE ' with ' (single quote)
Tags: VBScript, XML

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900