gpt4 book ai didi

xml - BaseX 属性无法序列化

转载 作者:数据小太阳 更新时间:2023-10-29 02:49:52 28 4
gpt4 key购买 nike

我有这个简单的 XML 文件:

<catalog>
<product dept="WMN">
<number>557</number>
<name language="en">Fleece Pullover</name>
<colorChoices>navy black</colorChoices>
</product>
<product dept="ACC">
<number>563</number>
<name language="en">Floppy Sun Hat</name>
</product>
<product dept="ACC">
<number>443</number>
<name language="en">Deluxe Travel Bag</name>
</product>
<product dept="MEN">
<number>784</number>
<name language="en">Cotton Dress Shirt</name>
<colorChoices>white gray</colorChoices>
<desc>Our<i>favorite</i>shirt!</desc>
</product>
</catalog>

我正在读一本书 XQuery by Priscila Walmsley它说要输入命令:

doc("catalog.xml")/*/product/@dept

所以我输入 BaseX

xquery doc("catalog.xml")/*/product/@dept

我收到这个错误:

Error:
[SENR0001] Attributes cannot be serialized:attribute dept { "WMN" }.

尽管书上说:

will return the four dept attributes in the input document.

我做错了什么?

最佳答案

BaseX 只是对序列化很严格。如果您将属性节点强制为字符串,它不会提示:

xquery doc("catalog.xml")/*/product/@dept/string()

关于xml - BaseX 属性无法序列化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24663393/

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