Book a Demo

Author Topic: Exporting a model to HTML  (Read 22434 times)

Ewout124

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Exporting a model to HTML
« on: August 18, 2015, 11:09:24 pm »
We have created a model in Enterprise Architect, consisting of a diagram and metadata for all classes in the diagram. When a class in the diagram is clicked, the metadata is shown. Now we want to find a method to display the model in a web page. The web page should show the diagram, and the classes in the diagram should be clickable. Thus, when a class is clicked, the metadata for the class should be shown, just like in Enterprise Architect itself. Furthermore, the metadata for each class should be accessible independently, i.e. each class should have its own HTML-page. This is to make sure that the metadata can be directly referenced from other pages and applications.

The standard HTML-export of Enterprise Architect fulfills these requirements, except for the last. When a class in the diagram is clicked (or when a class is selected in the frame on the left side of the generated web page), then the metadata is displayed ‘within the page itself’. The URL does not change, it stays like […] \index.htm. We would like to have a URL like […]\class-name.htm.

We have done some experiments with publishing to XMI. However, we have not (yet) found a way to get a clickable image. And we also don’t know how to translate the XMI-file to a set of HTML-documents. We think that is should probably be possible to find some kind of ‘XMI-viewer’ somewhere. But then again, perhaps XMI isn’t the way to go for us. There might be better solutions available.

Does anyone in the Enterprise Architect community have some suggestions on how to proceed? We would be very grateful for that!

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Exporting a model to HTML
« Reply #1 on: August 19, 2015, 01:36:12 am »
Hello and welcome to the forum.


First up, if you want an HTML export which is very different from what EA delivers, I think you're going to have to write your own. But I think what you describe can be achieved based on EA's built-in HTML generator.

I don't think XMI is the way forward. XMI is an OMG-standardized format, but large bits are outside the scope of the standard, and that includes the exact representation of the images. So EA's XMI image format, like every other modelling tool's, is proprietary and undocumented. Furthermore, I'm pretty sure that the image in the XMI format is just a bitmap with no reference to the elements it contains, so I don't think you could get a useful HTML page (with clickable elements) from an XMI file.

With EA's HTML exports you can modify the content that gets exported, but the fundamental structure is hard-coded in EA (and also undocumented). You can't change the file naming scheme, for instance. The actual clickability in the images is managed by a lot of JavaScript. You can modify this too if you like, but I don't think that'll get you very far either.

I think your best bet is to have EA generate the HTML, and then write your own set of pages which reference EA's and translate between your structure and EA's. Using the class name for a file name won't work though, because in EA having several classes of the same name in the same package is perfectly legal. In a file system, it is not.

The EA-generated HTML does contain a file per element. The reason the address bar doesn't change is that it is displayed in a separate frame, but if you check the frame properties you can see what file is being displayed in it. It will be something like ....../EARoot/EA1/EA7/EA105.html.

If you look into the EA-generated file structure, there's a top-level directory js/data full of XML files. You can use these to obtain translations between the names of the HTML files EA has generated and the names and GUIDs of the elements they contain.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Exporting a model to HTML
« Reply #2 on: August 19, 2015, 08:52:12 am »
Quote
The standard HTML-export of Enterprise Architect fulfills these requirements, except for the last. When a class in the diagram is clicked (or when a class is selected in the frame on the left side of the generated web page), then the metadata is displayed ‘within the page itself’. The URL does not change, it stays like […] \index.htm. We would like to have a URL like […]\class-name.htm.

http://www.sparxsystems.com/enterprise_architect_user_guide/12.0/reporting/htmlreport.html
Quote
View page for specific diagram or element

When you view the web report in your web browser, you can switch directly to a page for a specific diagram or element by specifying the appropriate GUID after the report web address. That is:

http://path/path/path/Index.htm?guid=xxxxxxxxxxxx

Type the word guid in lower case, and do not include braces { } in the value; for example:

http:// .../path/Index.htm?guid=DC62B0DA-0D60-4447-85E6-B9BBAE7FC90F

Ewout124

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Exporting a model to HTML
« Reply #3 on: August 26, 2015, 07:31:25 pm »
Uffe and Simon M, thank you both for your replies. I have found some valuable information in your answers to my questions!

Quote
Furthermore, I'm pretty sure that the image in the XMI format is just a bitmap with no reference to the elements it contains, so I don't think you could get a useful HTML page (with clickable elements) from an XMI file.
When the option Generate Diagram Images is selected in the window Publish Model Package, an image is generated (of type .emf, by the way), and the XMI-file contains information about all elements in the diagram, in the form of <element> tags with an attribute geometry. Thus, there actually is a reference to the elements in the image.

We now plan to apply an XSLT-transformation to the XMI-file, which should result in an HTML-file. This method should give us all options to finetune the result. (It will require some more investigation, but that should be fun!)

Thanks again!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Exporting a model to HTML
« Reply #4 on: August 26, 2015, 08:43:06 pm »
Quote
We now plan to apply an XSLT-transformation to the XMI-file, which should result in an HTML-file. This method should give us all options to finetune the result. (It will require some more investigation, but that should be fun!)
Good luck with that :)
I'm not sure whether it will remain fun after you dig into the XMI specification and the custom EA extensions to it.

If I were to undertake this task I would rather write a HTML exporter using code and the API then to have to start from the XMI file.
I'm pretty sure I would be done a lot faster and with a lot better result.

Geert

cjcrystal

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Exporting a model to HTML
« Reply #5 on: October 17, 2017, 02:22:40 pm »
in relation to this topic, is there a way to slightly customize EA's built-in HTML generator, I.e insert company branding images and text.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Exporting a model to HTML
« Reply #6 on: October 17, 2017, 02:57:47 pm »
Yes, you can edit the CSS files for the HTML export allowing you to specify looks and stuff like that.

Geert

cjcrystal

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Exporting a model to HTML
« Reply #7 on: October 17, 2017, 03:13:51 pm »
thanks for pointing me to the right direction Geert :) much appreciated