Bug 409411 - Export to XHTML generates empy html file
Summary: Export to XHTML generates empy html file
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: exporter (show other bugs)
Version: 2.28.2 (KDE Applications 19.04.2)
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-02 11:30 UTC by Ralf Habacker
Modified: 2022-03-06 07:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.33.80 (KDE releases 22.03.80)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2019-07-02 11:30:32 UTC
STEPS TO REPRODUCE
1. start umbrello
2. add some classes to a class diagram
3. select menu entry "file->Export Model->Export model to XHTML"

OBSERVED RESULT
The generated html (and docbook file) is empty

EXPECTED RESULT
The generated html (and docbook file) should not be empty

SOFTWARE/OS VERSIONS
Windows: 7
Comment 1 Ralf Habacker 2019-07-02 11:37:12 UTC
Git commit c6002b5c68592932a64bb194449d2e884725631f by Ralf Habacker.
Committed on 02/07/2019 at 11:36.
Pushed by habacker into branch 'Applications/19.04'.

Fix 'Export to XHTML generates empy html file'

Since the website www.oasis-open.org cannot provide the file sdocbook.dtd
and no existing "simple docbook" package is available, the relevant files
are embedded in the Umbrello source code and installed with it.
FIXED-IN:2.28.3 (KDE Applications 19.04.3)

M  +1    -7    umbrello/CMakeLists.txt
A  +10   -0    umbrello/docgenerators/CMakeLists.txt
M  +90   -0    umbrello/docgenerators/docbookgeneratorjob.cpp
A  +67   -0    umbrello/docgenerators/simple4125/sdbcent.mod
A  +89   -0    umbrello/docgenerators/simple4125/sdbhier.mod
A  +195  -0    umbrello/docgenerators/simple4125/sdbpool.mod
A  +331  -0    umbrello/docgenerators/simple4125/sdocbook-custom.dtd
A  +679  -0    umbrello/docgenerators/simple4125/sdocbook.css
A  +1569 -0    umbrello/docgenerators/simple4125/sdocbook.dtd
A  +60   -0    umbrello/docgenerators/simple4125/sdocbookref-custom.dtd
A  +1729 -0    umbrello/docgenerators/simple4125/sdocbookref.dtd
A  +303  -0    umbrello/docgenerators/simple4125/sinclist.mod

https://commits.kde.org/umbrello/c6002b5c68592932a64bb194449d2e884725631f
Comment 2 Oliver Kellogg 2022-02-27 20:41:19 UTC
(In reply to Ralf Habacker from comment #1)
> [...]
> https://commits.kde.org/umbrello/c6002b5c68592932a64bb194449d2e884725631f

The sections "actors", "usecases", "interfaces", "classes" in the generated docbook continue to be empty after that change:

<article role="specification">
  <section id="actors">
    <title>Actors</title>
  </section>
  <section id="usecases">
    <title>Use Cases</title>
  </section>
  <section id="interfaces">
    <title>Interfaces</title>
  </section>
  <section id="classes">
    <title>Classes</title>
  </section>
  [...]

umbrello/umldoc.cpp commit 847b6e0d (2017-02-20) set the supported UML version in XMI file header to 1.4:

@@ -2015,13 +2015,13 @@ void UMLDoc::saveToXMI1(QIODevice& file)
     QDateTime now = QDateTime::currentDateTime();
     root.setAttribute(QLatin1String("timestamp"), now.toString(Qt::ISODate));
     root.setAttribute(QLatin1String("verified"), QLatin1String("false"));
-    root.setAttribute(QLatin1String("xmlns:UML"), QLatin1String("http://schema.omg.org/spec/UML/1.3"));
+    root.setAttribute(QLatin1String("xmlns:UML"), QLatin1String("http://schema.omg.org/spec/UML/1.4"));
     doc.appendChild(root);

However, the umbrello/docgenerators/xmi2docbook.xsl continues to use

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                xmlns:UML="http://schema.omg.org/spec/UML/1.3"
                exclude-result-prefixes="UML">

libxslt apparently performs a consistency check on the xmlns URI between the stylesheet and the XML input file.
On the version mismatch, xsltApplyStylesheet() does not return an error but silently refuses to carry out the transformations.
Comment 3 Oliver Kellogg 2022-02-27 21:44:13 UTC
Git commit de636719fdfc7245f5498ae9717cf4462dfaa01d by Oliver Kellogg.
Committed on 27/02/2022 at 21:42.
Pushed by okellogg into branch 'master'.

Address reopening https://bugs.kde.org/show_bug.cgi?id=409411#c2 ,
> [...]
> libxslt apparently performs a consistency check on the xmlns URI
> between the stylesheet and the XML input file.
> On the version mismatch, xsltApplyStylesheet() does not return an
> error but silently refuses to carry out the transformations.

umbrello/docgenerators/xmi2docbook.xsl
- In the <xsl:stylesheet> attributes change
                xmlns:UML="http://schema.omg.org/spec/UML/1.3"
  to
                xmlns:UML="http://schema.omg.org/spec/UML/1.4"
  for synchronizing with Umbrello versions since 2.21 (Apps 17.03.80).
- Other changes:
  - Remove whitespace at line ends.
  - Join Xpath expressions spread over two lines to single line.
  - In <xsl:template name="class">,
    - in <xsl:for-each> fix Xpath expression of "select";
    - in <xsl:if test="@xmi.id = $idvalue">,
      - at entity &packagename; <xsl:value-of> fix attribute name in
        "select";
      - in <div role="push">,
        - fix typo at "Abstract";
        - at "Visibility" update ancient <xsl:if> expressions.
  - In <xsl:template name="attribute">,
    - at "Visibility" update ancient <xsl:if> expressions;
    - at "Default" remove non-ASCII/non-UTF8 unidentified characters.
  - In <xsl:template name="operation"> update ancient <xsl:if>
    expressions intended for decoding "visibility".

umbrello/docgenerators/docbookgeneratorjob.cpp
- Enclose additions of commit c6002b5 in #ifdef USE_SDOCBOOK_LOCAL_COPY.
  Reason: The docbook generation appears to function properly without
  them.
- In function run() :
  - Remove local variables for "write the XMI model in an in-memory
    char* string", they appear to be unused.
  - Test return value from xsltParseStylesheetFile(), xmlParseFile(),
    xsltApplyStylesheet() and log an error if null.
  - On freeing up pointers deallocate `cur' last.  Reason: Heap segments
    shall be freed in the opposite order of their allocation.
FIXED-IN:2.33.80 (KDE releases 22.03.80)

M  +30   -9    umbrello/docgenerators/docbookgeneratorjob.cpp
M  +230  -236  umbrello/docgenerators/xmi2docbook.xsl

https://invent.kde.org/sdk/umbrello/commit/de636719fdfc7245f5498ae9717cf4462dfaa01d
Comment 4 Oliver Kellogg 2022-03-06 06:18:44 UTC
(In reply to Oliver Kellogg from comment #2)
> The sections "actors", "usecases", "interfaces", "classes" in the generated
> docbook continue to be empty after that change: [...]

This problem is fixed in the UML1 mode but in UML2 mode it persists.
Comment 5 Oliver Kellogg 2022-03-06 07:55:34 UTC
Git commit e1b1b501dc314d33d0b0c677f3a655d09d7863e5 by Oliver Kellogg.
Committed on 06/03/2022 at 07:54.
Pushed by okellogg into branch 'master'.

Address reopening https://bugs.kde.org/show_bug.cgi?id=409411#c4

> > The sections "actors", "usecases", "interfaces", "classes" in the
> > generated docbook continue to be empty after that change: [...]
>
> This problem is fixed in the UML1 mode but in UML2 mode it persists.

umbrello/docgenerators/xmi1docbook.xsl
- Copy from xmi2docbook.xsl for use in UML1 mode.
- In <xsl:template name="actor"> <xsl:for-each> fix "select" expression.
- In <xsl:template name="usecase"> <xsl:for-each> fix "select" expr.

umbrello/docgenerators/xmi2docbook.xsl - adaptation to UML2 mode:
- In <xsl:stylesheet> replace
    xmlns:UML="http://schema.omg.org/spec/UML/1.4"
    exclude-result-prefixes="UML"
  by
    xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
    xmlns:uml="http://schema.omg.org/spec/UML/2.1"
    exclude-result-prefixes="uml"
- In all <xsl:key> replace use="@xmi.id" by use="@xmi:id".
- In all <xsl:template>,
  - change namespace prefix "UML:" to "uml:".
  - replace select="@xmi.id" by select="@xmi:id";
  - change UML:Actor to packagedElement[@xmi:type = 'uml:Actor'];
  - change UML:UseCase to packagedElement[@xmi:type = 'uml:UseCase'];
  - change UML:Interface to packagedElement[@xmi:type ='uml:Interface'];
  - change UML:Class to packagedElement[@xmi:type = 'uml:Class'];
  - change UML:Generalization to generalization;
  - change UML:Classifier.feature/UML:Operation to ownedOperation;
  - change UML:Classifier.feature/UML:Attribute to ownedAttribute;
  - change UML:Attribute to ownedAttribute;
  - change UML:Operation to ownedOperation;
  - change UML:BehavioralFeature.parameter/UML:Parameter to
    ownedParameter;
  - change UML:Parameter to ownedParameter.

umbrello/docgenerators/docbookgenerator.cpp
- In function customXslFile set xslBaseName to "xmi1docbook.xsl" if
  Settings::optionState().generalState.uml2 is false.

umbrello/umldoc.cpp
- In function saveToXMI case Settings::optionState().generalState.uml2
  add writing of attribute "uml" with value
  "http://schema.omg.org/spec/UML/2.1".
- In function loadFromXMI, if outerTag is "XMI" or "xmi:XMI" and
  versionString is "xmi.version" then set
  Settings::optionState().generalState.uml2 true if version is greater
  than or equal to 2.0.

umbrello/docgenerators/CMakeLists.txt
- In install FILES add xmi1docbook.xsl.

umbrello/version.h
- Increment XMI2_FILE_VERSION to "2.0.4" due to <xmi:XMI> added writing
  of attribute "xmlns:uml" (see UMLDoc::saveToXMI).
FIXED-IN: 2.33.80 (KDE releases 22.03.80)

M  +1    -0    umbrello/docgenerators/CMakeLists.txt
M  +7    -1    umbrello/docgenerators/docbookgenerator.cpp
C  +2    -2    umbrello/docgenerators/xmi1docbook.xsl [from: umbrello/docgenerators/xmi2docbook.xsl - 099% similarity]
M  +60   -61   umbrello/docgenerators/xmi2docbook.xsl
M  +4    -0    umbrello/umldoc.cpp
M  +1    -1    umbrello/version.h

https://invent.kde.org/sdk/umbrello/commit/e1b1b501dc314d33d0b0c677f3a655d09d7863e5