i.SAF-T Full Version XML Validation against XSD

 

References

Lithuania i-SAFT XSD Schema

2.01 version of the XSD

Visual Studio Code download

https://code.visualstudio.com/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

https://notepad-plus-plus.org/downloads/

 

 

XML Validation using Visual Studio Code (for Windows, Mac, Linux)

Steps:

  1. Open the Visual Studio Code application

  2. Install the XML extension

    1. Navigate to the Extensions tab

    2. Enter “XML” in the search bar

    3. Click the XML Extension by Red Hat

    4. Click the [Install] button

  3. Open the LT i.SAF-T XML file

    1. Click “File” > click “Open File…”

    2. On the pop-up window, navigate to the directory where the XML file is located

    3. Select the XML file

    4. Click [Open]

  4. Bind XML to a Schema located in local directory

    1. Navigate to the <AuditFile> element of the XML

    2. Hover to the “…” icon

    3. Click “Quick Fix…”

    4. Click “Bind to existing grammar/schema”

    5. Select “local” binding type

    6. On the pop-up window, navigate to the directory where the XSD file is located

    7. Select the XML file

    8. Click [Select XSD file]

    9. Select “Standard (xsi, DOCTYPE) binding type)

  5. Remove previously bound Schema

    1. Navigate to the <AuditFile> element of the XML

    2. Remove the following attributes:

    3. 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"
  6. 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.

 

 

XML Validation using Notepad++ (for Windows)

Steps:

  1. Open the Notepad++ application

  2. Install XML Tools plugin

    1. Navigate to Plugins > “Plugins Admin…”

    2. On the Plugins Admin window > Available tab, enter “XML Tools” in the search bar

    3. Check the box for “XML Tools” then click the [Install] button

    4. Confirm installation by clicking [OK]

    5. After installation, Notepad++ application is restarted

  3. Open the LT i.SAF-T XML file

    1. Click “File” > click “Open…”

    2. On the pop-up window, navigate to the directory where the XML file is located

    3. Select the XML file

    4. Click [Open]

  4. Validate XML against Schema on-demand

    1. Navigate to Plugins > XML Tools > “Validate now”

    2. On the Select File pop-up window, click the […] button

    3. Navigate to the directory where the XSD file is located

    4. Select the XSD file

    5. Click [Open]

    6. Schema and Namespace fields are populated. Click the [OK] button.

    7. If error exists, its details are highlighted in yellow. Otherwise, “No error detected” message in a pop-up window is shown.