gpt4 book ai didi

xml - 在 XML 中存储列表结构的最有效方式

转载 作者:数据小太阳 更新时间:2023-10-29 01:58:47 25 4
gpt4 key购买 nike

开始一个新项目并计划将我所有的 Web 内容存储在 XML 中。我无权访问数据库,所以这似乎是下一个最好的选择。我正在努力解决的一件事是如何为链接构建 XML(稍后将使用 XSLT 进行转换)。它也需要相当灵活。以下是我的开头,但我开始质疑它。

<links>
<link>
<url>http://google.com</url>
<description>Google</description>
<link>
<link>
<url>http://yahoo.com</url>
<description>Yahoo</description>
<links>
<url>http://yahoo.com/search</url>
<description>Search</description>
</link>
<link>
</links>

应该转化为

谷歌雅虎搜索

也许像这样的东西可能会更好。

<links>
<link href="http://google.com">Google</link>
<link href="http://yahoo.com">Yahoo
<link href="http://yahoo.com/search">Search</link>
</link>
</links>

有没有人可能有一个链接讨论如何用 XML 正确构建 Web 内容?

谢谢。 :)

最佳答案

我很想使用类似的东西:

<links>
<link url="http://google.com" text="Google"/>
<link url="http://yahoo.com" text="Yahoo">
<links>
<link url="http://yahoo.com/search" text="Search"/>
</links>
</link>
</links>

(尽管内部 <links> 是可选的,可以删除,因此您有链接/链接/链接)

关于xml - 在 XML 中存储列表结构的最有效方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2554289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com