erlang / otp

Erlang/OTP
http://erlang.org
Apache License 2.0
11.29k stars 2.94k forks source link

ERL-1320: Validation failure with xmerl_xsd #4371

Open OTP-Maintainer opened 4 years ago

OTP-Maintainer commented 4 years ago

Original reporter: JIRAUSER16004 Affected versions: OTP-23.0.1, OTP-23.0.2, OTP-23.0.3 Component: xmerl Migrated from: https://bugs.erlang.org/browse/ERL-1320


I am trying to validate an XML file using {{xmerl_xsd}}. Trying the following -
{code:bash}
$ xmllint --schema BPMN20.xsd valid.bpmn{code}
succeeds. However, trying to validate with xmerl_xsd fails:
{code:bash}
$ ./xmerl_xsd_validate.sh BPMN20.xsd valid.bpmn
{code}
where the Erlang code is
{code:erlang}
#!/usr/bin/env escript
%% -*- mode:erlang -*-
%%! -smp enable debug verbose

main([SchemaFile, XmlFile]) ->
    {Element, []} = xmerl_scan:file(XmlFile),
    case xmerl_xsd:process_validate(SchemaFile, Element) of
        {error, Reason} ->
            io:format("~p~n", [Reason]);
        _ ->
            ok
    end.

{code}
To run this example, use the attached files.
OTP-Maintainer commented 4 years ago

lars said:

Fixed the fault in the schema processing (derived check) but then found a problem in the validation.
It was not seen because we never got there due to the schema processing fault.

Working on that now.

BR Lars