[erlang-questions] xmerl_xsd can't find schema

Ahmed Omar <>
Wed Jun 29 13:57:18 CEST 2011


It sounds like a big. xmerl_xsd for some reason will mess up your path.
I think this patch should solve your problem

index e56f147..3085bc7 100644
--- a/lib/xmerl/src/xmerl_xsd.erl
+++ b/lib/xmerl/src/xmerl_xsd.erl
@@ -288,9 +288,9 @@ process_schema(Schema) ->
 %% or a single error encountered during the processing.
 process_schema(Schema,Options) when is_list(Options) ->
     S = initiate_state(Options,Schema),
-    process_schema2(xmerl_scan:file(filename:join(S#xsd_state.xsd_base,
Schema)),S,Schema);
+    process_schema2(xmerl_scan:file(filename:join(S#xsd_state.xsd_base,
filename:basename(Schema))),S,Schema);
 process_schema(Schema,State) when is_record(State,xsd_state) ->
-    process_schema2(xmerl_scan:file(filename:join(State#xsd_state.xsd_base,
Schema)),State,Schema).
+    process_schema2(xmerl_scan:file(filename:join(State#xsd_state.xsd_base,
filename:basename(Schema))),State,Schema).

 process_schema2(Err={error,_},_,_) ->
     Err;

On Wed, Jun 29, 2011 at 1:22 PM, Matti Oinas <> wrote:

> Hi
>
> I'm trying to validate XML using XML schema but
> xmer_xsd:process_schema can't find schema in any other folder than the
> current pwd().
>
> >xmerl_xsd:process_schema("../include/user.xsd").
> {error,enoent}
>
> if I copy the user.xsd file into the folder returned by pwd() which
> happens to be src and modify the path to point to that copy the
> everything works just fine.
>
> >xmerl_xsd:process_schema("user.xsd").
> {ok,{xsd_state,"user.xsd",......
>
> xmerl_scan can find the file in both folders
>
> >xmerl_scan:file("../include/user.xsd").
> {{xmlElement,'xs:schema','xs:schema',....
> >xmerl_scan:file("user.xsd").
> {{xmlElement,'xs:schema','xs:schema',....
>
> It seems to be a bug or then I'm missing some point.
>
> I'm using erlang from arch(32 bit) linux repositories.
>
> Erlang R14B (erts-5.8.1) [source] [smp:2:2] [rq:2] [async-threads:0]
> [hipe] [kernel-poll:false]
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>



-- 
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think <http://twitter.com/#!/spawn_think>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110629/7b4a310e/attachment.html>


More information about the erlang-questions mailing list