I am trying to validate my XML against an existing XSD file in Visual Studio Code and have tried a few of the suggested validation processes in Redhat XML, but struggling to get any of the validation results to appear.
A colleague managed to get the validation to work with xsi:SchemaLocation
but something is not working for me. (specific file paths and addresses changed)
Header in XML:
<COSD:COSD
xmlns="http://www.address.uk/location/location"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.address.uk/location/location file:///c%3a/Users/Username/Documents/Temp/filename.xsd">
<MAINXML/>
</COSD:COSD>
XSD header I haven't updated from the predefined schema, but it comes as per the below:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:COSD="http://www.address.uk/location/location"
version="9-0-1" #
id="AnonymisedName"
xmlns="http://www.address.uk/location/location"
targetNamespace="http://www.address.uk/location/location"
finalDefault="extension">
<MAINBODY>
</xs:schema>
The xmlns
and targetNamespace
matches the xlmns
in the XML header.
I must be missing something in order to bind the XML and XSD together to get the validation, but any thoughts/troubleshooting ideas would be greatly appreciated.
Tried other methods from https://github.com/redhat-developer/vscode-xml/blob/main/docs/Validation.md.
The one attempted above using xsi:SchemaLocation
has been made to work elsewhere but not in my instance, hence using this method.
Expecting to see schema validation issues in VS Code Problems section.