第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

JAXB 編組 @XmlElementRef name 屬性不作為 Name

JAXB 編組 @XmlElementRef name 屬性不作為 Name

慕的地8271018 2024-01-05 14:49:22
我沒有將名稱作為 @XmlElementRef 的標(biāo)簽名稱。父元素中的元素聲明:@XmlElementRef(name = "Agents",  type = JAXBElement.class, required = false)protected JAXBElement<ArrayOfGeneralAgent> agents;類 ArrayOfGeneralAgent 的聲明:@XmlAccessorType(XmlAccessType.FIELD)@XmlType(name = "Agents", propOrder = {    "generalAgent"})public class ArrayOfGeneralAgent {@XmlElement(name = "GeneralAgent", nillable = true)        protected List<GeneralAgent> generalAgent;...}從上面的代碼來看,需要以下 xml:<Agents>  <GeneralAgent>    <ComPerc>1.5</ComPerc>    <CustID>abc</CustID>    <SharePerc>123</SharePerc>  </GeneralAgent></Agents>但是像這樣獲取 XML:<ArrayOfGeneralAgent>  <GeneralAgent>    <ComPerc>1.5</ComPerc>    <CustID>abc</CustID>    <SharePerc>123</SharePerc>  </GeneralAgent></ArrayOfGeneralAgent>而不是“代理”得到“ArrayOfGeneralAgent”。我嘗試了很多事情但一無所獲。
查看完整描述

1 回答

?
白衣染霜花

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超10個(gè)贊

您的問題是@XmlElementRef.name不起作用@XmlRootElement,請閱讀此處。


您所要做的就是從xml 元素上刪除屬性名稱。XmlElementRef


@XmlElementRef(type = JAXBElement.class, required = false)

protected JAXBElement<ArrayOfGeneralAgent> agents;

并添加@XmlRootElement到您的班級中。


@XmlRootElement(name="Agents")

public class ArrayOfGeneralAgent{...}


查看完整回答
反對 回復(fù) 2024-01-05
  • 1 回答
  • 0 關(guān)注
  • 124 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號