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.
Edit settings.json
to validate against DTD using catalog file as follows:
You must set "xml.catalogs
","xml.javahome
", "xml.validation.resolveExternalEntities
" respectively.
Then you can get the succeeded validation result:
By the way, your DITA file is originally not valid against DITA DTD.