Skip to Content
avatar image
Former Member

Script to generate XSD from XML model

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 30, 2017 at 06:03 PM

    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

    Add comment
    10|10000 characters needed characters exceeded