<commit_before>-module(yaws_dav).
%%%-------------------------------------------------------------------
%%% Created : 15 May 2005 by Tobbet <<EMAIL>>
%%% Desc.   : WebDav specifics.
%%%-------------------------------------------------------------------
-export([parse_xml/1, xml_expand/1]).

-include_lib("yaws/include/yaws_dav.hrl").
-include_lib("xmerl/include/xmerl.hrl").

-define(elog(X,Y), error_logger:info_msg("*elog ~p:~p: " X,
					[?MODULE, ?LINE | Y])).


xml_expand(L) ->
    Prolog = ["<?xml version=\"1.0\" encoding=\"utf-8\" ?>"],
    xmerl:export_simple(L,xmerl_xml,[{prolog,Prolog}]).


parse_xml([]) -> [];
parse_xml(L) when list(L) ->
    case catch xmerl_scan:string(L, [{namespace_conformant, true}]) of
	{X,_} when record(X, xmlElement) ->
	    parse_dav(X);
	_Z ->
	    {error, "xml scanner failed"}
    end.

-define(CONTENT(X), X#xmlElement.content).

-define(IS_PROPFIND(X), #xmlElement{expanded_name = {'DAV:',propfind}} = X).
-define(IS_PROP(X), #xmlElement{expanded_name = {'DAV:',prop}} = X).
-define(IS_NAME(X), #xmlElement{expanded_name = {'DAV:',name}} = X).
-define(IS_PARENTNAME(X), #xmlElement{expanded_name = {'DAV:',parentname}} = X).
-define(IS_HREF(X), #xmlElement{expanded_name = {'DAV:',href}} = X).
-define(IS_ISHIDDEN(X), #xmlElement{expanded_name = {'DAV:',ishidden}} = X).
-define(IS_ISCOLLECTION(X), #xmlElement{expanded_name = {'DAV:',iscollection}} = X).
<commit_msg>*** empty log message ***<commit_after>-module(yaws_dav).
%%%-------------------------------------------------------------------
%%% Created : 15 May 2005 by Tobbet <<EMAIL>>
%%% Desc.   : WebDav specifics.
%%%-------------------------------------------------------------------
-export([parse_xml/1, xml_expand/1, xml_expand/2]).

-include("yaws_dav.hrl").
-include("xmerl.hrl").


-define(elog(X,Y), error_logger:info_msg("*elog ~p:~p: " X,
					[?MODULE, ?LINE | Y])).


xml_expand(L) ->
    xml_expand(L, "utf-8").

xml_expand(L, Cset) ->
    Prolog = ["<?xml version=\"1.0\" encoding=\""++Cset++"\" ?>"],
    xmerl:export_simple(L,xmerl_xml,[{prolog,Prolog}]).


parse_xml([]) -> [];
parse_xml(L) when list(L) ->
    case catch xmerl_scan:string(L, [{namespace_conformant, true}]) of
	{X,_} when record(X, xmlElement) ->
	    parse_dav(X);
	_Z ->
	    ?elog("to_xml: error ~p~n", [_Z]),
	    {error, "xml scanner failed"}
    end.

-define(CONTENT(X), X#xmlElement.content).

-define(IS_PROPFIND(X), #xmlElement{expanded_name = {'DAV:',propfind}} = X).
-define(IS_PROP(X), #xmlElement{expanded_name = {'DAV:',prop}} = X).
-define(IS_NAME(X), #xmlElement{expanded_name = {'DAV:',name}} = X).
-define(IS_PARENTNAME(X), #xmlElement{expanded_name = {'DAV:',parentname}} = X).
-define(IS_HREF(X), #xmlElement{expanded_name = {'DAV:',href}} = X).
-define(IS_ISHIDDEN(X), #xmlElement{expanded_name = {'DAV:',ishidden}} = X).
-define(IS_ISCOLLECTION(X), #xmlElement{expanded_name = {'DAV:',iscollection}} = X).

{'fraction_non_alphanumeric': 0.30393162393162393, 'fraction_numerical': 0.007863247863247864, 'mean_word_length': 3.1979913916786225, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 2, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 38}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7612547', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1100, 'n_words': 171}