question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to work with modular DTD?

See original GitHub issue

Problem

When editing a file with correct DOCTYPE and available DTD files I get message saying the DTD has 41 errors: image

The DTD in question is the JATS (Journal Article Tagging Suite), which is a NISO Z39.96-2019 standard maintained by the NLM (U.S. National Library of Medicine), and it most certainly does not have any errors.

I feel that the server is working, for when I remove the system identifier I get the correct error: image

Please, any ideas as to what might be wrong?

DTD library and test file

This DTD is available at ftp://ftp.ncbi.nih.gov/pub/jats/publishing/1.1d3/JATS-Publishing-1-1d3-MathML2-DTD.zip and is composed of the following files, which include a sample test XML file (marked below).

./
β”œβ”€β”€ catalog-jats-v1-1d3-no-base.xml
β”œβ”€β”€ catalog-jats-v1-1d3-with-base.xml
β”œβ”€β”€ iso8879
β”‚Β Β  β”œβ”€β”€ isobox.ent
β”‚Β Β  β”œβ”€β”€ isocyr1.ent
β”‚Β Β  β”œβ”€β”€ isocyr2.ent
β”‚Β Β  β”œβ”€β”€ isodia.ent
β”‚Β Β  β”œβ”€β”€ isolat1.ent
β”‚Β Β  β”œβ”€β”€ isolat2.ent
β”‚Β Β  β”œβ”€β”€ isonum.ent
β”‚Β Β  └── isopub.ent
β”œβ”€β”€ iso9573-13
β”‚Β Β  β”œβ”€β”€ isoamsa.ent
β”‚Β Β  β”œβ”€β”€ isoamsb.ent
β”‚Β Β  β”œβ”€β”€ isoamsc.ent
β”‚Β Β  β”œβ”€β”€ isoamsn.ent
β”‚Β Β  β”œβ”€β”€ isoamso.ent
β”‚Β Β  β”œβ”€β”€ isoamsr.ent
β”‚Β Β  β”œβ”€β”€ isogrk3.ent
β”‚Β Β  β”œβ”€β”€ isomfrk.ent
β”‚Β Β  β”œβ”€β”€ isomopf.ent
β”‚Β Β  β”œβ”€β”€ isomscr.ent
β”‚Β Β  └── isotech.ent
β”œβ”€β”€ JATS-ali-namespace1.ent
β”œβ”€β”€ JATS-articlemeta1.ent
β”œβ”€β”€ JATS-backmatter1.ent
β”œβ”€β”€ JATS-chars1.ent
β”œβ”€β”€ JATS-common1.ent
β”œβ”€β”€ JATS-common-atts1.ent
β”œβ”€β”€ JATS-default-classes1.ent
β”œβ”€β”€ JATS-default-mixes1.ent
β”œβ”€β”€ JATS-display1.ent
β”œβ”€β”€ JATS-format1.ent
β”œβ”€β”€ JATS-funding1.ent
β”œβ”€β”€ JATS-journalmeta1.ent
β”œβ”€β”€ JATS-journalpubcustom-classes1.ent
β”œβ”€β”€ JATS-journalpubcustom-mixes1.ent
β”œβ”€β”€ JATS-journalpubcustom-models1.ent
β”œβ”€β”€ JATS-journalpubcustom-modules1.ent
β”œβ”€β”€ JATS-journalpublishing1.dtd
β”œβ”€β”€ JATS-link1.ent
β”œβ”€β”€ JATS-list1.ent
β”œβ”€β”€ JATS-math1.ent
β”œβ”€β”€ JATS-mathml3-mathmlsetup1.ent
β”œβ”€β”€ JATS-mathml3-modules1.ent
β”œβ”€β”€ JATS-mathmlsetup1.ent
β”œβ”€β”€ JATS-modules1.ent
β”œβ”€β”€ JATS-nlmcitation1.ent
β”œβ”€β”€ JATS-notat1.ent
β”œβ”€β”€ JATS-oasis-namespace1a.ent
β”œβ”€β”€ JATS-oasis-namespace1.ent
β”œβ”€β”€ JATS-oasis-tablesetup1.ent
β”œβ”€β”€ JATS-para1.ent
β”œβ”€β”€ JATS-phrase1.ent
β”œβ”€β”€ JATS-references1.ent
β”œβ”€β”€ JATS-related-object1.ent
β”œβ”€β”€ JATS-section1.ent
β”œβ”€β”€ JATS-XHTMLtablesetup1.ent
β”œβ”€β”€ JATS-xmlspecchars1.ent
β”œβ”€β”€ mathml
β”‚Β Β  β”œβ”€β”€ mmlalias.ent
β”‚Β Β  └── mmlextra.ent
β”œβ”€β”€ mathml2.dtd
β”œβ”€β”€ mathml2-qname-1.mod
β”œβ”€β”€ mathml3.dtd
β”œβ”€β”€ mathml3-qname1.mod
β”œβ”€β”€ oasis-exchange.ent
β”œβ”€β”€ Smallsamples
β”‚Β Β  β”œβ”€β”€ journal.elementa.000011.xml
β”‚Β Β  β”œβ”€β”€ journal.elementa.000012.xml
β”‚Β Β  β”œβ”€β”€ journal.elementa.000017.xml
β”‚Β Β  └── samplesmall-pub1.xml                                          # this is the test file
β”œβ”€β”€ xhtml-inlstyle-1.mod
β”œβ”€β”€ xhtml-table-1.mod
└── xmlchars
    β”œβ”€β”€ isogrk1.ent
    β”œβ”€β”€ isogrk2.ent
    └── isogrk4.ent

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:29 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
angelozerrcommented, Jan 3, 2022

Thanks for your feedbacj @lpanebr

Please note that you if you enable codelens, you should see someinformation about binding with DTD,XSD

Here a sample with binding with schemaLocation:

image

You can click on codelens to open the proper xsd.

0reactions
lpanebrcommented, Jan 3, 2022

ok. NOW I’ve REALLY gotten it to work (context aware suggestions) on Windows, with multiple catalogs on Sublime and VS Code!

UPDATE 1:

  • I’ve added the configuration file used for the LSP package, and comment.

HereΒ΄s what I did to get it working on Windows, after installing the LemMinx package:

  1. Instead of specifying multiple catalogs in the settings, I used just a single catalog file.
  2. Instead of hand-writing the catalog myself I used multiple <nextCatalog> entries pointing to the DTD-libraries-provided catalog files on the same directory.
  3. Corrected a problem in one of the catalog files (see note below).
  4. Used only the double \\ slash notation.
  5. Enabled the xml.validation.resolveExternalEntities setting.
  6. Installed the LSP package. (For Sublime only)
  7. Installed Java. (required by the LSP package)

IMPORTANT 1:

  • The LemMinx package in Sublime provides only very basic validation.
  • Installing the LSP package is what gave Sublime the ability to provide context aware suggestions for elements, attributes and attribute values.
  • The Exalt package was not installed as during tests it also provided only basic validation and dumb suggestions.

IMPORTANT 2:

  • When I intentionally break one of the <nextCatalog>s files, the validation etc breaks for XML files that use that DTD but it all keeps working for XML files using the DTDs specified by the other <nextCatalog>s files.

Below are the specific packages configurations that are currently working on Windows and provide context aware suggestions for elements, attributes and attribute values, both for Sublime Text (version 4) and VS Code.

Sublime LSP-lemminx.sublime-settings

{
	"settings": {
		"xml.catalogs": [
			"C:\\catalogs\\catalog.xml"
		],
		"xml.completion.autoCloseTags": true,
		"xml.validation.resolveExternalEntities": true,
	}
}

Sublime LSP.sublime-settings This setting is very convenient for it always opens the diagnostics panel on save, which either has a motivational message showing no errors, or lists each diagnostics allowing you to just double click to go to it in the document.

{
    "show_diagnostics_panel_on_save": 4,
}

VS Code settings.json

{
    "redhat.telemetry.enabled": false,
    "xml.catalogs": [
        "C:\\catalogs\\catalog.xml"
    ],
    "xml.completion.autoCloseTags": true,
    "xml.validation.resolveExternalEntities": true
}

The main catalog.xml has only <nextCatalog> entries using relative path as pointed by @deathaxe .

Catalog file catalog.xml

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <nextCatalog catalog="jats\\dtd\\1.1d3\\catalog-jats-v1-1d3-no-base.xml"/>
  <nextCatalog catalog="jats\\dtd\\1.1\\catalog-jats-v1-1-no-base.xml"/>
  <nextCatalog catalog="jats\\dtd\\1.0\\catalog-jats-v1.xml"/>
</catalog>

DTD files used:

catalog.xml file and DTD libraries relative to <nextCatalog> files and folders. (see note below)

C:\\catalogs\\catalogs
β”œβ”€β”€ catalog.xml
└── jats
    └── dtd
        β”œβ”€β”€ 1.0
        β”‚Β Β  β”œβ”€β”€ catalog-jats-v1.xml    # <= problematic catalog using xml:base (see note below)
        β”‚Β Β  β”œβ”€β”€ iso8879
        β”‚Β Β  β”œβ”€β”€ iso9573-13
        β”‚Β Β  β”œβ”€β”€ mathml
        β”‚Β Β  β”œβ”€β”€ Smallsamples
        β”‚Β Β  └── xmlchars
        β”œβ”€β”€ 1.1
        β”‚Β Β  β”œβ”€β”€ catalog-jats-v1-1-no-base.xml
        β”‚Β Β  β”œβ”€β”€ iso8879
        β”‚Β Β  β”œβ”€β”€ iso9573-13
        β”‚Β Β  β”œβ”€β”€ mathml
        β”‚Β Β  └── xmlchars
        └── 1.1d3
            β”œβ”€β”€ catalog-jats-v1-1d3-no-base.xml
            β”œβ”€β”€ iso8879
            β”œβ”€β”€ iso9573-13
            β”œβ”€β”€ mathml
            β”œβ”€β”€ Smallsamples
            └── xmlchars

Note:

  • The catalog-jats-v1.xml catalog was problematic. It had a xml:base defined, which has to be removed.
<!-- problematic xml:base on the group definition -->
<group xml:base="file:///C:/Work/Tasks/DTDJournal/" prefer="public">

<!-- fixed group definition -->
<group prefer="public">

Conclusion As shown above, having a single catalog that properly references other catalogs using the <nextCatalog> definition works as expected. So, if there really exists any bugs with multiple catalogs, I feel it must be related with either:

  • adding multiple catalog files as an array in the server json settings configuration file; or
  • using badly formed catalog files and/or path structure.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to work with modular DTD? - Eclipse/Lemminx
Problem. When editing a file with correct DOCTYPE and available DTD files I get message saying the DTD has 41 errors:
Read more >
XML DTD validation error issue - Stack Overflow
The DTD was specified an external file content and that's when it was not validating. Just curious why it works when internal DTD...
Read more >
W3C's Excessive DTD Traffic | W3C Blog
I just happen to be stacking together a new flavor of modular XHTML in the spirit of XHTML+RDFa for the backend of a...
Read more >
Document.Open method is throwing error "Word encountered ...
Open method is throwing error "Word encountered an error processing the XML file DTD is prohibited" when trying to open a XHTML which...
Read more >
XML Validation and Well-Formedness Check
XML validation can be done by checking documents against a schema. Oxygen XML Editor supports validation against XML Schema, DTD, Schematron, and Relax...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found