' Created by Johan Wester ' KPN Telecom 1999 '-------------------------------------------------------------------------------- Function GetAssociations( theClass As Class) As String Dim theAssociation As Association Dim theAssociations As AssociationCollection Set theAssociations = theClass.GetAssociations assocs$="" For AssocID=1 To theAssociations.Count Set theAssociation = theAssociations.GetAt(AssocID) elem$=theAssociation.Role1.Class.Name card$=theAssociation.Role1.Cardinality rep$="" If card$="0..n" Then rep$="*" End If If card$="1..n" Then rep$="+" End If If card$="0..1" Then rep$="?" End If If elem$<>theClass.Name Then If assocs$<>"" Then assocs$=assocs$+", " End If assocs$=assocs$+elem$+rep$ End If Next AssocID GetAssociations=assocs$ End Function Function GetSuperclass ( theClass As Class ) As String Dim theSuperclasses As ClassCollection Set theSuperclasses = theClass.GetSuperClasses If theSuperclasses.Count>0 Then GetSuperclass = theSuperclasses.GetAt(1).Name Else GetSuperclass = "" End If End Function Sub ExportDTD (FileName As String ) Dim AllClasses As ClassCollection Dim aCategory As Category Dim theClass As Class Set aCategory = RoseApp.CurrentModel.GetAllCategories.GetFirst("Data Dictionary") Set AllClasses = aCategory.GetAllClasses () Viewport.Open Open FileName$ For Output Access Write As #1 For ClsID = 1 To AllClasses.Count Set theClass = AllClasses.GetAt (ClsID) elmdecl$="" Else elmdecl = elmdecl + "(" + assoc$ + ")>" End If Else elmdecl = elmdecl + "(" + super$ + ")>" End If Print #1, elmdecl$ Next ClsID Close #1 Print "Done!" End Sub Sub Main FileName$ = SaveFileName$ ("Export Class Documentation", "DTD files:*.dtd") If FileName$ <> "" Then ExportDTD FileName$ End Sub