Ditamap error says invalid element name in yaml file

Having trouble installing Oxygen? Got a bug to report? Post it all here.
AnnetteSo
Posts: 16
Joined: Thu Aug 25, 2022 2:28 pm

Ditamap error says invalid element name in yaml file

Post by AnnetteSo »

Hi, we have a ditamap to include Swagger content in our docs through yaml files. In Oxygen one of the yaml files (Files.yaml) is causing the following error and we've no idea why it's different to the rest. Please can you explain what the following error means?
Yaml_error.png
Yaml_error.png (75.96 KiB) Viewed 1180 times
Here's a snippet from the map:
<topicref href="MSDK/r_rest_catalog.dita#files" toc="yes" linking="none"
navtitle="Files API" format="dita"/>
<topicref format="openapi-to-dita" href="MSDK/json/Files.yaml" toc="no" linking="none"/>
Cosmin Duna
Site Admin
Posts: 123
Joined: Wed Dec 12, 2018 5:33 pm

Re: Ditamap error says invalid element name in yaml file

Post by Cosmin Duna »

Hi,
When you include these topic references to non-DITA documents, Oxygen converts them into the background for presenting the titles in the DITA map tree.
Could you try to convert the document to DITA using the OpenAPI to DITA conversion from the Batch Documents Converter add-on: https://www.oxygenxml.com/doc/versions/ ... addon.html? You should uncheck the "Create DITA maps from OpenAPI documents" option from the conversion dialog to obtain the same result as in the background conversion.
And after that, could you try to validate the resulting DITA document and send us the errors you found? I expected to be a problem in our conversion.

Best regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
AnnetteSo
Posts: 16
Joined: Thu Aug 25, 2022 2:28 pm

Re: Ditamap error says invalid element name in yaml file

Post by AnnetteSo »

Hello Cosmin, I tried following your instructions. It created the output folder but no files. A message flashed up and disappeared too quickly to read. So I'm attaching the Files.yaml file here in a zip.
By the way, I tried running the batch converter on another yaml file that doesn't cause problems, but that also produced no output.
Files.yaml.zip
(2.97 KiB) Downloaded 180 times
Last edited by AnnetteSo on Thu Mar 02, 2023 7:34 pm, edited 1 time in total.
Cosmin Duna
Site Admin
Posts: 123
Joined: Wed Dec 12, 2018 5:33 pm

Re: Ditamap error says invalid element name in yaml file

Post by Cosmin Duna »

Hi,
Thank you for this sample. I analyzed it and the conversion problem is caused by the "*/*" MIME type. The converter tries to create an XML element with an invalid name without escaping the "*" character.
I registered an internal issue for this and the fix will be included in the next version of Oxygen (25.1) that will be released in the following weeks.

I also have a workaround for this. Please follow these steps:
  1. Open the following jar file into the "Archive Browser" view from Oxygen: "Oxygen_installation_directory\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.dynamic.resources.converter\lib\oxygen-batch-converter-core.jar"
  2. In the view, search for the "stylesheets/open-api/openAPI_v2.0_to_v3.0.xsl" file and open it in the main editor
  3. Replace the function named "f:escapeInvalidCharsFromMimeTypes" from line 183 with this one:

    Code: Select all

        <xsl:function name="f:escapeInvalidCharsFromMimeTypes" as="xs:string">
            <xsl:param name="toEscape" as="xs:string"/>
            <xsl:variable name="aux0" select="replace(xs:string($toEscape), '/', '_X2f_')"/>
            <xsl:variable name="aux1" select="replace($aux0, '\+', '_X2b_')"/>
            <xsl:variable name="aux2" select="replace($aux1, ' ', '_X20_')"/>
            <xsl:variable name="aux3" select="replace($aux2, ';', '_X3b_')"/>
            <xsl:variable name="aux4" select="replace($aux3, '=', '_X3d_')"/>
            <xsl:variable name="aux5" select="replace($aux4, '\*', '_X2a_')"/>
            <xsl:value-of select="$aux5"/>
        </xsl:function>
    
  4. Save the document and restart Oxygen
After these steps, the dynamic conversion on publishing should work properly.

Best regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
AnnetteSo
Posts: 16
Joined: Thu Aug 25, 2022 2:28 pm

Re: Ditamap error says invalid element name in yaml file

Post by AnnetteSo »

Hi Cosmin, many thanks for the workaround that I only just got around to applying. That's fixed the problem. :)
Cosmin Duna
Site Admin
Posts: 123
Joined: Wed Dec 12, 2018 5:33 pm

Re: Ditamap error says invalid element name in yaml file

Post by Cosmin Duna »

Hi,
As an update, we released Oxygen 25.1 and it contains a fix for this problem.

Best regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply