validating an XML-file against locally available xsd

已回答

I am trying to validate an XML file, currently just as “scratch.xml” file available in my IDE. This xml contains some non-public namespaces.

e.g.
<CustomTag xmlns="http://www.nonepublicurl.com/xml/schema/v1">

I got the .xsd file for the CustomTag available locally and i tried to link these two via manually setting it up.
When i check Settings → Schema and DTDs, the URI “http://www.nonepublicurl.com/xml/schema/v1” is indeed listed with the path to my local .xsd file.

I also tried the xml-catalog approach


<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <uri
            name="http://www.nonepublicurl.com/xml/schema/v1"
            uri="path/to/xsd/nonepublic.xsd"/>
</catalog>

Either way, when i rightclick → validate on my xml file. i get the following error, no matter wat i tried so far:
Error:External resource http://www.nonepublicurl.com/xml/schema/v1 is not registered


What am i doing wrong? how can i validate my xml with intelliJ against a locally available xsd?

0
Hi,

Can you try the following, do it directly from the XML file:
1. Open your scratch.xml.
2. Place the caret on the namespace URL in the root tag, for example on
`http://www.nonepublicurl.com/xml/schema/v1`
3. Press Alt+Enter.
4. From the intention list, choose “Manually set up external resource…”.
5. In the dialog that opens, select your local `nonepublic.xsd` file and confirm.

This creates an entry under
Settings | Languages & Frameworks | Schemas and DTDs | Schemas and DTDs > External Schemas and DTDs with the URI as the key and your XSD as the location. After that, right-click the XML and choose Validate again, it should now use your local XSD and the “external resource … is not registered” error should go away. If it still fails, double-check two things in Schemas and DTDs:
• Under External Schemas and DTDs, the URI column is exactly `http://www.nonepublicurl.com/xml/schema/v1` (no typos, no trailing slash).
• The same URI is not listed under Ignored Schemas and DTDs. If it is, remove it from there.

Thank you!
0

As i tried to explain with this paragraph
 


I got the .xsd file for the CustomTag available locally and i tried to link these two via manually setting it up.
When i check Settings → Schema and DTDs, the URI “http://www.nonepublicurl.com/xml/schema/v1” is indeed listed with the path to my local .xsd file.

I already tried that.
The URI does show up at “External schemas and DTDs”, but it seemingly has no effect

 

0
Hi,

Is the issue reproducible with the files attached? Does it help if you change example to your nonpublic url and try again?


0

请先登录再写评论。