redhat-developer / vscode-xml

Editing XML in Visual Studio Code made easy
Eclipse Public License 2.0
254 stars 78 forks source link

0.14: catalog not accepted when DOCTYPE catalog 1.1 is present #369

Open pgundlach opened 3 years ago

pgundlach commented 3 years ago

I have updated to 0.14 and my XML file is not associated with the grammar anymore. When I remove

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

from the catalog (or change the version to 1.0), everything is fine. I don't know if this is intended or not, I just want to report this. Please feel free to close this without any comment.

To reproduce:

I have a file called layout.xml with this contents:

<Layout xmlns="urn:speedata.de:2009/publisher/en">
</Layout>

The setting xml.catalog lists this file:

/Users/patrick/work/software/publisher/schema/catalog-schema-en.xml

and the contents of this file is

<?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">
    <!-- W3C schema -->
    <uri name="urn:speedata.de:2009/publisher/en" uri="/Users/patrick/work/software/publisher/schema/layoutschema-en.xsd"/>
</catalog>

The grammar is not associated with the xml file.

Now I remove the second line (<!DOCTYPE...) and the catalog file is "accepted" and my XML file gets autocompletion etc.

It used to work with XML extension 0.13.

When I insert

<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">

instead of version 1.1, the XSD grammar is also accepted.

angelozerr commented 3 years ago

I noticed since this tuesday, URL for catalog uses now https. It seems that Xerces doesn't support forward and we change the url to https https://github.com/eclipse/lemminx/pull/929/files#diff-aa132033b0397ce4e9d1a3332f7007881dd085758d5c64d7d90801ea3f47e166

This code is used to manage catalog without DOCTYPE.

In other words, if you change your URL with https, is it working?

pgundlach commented 3 years ago

@angelozerr It works, but as far as I understand the spec, a http prefix is a valid for the catalog identifier.

No problem for me, as I have removed the line, but perhaps other users might stumble across this.