尝试编写一个填充了从目录列表中获取的信息的 XML 文件,但我不知道如何让 createElement 方法与动态内容一起使用。
我很想像动态表一样在标签中进行硬编码,然后只获取整个输出并将其发布到 xml 文件中,但我也不知道如何将预格式化的标签放入 xml 中。
我的 XML 需要这样格式化
<CONTENT>
<GALLERY name="**HARDCODED DATA**">
<CATEGORY name="**HARDCODED DATA BASED FROM DIRECTORY SEARCH 1**" desc="**HARDCODED DATA BASED FROM DIRECTORY SEARCH 1**" thumb="**HARDCODED DATA BASED FROM DIRECTORY SEARCH 1**">
<ITEM>
<file_path>**dynamic content from directory search**</file_path>
<file_width>**HARDCODED**</file_width>
<file_height>**HARDCODED**</file_height>
<file_title>**dynamic content from directory search**</file_title>
<file_desc>**Loaded from a seperate txt file, index to match with the index of the dir file**</file_desc>
<file_image>**Loaded from a seperate txt file, index to match with the index of the dir file**</file_image>
<featured_image>**Loaded from a seperate txt file, index to match with the index of the dir file**</featured_image>
<featured_or_not>**Loaded from a seperate txt file, index to match with the index of the dir file**</featured_or_not>
</ITEM>
****loop through for next ITEM****
</CATEGORY>
****start next category from secody directory search content****
</GALLERY>
****start gallery 2 and 3 here, same format at gallery 1****
</CONTENT>