otp
otp copied to clipboard
ERL-1320: Validation failure with xmerl_xsd
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.