Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make DITA catalog.xml work in VS Code?

Tags:

xml

dita

I am using VS Code and the "XML Language Support by Red Hat". I am pointing to the catalog file inside the DITA OT directory dita-ot-3.3.3\catalog-dita.xml. My DITA file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "http://docs.oasis-open.org/dita/v1.1/OS/dtd/task.dtd">
<task>
    <title>Running the converter</title>
    <steps>
        <step>
            <cmd>Run the following command:</cmd>
        </step>
    </steps>
</task>

But I get errors like:

Element type "task" must be declared.xml(MSG_ELEMENT_NOT_DECLARED)

So it's reading something, but it's not working correctly. Am I using the wrong catalog file? Is my document declaration wrong?

An aside: I have Oxygen XML Editor and I can use that if I need advanced functions. I am looking to use VS Code for occasional small edits while I'm coding without having to launch Oxygen.

like image 730
Pawel Kowaluk Avatar asked Nov 03 '25 00:11

Pawel Kowaluk


1 Answers

Edit settings.json to validate against DTD using catalog file as follows:

Editing setting.json

You must set "xml.catalogs","xml.javahome", "xml.validation.resolveExternalEntities" respectively.

Then you can get the succeeded validation result:

Validation result

By the way, your DITA file is originally not valid against DITA DTD.

like image 102
Toshihiko Makita Avatar answered Nov 04 '25 18:11

Toshihiko Makita



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!