cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Script to generate XSD from XML model

sandy_davis
Explorer
0 Likes
454

I'm needing to automate the generation of XSD files from XML models. Does anyone have a sample script that will read XML models from the repository and generate XSD files?

Thanks,

Sandy

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member200945
Contributor
0 Likes

You need check out the model first.

This is an example.

Assume you have myXML.xsm in myFolder under root in the repository.

Connect to the repository first. The following code generates XSD in C:\Temp\output.txt

Set model = RepositoryConnection.FindChildByPath("myFolder\myXML", PdRMG.Cls_RepositoryModel)
model.CheckOutToFile "C:\Temp\myXML.xsm", 1

Set fso = CreateObject("Scripting.FilesystemObject")
Set f = fso.CreateTextFile("C:\Temp\output.txt", true)

f.writeLine ActiveModel.preview

GeorgeMcGeachie
Active Contributor
0 Likes

Thanks, Philip. I was looking for a more complicated solution, the simple approach is so much better 🙂