[erlang-questions] xml creation
Dmitry Klionsky
dm.klionsky@REDACTED
Tue Feb 10 12:39:34 CET 2015
No, your function should be like:
test7(UId,DId) when is_integer(Uid), is_integer(Did) ->
RootElem = {configuration,
[{uid, [integer_to_list(UId)]},{dif,
[integer_to_list(DId)]}]},
serialize([RootElem]).
On 02/10/2015 01:53 PM, Lamchith M C wrote:
> Thanks, got it, where i am calling the function i will call with
> parameters surrounded by " ". I was trying that inside the function,
> which was failing like below
>
>
> RootElem = {configuration,
> [{uid, ["UId"]},{dif, ["DId"]}]},
>
> On Tue, Feb 10, 2015 at 4:10 PM, Dmitry Klionsky
> <dm.klionsky@REDACTED <mailto:dm.klionsky@REDACTED>> wrote:
>
> Not sure what you mean, but I'm trying to say that Uid and Did
> should be atoms or strings.
>
>
>
> On 02/10/2015 01:34 PM, Lamchith M C wrote:
>> So i can not make this parametric? So that by calling the
>> test7(UId,DId) functions with different variables to create
>> different xml.
>>
>> On Tue, Feb 10, 2015 at 3:20 PM, Dmitry Klionsky
>> <dm.klionsky@REDACTED <mailto:dm.klionsky@REDACTED>> wrote:
>>
>> test7('1', "1") works because the simplest Content's element
>> should be IOString.
>> http://www.erlang.org/doc/man/xmerl.html#export_simple-3
>>
>>
>> On 02/10/2015 11:46 AM, Lamchith M C wrote:
>>> I want to create Following xml .
>>>
>>> <?xml version="1.0"?>
>>> <configuration>
>>> <uid>1</uid>
>>> dif>1</dif>
>>> </configuration>
>>>
>>> I am trying it with following code, but getting error.
>>>
>>> serialize(Data) ->
>>> Xml = lists:flatten(xmerl:export_simple(Data, xmerl_xml)),
>>> io:format("~s~n", [Xml]).
>>>
>>> test7(UId,DId) ->
>>> RootElem = {configuration,
>>> [{uid, [UId]},{dif, [DId]}]},
>>> serialize([RootElem]).
>>>
>>> by calling test7(1,1)
>>>
>>> Please help.
>>>
>>> --
>>> Regards,
>>> Lamchith
>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>>
>>
>> --
>> Regards,
>> Lamchith
>
>
>
>
> --
> Regards,
> Lamchith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150210/c6ac5bde/attachment.htm>
More information about the erlang-questions
mailing list