Skip to content

feat(validation): gets schema also from xsi:schemaLocation#33

Open
judzi wants to merge 2 commits intosclable:mainfrom
judzi:xsd-validation
Open

feat(validation): gets schema also from xsi:schemaLocation#33
judzi wants to merge 2 commits intosclable:mainfrom
judzi:xsd-validation

Conversation

@judzi
Copy link
Copy Markdown

@judzi judzi commented Dec 11, 2023

Changes Made:

Previously, the code logic was designed to extract a single schema location from the xsi:noNamespaceSchemaLocation attribute. Now, it also handles extraction from the xsi:schemaLocation attribute.

Example:

Consider the following example of a Symfony routing XML configuration file (https://symfony.com/doc/current/routing.html#creating-routes-in-yaml-xml-or-php-files):

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://symfony.com/schema/routing"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://symfony.com/schema/routing
                            https://symfony.com/schema/routing/routing-1.0.xsd"
>
    <route id="blog_show" path="/blog/{slug}" controller="BlogController::show">
        <default key="_controller">App\Controller\BlogController::show</default>
    </route>
    
    <route id="blog_list" path="/blog" controller="BlogController::list">
        <default key="_controller">App\Controller\BlogController::list</default>
    </route>
</routes>

In this example, the xsi:schemaLocation attribute is utilized within a Symfony XML configuration file for defining the schema to validate the structure and content of this specific XML file against the corresponding schema definition (https://symfony.com/schema/routing/routing-1.0.xsd).

This enhancement ensures compatibility with XML files following a similar structure, allowing the code to handle schema locations specified within the xsi:schemaLocation attribute.

@judzi judzi marked this pull request as ready for review December 11, 2023 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant