Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

judzi
Copy link

@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