0
dbからデータを取得して、個々のタグの応答に表示しようとしていますが、期待される出力を得ることができません。 implのために私が使用しているコードを見つけてください。私が間違っていることを見つけることができません。DBからデータを取得してxsd要素タグに設定する
私のImplコード -
AccountLoyaltyDetail loyaltyobj1 = new AccountLoyaltyDetail();
List<AccountLoyaltyDetail> loyaltyobj = new ArrayList<AccountLoyaltyDetail>();
AccountLoyaltyDetail loyaltyobjtemp = new AccountLoyaltyDetail();
for (final Object[] records : resultList) {
String Journey_Id = assignStringRecordValue(records[2]);
// SET OBJECT VALUES
loyaltyobjtemp.setJourneys(Journey_Id);
loyaltyobj.add(loyaltyobjtemp);
}
loyaltyobj.add(loyaltyobj1);
私のPOJO、エレメント
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.7-1.2.0.0_2-1-7-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.05.18 at 12:04:56 PM IST
//
package com.fedex.marketing.loyaltyws.objects;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AccountLoyaltyDetail complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AccountLoyaltyDetail">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="OperatingCompany" type="{http://fedex.com/ws/loyalty/v1}OperatingCompanyType" minOccurs="0"/>
* <element name="Journeys" type="{http://fedex.com/ws/loyalty/v1}LoyaltyJourneyIdentifier"/>
* <element name="Segments" type="{http://fedex.com/ws/loyalty/v1}LoyaltySegmentIdentifier"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AccountLoyaltyDetail", propOrder = {
"operatingCompany",
"journeys",
"segments"
})
public class AccountLoyaltyDetail {
@XmlElement(name = "OperatingCompany")
protected OperatingCompanyType operatingCompany;
@XmlElement(name = "Journeys", required = true)
protected List<LoyaltyJourneyIdentifier> journeys = new ArrayList<LoyaltyJourneyIdentifier>();
@XmlElement(name = "Segments", required = true)
protected List<LoyaltySegmentIdentifier> segments = new ArrayList<LoyaltySegmentIdentifier>();
/**
* Gets the value of the operatingCompany property.
*
* @return
* possible object is
* {@link OperatingCompanyType }
*
*/
public OperatingCompanyType getOperatingCompany() {
return operatingCompany;
}
public List<LoyaltyJourneyIdentifier> getJourneys() {
return journeys;
}
public void setJourneys(List<LoyaltyJourneyIdentifier> journeys) {
this.journeys = journeys;
}
public List<LoyaltySegmentIdentifier> getSegments() {
return segments;
}
public void setSegments(List<LoyaltySegmentIdentifier> segments) {
this.segments = segments;
}
/**
* Sets the value of the operatingCompany property.
*
* @param value
* allowed object is
* {@link OperatingCompanyType }
*
*/
public void setOperatingCompany(OperatingCompanyType value) {
this.operatingCompany = value;
}
}
実際の出力 -
<LoyaltyDetails>
<Journeys>FIRM_EMP_HERE_QTY|99</Journeys>
</LoyaltyDetails>
<LoyaltyDetails>
<Journeys>FIRM_EMP_HERE_QTY|99</Journeys>
</LoyaltyDetails>
予想される出力 - :
<xs:complexType name="AccountLoyaltyDetail">
<xs:sequence>
<xs:element name="OperatingCompany" type="ns:OperatingCompanyType"
minOccurs="0" />
<xs:element name="Journeys" type="ns:LoyaltyJourneyIdentifier>" />
<xs:element name="Segments" type="ns:LoyaltySegmentIdentifier" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="LoyaltyJourneyIdentifier">
<xs:sequence>
<xs:element name="JourneyIdentifierId" type="xs:string"
minOccurs="0">
<xs:annotation>
<xs:documentation>Free form text to be echoed back in the reply.
Used to match requests and replies.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
がどのように私はここで直接のArrayList型を使用し.Canを一覧表示するように変更します
XSD? – themaster
ありがとう。この場合、私のxsdは何ですか? – themaster
<?xml version = "1.0" encoding = "UTF-8"?> XS:配列> XS:complexTypeの> XS:配列> XS: complexType> –
SundarPichai