References
LT i-SAFT XSD file | |
Visual Studio Code download | |
XML Extension for VS Code Documentation | https://developers.redhat.com/blog/2019/07/24/whats-new-in-the-visual-studio-code-xml-extension |
Notepad++ download |
XML Validation using Visual Studio Code (for Windows, Mac, Linux)
Steps:
Open the Visual Studio Code application
Install the XML extension
Navigate to the Extensions tab
Enter “XML” in the search bar
Click the XML Extension by Red Hat
Click the [Install] button
Open the LT i.SAF-T XML file
Click “File” > click “Open File…”
On the pop-up window, navigate to the directory where the XML file is located
Select the XML file
Click [Open]
Bind XML to a Schema located in local directory
Navigate to the <AuditFile> element of the XML
Hover to the “…” icon
Click “Quick Fix…”
Click “Bind to existing grammar/schema”
Select “local” binding type
On the pop-up window, navigate to the directory where the XSD file is located
Select the XML file
Click [Select XSD file]
Select “Standard (xsi, DOCTYPE) binding type)
Remove previously bound Schema
Navigate to the <AuditFile> element of the XML
Remove the following attributes:
Save the XML document
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="https://www.vmi.lt/cms/saf-t"
XML Validation against XSD is now working in real time. Errors, if there are any, will be underlined by the red crooked lines. Hover over the the lines to check the error details.