gpt4 book ai didi

java - JAXB:XML 注册表中没有与 namespace 和名称匹配的 XML 元素声明

转载 作者:行者123 更新时间:2023-11-30 11:43:04 25 4
gpt4 key购买 nike

根元素类中的一些代码:

    @XmlElementRefs({
@XmlElementRef(name = "footnoteLink",
namespace = "http://www.xbrl.org/2003/linkbase",
type = JAXBElement.class, required = false)
})

出现如下描述

No XML element decl in the XML registry matching the namespace 
'http://www.xbrl.org/2003/linkbase' and name 'footnoteLink'.

原因是,这个根元素类的 ObjectFactory 没有找到声明。

但是我在另一个对象工厂(xlink object factory)中找到了footnoteLink。

private final static QName _FootnoteLink_QNAME 
= new QName("http://www.xbrl.org/2003/linkbase", "footnoteLink");

重点是xlink声明:

   <complexType>
<sequence>
<element ref="link:schemaRef" minOccurs="1" maxOccurs="unbounded" />
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="xbrli:unit"/>
<element ref="link:footnoteLink"/>
</choice>
</sequence>
</complexType>

我需要将 @xmlElementRef "footnoteLink" 指向链接对象工厂。

这可能吗?

最佳答案

所以我找到了解决办法:

在我的架构中,它是这样设置的:

xmlns:xs="http://www.w3.org/2001/XMLSchema"

我需要添加额外的:

xmlns="http://www.w3.org/2001/XMLSchema"

但是为什么????

关于java - JAXB:XML 注册表中没有与 namespace 和名称匹配的 XML 元素声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11431475/

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