Reverse-Engineering XML

You can reverse engineer *.DTD, *.XSD, and *.XML files into an OOM. You can right-click the files to reverse engineer and select the Edit command to view the content of your files. To use this command you have to associate the file extension with an editor in the General Options/Editor dialog box.

When you reverse engineer a DTD file into an OOM, you get a more readable view of the DTD. This feature can be very helpful when you want to check and understand a new DTD that you have not generated. When you reverse engineer a DTD file into an OOM:

  • Referenced DTD files, using DOCTYPE keyword, may not be reversed correctly, it is therefore better to choose a real DTD file rather than an XML document referencing a DTD file with a DOCTYPE document type declaration
  • Elements of type #PCDATA are reversed as attributes
  • An element that has both a parent and a child element is linked to its parent element by an aggregation link
  • If an empty element has no child object but has attributes, it is reversed as a class and its attributes become attributes of the class
  • Attributes of type ID and IDREF(S) are reversed as attributes with ID and IDREF(S) data types
  • The attribute sequence order may not be preserved
  • Attribute groups structure is not preserved
  • DTD files may not be reversed properly if they contain some reference to an undefined parameter entity

When you reverse engineer an XML Schema file into an OOM, the sequence order of the contents of an element may not be preserved and the following main elements are not reverse engineered:

  • Namespace
  • Key/keyref
  • Field/selector
  • Unique
  1. Select Language > Reverse Engineer XML to open the Reverse XML dialog box.
  2. Click the Add button in the Selection page, select the .xsd, .xdr or .dtd files you want to reverse, and click Open. You can select multiple files with the CTRL or SHIFT keys.
    The Reverse XML dialog box displays the files you selected.
  3. Click OK to reverse the files. If the model to which you are reverse engineering already contains objects, the Merge Models dialog box is displayed. For more information on merging models, see Core Features Guide > The PowerDesigner Interface > Comparing and Merging Models.
    The classes are added to your model and are visible in the diagram and in the Browser.