Page 1 of 1

Class attribute error

Posted: Fri Jan 24, 2014 9:43 pm
by SusanCampbell01
Hello,

I'm having some trouble compiling my output. We use specialization in our DTDs, so I updated my xml catalog file to point to the modified DTD, and unchecked the option in Oxygen to use the default catalog file. However, whenever I publish I get errors that the class attribute for an element was not defined. How do I fix that?

Additional information:
I keep seeing the DOTJ013E error "
[DOTJ013E] Failed to parse the referenced file 'C:\Program Files\Oxygen XML Author 15\chs_proc\t_export_event_records.xml'. The XML parser reported the following error".

The element is defined in my DTD.

I did notice in a few of the files, the Doc type declaration is as follows: <!DOCTYPE task PUBLIC "-//Company//DTD DITA Task//EN" "C:\Company\dtd\mmitask.dtd"[]>, so I saved the DTDs there as well.

Re: Class attribute error

Posted: Tue Jan 28, 2014 10:04 am
by Radu
Hi Susan,

Adding your custom XML catalog which points to the specialization DTDs in the Oxygen Preferences->XML / XML Catalog page should be enough for validation and editing of your specialization's topics inside Oxygen (by the way, you do not need to uncheck that Use default catalog checkbox, your catalogs take precedence, actually I would advise you to check it back to avoid side effects).

Now for the publishing/transformation part:
Oxygen uses the DITA Open Toolkit for publishing. It contains a bundled DITA OT distribution in:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT

The DITA Open Toolkit is run as an external ANT process and it looks at only one XML catalog, the catalog located in:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\catalog-dita.xml

So in order for the publishing to work, you need to make sure that the catalog-dita.xml from the DITA OT distribution that you are using is modified in order to point to the specialization DTDs.

How is this usually done? Usually a DITA DTD specialization is bundled as a DITA OT plugin, for a small example you can check out the plugin from:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\mathml

Such a plugin gets copied to a DITA OT distribution in the OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins folder and is then installed in it. The installation will modify the catalog-dita.xml to point to your plugin's catalog entries:

http://www.oxygenxml.com/doc/ug-oxygen/ ... lugin.html

Also, you do not need to use the DITA OT installation bundled inside the Oxygen installation folder, you can copy the OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT outside of the Oxygen installation folder or use your own DITA OT distribution:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ta-ot.html

Regards,
Radu

Re: Class attribute error

Posted: Wed Jan 29, 2014 6:39 pm
by Frank Ralf
(This is a follow up to my inquiry at https://github.com/dita-ot/dita-ot/issues/861.)

I followed your detailed instructions and created a plugin in the OT's plugin folder to extend the XML Catalog. I also ran the "Run DITA OT Integrator" transformation to install the plugin. The transformation completed successfully:

Code: Select all


Executing:
"c:\program files\oxygen xml author 15\jre/bin/java" -Xmx256m -classpath "C:\Program Files\Oxygen XML Author 15/tools/ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Author 15/tools/ant" org.apache.tools.ant.launch.Launcher -f "C:/Program Files/Oxygen XML Author 15/frameworks/dita/DITA-OT/integrator.xml" "-Dwebhelp.trial.license=no" "-Dstrict=true"

Buildfile: C:\Program Files\Oxygen XML Author 15\frameworks\dita\DITA-OT\integrator.xml

strict:

integrate:
[integrate] www.oasis-open.org

BUILD SUCCESSFUL
Total time: 1 second

The process finished with exit code: 0


I checked the build.xml file and the following line has been added:

Code: Select all

<property name='dita.plugin.my_oil_plugin.dir' location='${dita.dir}\plugins/my_oil_plugin'/>
However, the DITA PDF transformation still fails as before with the following error message:

Code: Select all


[DOTJ012F] 
Failed to parse the input file 'C:\Program Files\Oxygen XML Author 15\changingtheoil_catalogtest.dita'.
The XML parser reported the following error: : C:\FranksDokumente\OxygenXMLAuthor\dtd_test\my_oil_task.dtd (The system cannot find the file specified)
Am I still missing something with the OT configuration?

TIA
Frank

@Radu
Perhaps you should change the title of this thread to better reflect the catalog file issue?

Re: Class attribute error

Posted: Thu Jan 30, 2014 11:06 am
by Radu
Hi Frank,

After running the integration you should look at the DITA OT XML catalog:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\catalog-dita.xml

Were the references to your custom DTDs added at the end of the catalog? If so, could you post the exact mappings that you found in the catalog pointing to your specializations?

Also, could you also post how a small XML document which references your custom DTDs looks like?
You should basically look if the Public ID pointed by the XML document is mapped (with precise case-sensitivity) also in the "catalog-dita.xml" to a DTD which actually exists in the referenced location.

Regards,
Radu

Re: Class attribute error

Posted: Thu Jan 30, 2014 11:33 am
by Frank Ralf
Thanks for the pointer. I'm at a different PC today but will check that asap (should have read your above instruction more thoroughly in the first place ... :wink:).

I also tried to run the Ant integration transformation from the command line as described at http://dita4publishers.sourceforge.net/ ... tions.html and got an error message about a missing Java component (I think it was tools.jar).

My other suspect is insufficient write permissions as the OT is installed in the Windows 7 default program folder which always is a bit tricky because Windows is quite strikt regarding writing there.

I will report back soon.

Regards,
Frank

Re: Class attribute error

Posted: Thu Jan 30, 2014 12:01 pm
by Radu
Hi Frank,
I also tried to run the Ant integration transformation from the command line as described at http://dita4publishers.sourceforge.net/ ... tions.html and got an error message about a missing Java component (I think it was tools.jar).
The warning about the "tools.jar" should not matter much, it means that the Java Home used to start the ANT process is a JRE and not a JDK (does not have java compiler which you don't need anyway).
Probably the cause of the failure is something else.
My other suspect is insufficient write permissions as the OT is installed in the Windows 7 default program folder which always is a bit tricky because Windows is quite strikt regarding writing there.
The integration should fail if this is the case. But that's why you should always check if the catalog-dita.xml was modified or not. You mentioned that the main build.xml was modified so this means that you probably have enough access rights for the integration to work.
But even if you do not have sufficient privileges to run the integrator in the DITA OT bundled with Oxygen, you can always copy it to another location and edit your transformation scenarios to point to it:

http://www.oxygenxml.com/doc/ug-editor/ ... ta-ot.html

Regards,
Radu

Re: Class attribute error

Posted: Thu Jan 30, 2014 7:00 pm
by Frank Ralf
Thanks for your quick reply, Radu.

I replicated the steps on another PC with the same result: The catalog file from the plugin does work in oXygen for validation but the transformation still fails.

This time I also checked the catalog-dita.xml. The Ant integration adds only the following line to the file:

Code: Select all

<rewriteURI uriStartString='plugin:my_oil_plugin:' rewritePrefix='plugins/my_oil_plugin/'/>
That might not be sufficient as no Public ID is mapped to a DTD:
Radu wrote:
After running the integration you should look at the DITA OT XML catalog:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\catalog-dita.xml

You should basically look if the Public ID pointed by the XML document is mapped (with precise case-sensitivity) also in the "catalog-dita.xml" to a DTD which actually exists in the referenced location.
Here's the sample code I used for testing:

plugin.xml

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<plugin id="my_oil_plugin">
<feature
extension="dita.specialization.catalog.relative"
file="my_oil_plugin_catalog.xml" />
</plugin>
my_oil_plugin_catalog.xml

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog
xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">

<group
prefer="public">

<public
publicId="-//OASIS//DTD DITA MyOilTask//EN"
uri="dtd/my_oil_plugin_task.dtd" />

<system
systemId="H:\oXygen\catalog_test\dtd\my_oil_task.dtd"
uri="dtd/my_oil_plugin_task.dtd" />

<systemSuffix
systemIdSuffix="my_oil_task.dtd"
uri="dtd/my_oil_plugin_task.dtd" />

</group>
</catalog>
my_oil_plugin_task.dtd is just a renamed copy of C:\Program Files\Oxygen XML Editor 15\frameworks\dita\DITA-OT\dtd\technicalContent\dtd\task.dtd.

The DITA file for testing is a copy of C:\Program Files\Oxygen XML Editor 15\frameworks\dita\DITA-OT\samples\tasks\changingtheoil.xml with the following modified DOCTYPE declaration:

Code: Select all


<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA MyOilTask//EN"
"H:\oXygen\catalog_test\dtd\my_oil_task.dtd">
I think I will follow your advice and try again with a separate copy of the OT outside of the oXygen program folder.

Kind regards,
Frank

Re: Class attribute error

Posted: Fri Jan 31, 2014 10:21 am
by Radu
Hi Frank,

You gave me enough details to reproduce the issue on my side.
It seems that because the XML catalog my_oil_plugin_catalog.xml has a DOCTYPE declaration (which is perfectly valid) the integrator does not properly parse it. It looks like a bug in the DITA OT, I will look further into it.

Just try to remove the DOCTYPE declaration from it:

Code: Select all

<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
and run again the integrator, then check in the catalog-dita.xml if you have a reference like:

Code: Select all

<public publicId="-//OASIS//DTD DITA MyOilTask//EN" xml:base="plugins/my_oil_plugin/dtd/" uri="my_oil_plugin_task.dtd"/>
which should be the one used to resolve the public ID of the specialized DITA task. Removing the DOCTYPE declaration worked for me.

Regards,
Radu

Re: Class attribute error

Posted: Fri Jan 31, 2014 11:13 am
by Radu
Hi,

I added this issue to the DITA OT Bugs List:

https://github.com/dita-ot/dita-ot/issues/1634

Regards,
Radu

Re: Class attribute error

Posted: Fri Jan 31, 2014 4:21 pm
by Frank Ralf
Hi Radu,

thanks for looking into this.

1) catalog-dita.xml is ok now
Commenting the DOCTYPE declaration in the catalog file solved the problem with the catalog-dita.xml file. Now the whole content of my catalog file gets written to catalog-dita.xml (even the commented DOCTYPE declaration):

Code: Select all


<!--<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">-->

<group prefer="public">

<public publicId="-//OASIS//DTD DITA MyOilTask//EN" xml:base="plugins/my_oil_plugin/dtd/" uri="my_oil_plugin_task.dtd"/>

<system systemId="C:\FranksDokumente\OxygenXMLAuthor\dtd_test\my_oil_task.dtd" xml:base="plugins/my_oil_plugin/dtd/" uri="my_oil_plugin_task.dtd"/>

<systemSuffix systemIdSuffix="my_oil_task.dtd" uri="dtd/my_oil_plugin_task.dtd"/>

</group>
2) OT transformation still fails

However, on my machine the OT transformation still fails. This time with the following error message:

Code: Select all

[DOTJ012F] 
Failed to parse the input file 'C:\Program Files\Oxygen XML Author 15\changingtheoil_catalogtest.dita'.
The XML parser reported the following error: :
C:\Program Files\Oxygen XML Author 15\frameworks\dita\DITA-OT\dtd\my_oil_plugin_task.dtd
(The system cannot find the file specified)
The OT doesn't look in the plugin's dtd folder but in its own. When I copy the DTD file there manually (C:\Program Files\Oxygen XML Author 15\frameworks\dita\DITA-OT\dtd\my_oil_plugin_task.dtd) the transformation works.

Looks like a problem reading the xml:base="plugins/my_oil_plugin/dtd/" attribute to me.

Re: Class attribute error

Posted: Fri Jan 31, 2014 5:02 pm
by Radu
Hi Frank,

I added another comment to the bug I opened on the DITA OT Bugs List. Looks like the systemSuffix construct you are using is not properly annotated with an xml:base when copied to the catalog-dita.xml main catalog file.
In my opinion you should simplify your XML catalog and avoid using absolute file paths in it (all references in the XML catalog should be relative or URL paths) like:

Code: Select all

<catalog
xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<public
publicId="-//OASIS//DTD DITA MyOilTask//EN"
uri="dtd/my_oil_plugin_task.dtd" />
<system
systemId="http://my_oil/my_oil_task.dtd"
uri="dtd/my_oil_plugin_task.dtd" />
</catalog>
and have the DITA topic reference the DTDs like:

Code: Select all

<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA MyOilTask//EN"
"http://my_oil/my_oil_task.dtd">
You can also remove the system mapping completely from the XML catalog.

Regards,
Radu

Re: Class attribute error

Posted: Fri Jan 31, 2014 5:42 pm
by Frank Ralf
Thanks, Radu. That finally did the trick! Restricting my catalog file to only a Public ID lets the transformation run through without problem.

Re: Class attribute error

Posted: Mon Feb 10, 2014 5:12 pm
by Frank Ralf
I've just noticed that oXygen's template for XML Catalog 1.1 files looks like this:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<!-- DTD -->
<system systemId="http://www.docbook.org/xml/4.5/docbookx.dtd" uri="../../docbook/4.5/dtd/docbookx.dtd"/>

<!-- RELAX NG schema -->
<uri name="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" uri="../../docbook/5.0/rng/docbook.rng"/>

<!-- W3C XML Schema -->
<uri name="http://www.w3.org/2004/10/xml.xsd" uri="xml.xsd"/>

<!-- XSLT stylesheet -->
<uri name="http://docbook.org/xsl/fo/docbook.xsl" uri="../../docbook/xsl/fo/docbook.xsl"/>

<!-- Replace the suffix of system IDs -->
<systemSuffix systemIdSuffix="docbookx.dtd" uri="../../docbook/4.5/dtd/docbookx.dtd"/>

<!-- Replace the suffix of URIs -->
<uriSuffix uriSuffix="docbook.xsl" uri="../../docbook/xsl/fo/docbook.xsl"/>
</catalog>
According to this thread this will fail because of
  • 1. the DOCTYPE
    2. the use of systemId instead of publicId (which isn't even mentioned).
At http://www.oxygenxml.com/doc/ug-author/ ... alogs.html publicId is mentioned but mission from the example given.

Frank

Re: Class attribute error

Posted: Mon Feb 10, 2014 5:36 pm
by Radu
Hi Frank,

A new file template is just a starting point for someone wanting to quickly edit a certain type of XML vocabulary. The new file templates for XML catalog 1.0 and 1.1 are located in the OXYGEN_INSTALL_DIR\frameworks\xml\templates folder.

Indeed the DITA OT has a problem processing the DOCTYPE in a plugin's catalog, but this is a bug in the DITA OT which will be fixed in a future version. Oxygen is not only a DITA editor, it can also edit a lot of other XML vocabularies out of the box, I would not consider quite appropriate changing our new file templates to overcome bugs in a certain output processor but I will add this request of removing the DOCTYPE from the new XML catalog 1.1 template to our issues list and it will be discussed.

The new file template does not contain all the possible mappings (public, system, delegatePublic, delegateSystem), it is just a starting point.

Regards,
Radu

Re: Class attribute error

Posted: Thu Feb 13, 2014 4:12 pm
by Frank Ralf
Of course you're right, Radu. I've been blinded a bit by my DITA context ;-)