0
nodejsにetree npmを使用しているときに問題が発生しました。私は広範囲にアプリケーションでelementtree npmを使用していますので、npmを変更する余裕はありません。私は以下のコードを使用してXMLを書いています。nodejs elementtree npm etree.write()pretty printing
etree.write()はXML全体を混乱させ、後で処理を中止します。タグの後にendlineを置くことはありません。これは今XMLがどのように見えるかです。以下は
<?xml version='1.0' encoding='utf-8'?><Tailoring id="1234"><status>incomplete</status><Profile id="CIS_LEVEL_1"><title>CIS_LEVEL_1 Security Profile</title><select idref="file_group_owner_grub2_cfg" selected="true" /><select idref="file_user_owner_grub2_cfg" selected="true" /><select idref="file_permissions_grub2_cfg" selected="true" /></Profile></Tailoring>
私の予想です:
<?xml version='1.0' encoding='utf-8'?>
<Tailoring id="1234">
<status>incomplete</status>
<Profile id="CIS_LEVEL_1">
<title>CIS_LEVEL_1 Security Profile</title>
<select idref="file_group_owner_grub2_cfg" selected="true" />
<select idref="file_user_owner_grub2_cfg" selected="true" />
<select idref="file_permissions_grub2_cfg" selected="true" />
</Profile>
</Tailoring>
は、私がnodejsに上記の結果をacheiveすることができます彼らのいずれかの方法です。