otp icon indicating copy to clipboard operation
otp copied to clipboard

ERL-92: Validation failure with xmerl_xsd

Open OTP-Maintainer opened this issue 9 years ago • 0 comments

Original reporter: rafo Affected version: OTP-18.2.1 Component: xmerl Migrated from: https://bugs.erlang.org/browse/ERL-92


I am trying to validate an XML file using {{xmerl_xsd}}. Trying the following -

{code}    bash> xmllint -schema abcd_reg.xsd asd_registrations.xml{code}

succeeds. However, trying to validate with {{xmerl_xsd}} fails:

{code}    bash> ./runme.sh{code}

where the Erlang code is

{code:erlang}run([XmlFile, XsdFile]) ->

  {XmlElement, []} = xmerl_scan:file(XmlFile),

  case xmerl_xsd:process_validate(XsdFile, XmlElement) of
    {ok, _State} ->
      ok;
    {error, Reason} ->
      io:format("validation failed, reason: ~p~n", [Reason])
   end.{code}

To run this example, use the attached files.

OTP-Maintainer avatar Feb 16 '16 18:02 OTP-Maintainer