1
xmerlのexport_simple
関数を使用していて、ルートxml
要素の属性を生成する方法が見つかりません。XMLルート要素の属性生成
defmodule SomeModule do
require Record
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
def func do
{:bar, [], []}
|> List.wrap()
|> :xmerl.export_simple(:xmerl_xml, [xmlAttribute(name: :encoding, pos: 0, value: :"UTF-8", normalized: true)])
|> List.flatten()
|> to_string()
end
end
をし、それがXMLを生成し、動作しますが、それはルートxml
タグのencoding
属性を追加しません:私はこれを試してみました。
私は間違っていますか?