%% Author: Mike Ziebeck
%% Created: 20.05.2009
%% Description: Test case modul for erlsom
-module(erlsomtest).

%%
%% Include files
%%

%%
%% Exported Functions
%%
-export([test/0]).

%%
%% API Functions
%%

%%
%% function:	test/0
%% description:	download + write *.hdr file for www.w3.org/2001/XMLSchema
%%
test() ->
    %% not working 
	{Prefix,Url}={"xml_schema","http://www.w3.org/2001/XMLSchema.xsd"},
    %% working 
    %% {Prefix,Url}={"soap_envelope","http://schemas.xmlsoap.org/soap/envelope/"},
	inets:start(),
    FileName = filename:join([filename:dirname(code:which(?MODULE)), Prefix]),
	{ok, {{"HTTP/1.1", 200, "OK"}, _HeadRcv, Body}} = http:request(Url), 
	file:write_file(FileName++".xsd", list_to_binary(Body)),
	erlsom:write_xsd_hrl_file(FileName++".xsd", FileName++".hrl").

%%
%% Local Functions
%%