2012-07-11 63 views
2

一些代碼在rootElement的類中的XML登記號XML元素:JAXB:東方電氣匹配的命名空間和名稱

@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'. 

的原因是,該rootelement類的ObjectFactory沒有找到decl。

但我在另一個對象工廠(xlink對象工廠)中找到了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"指向鏈接對象的工廠。

這可能嗎?

回答

1

所以我找到了一個解決方案:

在我的架構,它被設置:

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

,我需要添加額外的:

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

但爲什麼????

+0

太早,這不是原因...... :( – chrk 2012-07-12 10:30:33