我在将 CSV 文件写入 XML 时遇到问题。
CSV 文件
[Folder];;;;;
[Folder\Subfolder1];;;;;
[Folder\Subfolder1\Subfolder2];;;;;
"Descriptive stuff";"its a password";"user or something";"a URL";"if anyone has a comment"
[Folder\Subfolder1\Subfolder3];;;;;
"Descriptive stuff";"its a password";"user or something";"a URL";"if anyone has a comment"
XML 输出
<?xml version="1.0" encoding="utf-8"?>
<PASSWORDFILE xmlns="http://www.password-depot.de/schemas/passwordfile/6.0/passwordfile.xsd">
<PASSWORDS>
<GROUP NAME="Folder">
<GROUP NAME="Subfolder1">
<GROUP NAME="Subfolder2">
<ITEM>
<DESCRIPTION>Descriptive stuff</DESCRIPTION>
<PASSWORD>its a password</PASSWORD>
<USERNAME>user or something</USERNAME>
<URL>a URL</URL>
<COMMENT>if anyone has a comment</COMMENT>
</ITEM>
</GROUP>
<GROUP NAME="Subfolder3">
<ITEM>
<DESCRIPTION>Descriptive stuff</DESCRIPTION>
<PASSWORD>its a password</PASSWORD>
<USERNAME>user or something</USERNAME>
<URL>a URL</URL>
<COMMENT>if anyone has a comment</COMMENT>
</ITEM>
</GROUP>
</GROUP>
</GROUP>
</PASSWORDS>
</PASSWORDFILE>
我的问题只是,我不知道在使用后如何关闭 GROUP 标签。目前,我只是在 XML 的最后关闭 GROUP 标记,从而形成一棵巨大的树。