-1
請幫我寫ItemReader()如何使用StaxEventItemReader在Spring Batch的複雜XML
<File>
<FileDate>05/28/2016</FileDate>
<RecordCount>75</RecordCount>
<Transaction>
<RecordID>1</RecordID>
<MemberDetails>
<Id>A2334549</Id>
<MemberDemoData>
<SubID>89890734548557</SubID>
<MemberSuffix>01</MemberSuffix>
<SSN>XXXXX</SSN>
<CategoryCode>B</CategoryCode>
<Gender>F</Gender>
<LastName>Naaz</LastName>
<FirstName>Affu</FirstName>
<MiddleInitial>H</MiddleInitial>
<BirthDate>04/02/1990</BirthDate>
<HICNumber>4567376739A</HICNumber>
<PhoneNumber>894567893</PhoneNumber>
<ProviderID>09678546</ProviderID>
<PCPOverride>N</PCPOverride>
<Address>
<AddressType>HOME</AddressType>
<Address1>2226 Indira nagar RD</Address1>
<City>Noida</City>
<State>Delhi</State>
<Zip>525001</Zip>
<County>India</County>
</Address>
<Address>
<AddressType>MAIL</AddressType>
<Address1>2226 Indira nagar RD</Address1>
<City>Noida</City>
<State>Delhi</State>
<Zip>525001</Zip>
<County>India</County>
</Address>
<AgentInfo>
<MailAgentNo>40</MailAgentNo>
<AgentNo>67894</AgentNo>
</AgentInfo>
</MemberDemoData>
<Package>
<Plan>Yu8883</Plan>
<PlanId>009</PlanId>
<SegmentId>104</SegmentId>
<Group>000987666</Group>
<SubGroup>B004</SubGroup>
<Class>0004</Class>
<PartD>
<BIN>789034</BIN>
<PCN>*******</RxPCN>
</PartD>
<EffectiveDate>09/01/2016/01/2016</EffectiveDate>
<TerminationDate>12/31/2016</TerminationDate>
</Package>
<LICSInfo>
<SubsidyLevel>100</SubsidyLevel>
<CopayCategory>1</CopayCategory>
<SubsidyLevelStartDate>08/11/2016</SubsidyLevelStartDate>
</LICSInfo>
<MedihealthData>
<PartA>
<EffectiveDate>02/01/2008</EffectiveDate>
</PartA>
<PartB>
<EffectiveDate>02/01/2008</EffectiveDate>
</PartB>
<ESignDate>
<EffectiveDate>08/16/2016</EffectiveDate>
</ESignDate>
<ElectionPeriod>S</ElectionPeriod>
<EnrollmentDate>
<EffectiveDate>08/01/2016</EffectiveDate>
</EnrollmentDate>
</MedihealthData>
<BillingData>
<PremiumWithHold>D</PremiumWithHold>
</BillingData>
</MemberDetails>
</Transaction>
<Transaction>
-------
</Transaction>
<Transaction>
------
</Transaction>
<Transaction>
-------
</Transaction>
</File>
我JAXB生成的類文件,事務,MemberDetails,MemberDemoData,地址,AgentInfo,包裝, PartD,LICSInfo,MedihealthData,PartA,PartB,ESignDate,EnrollmentDate,BillingData
現在在下面的ItemReader方法中代替「?」我應該使用什麼類名稱。請幫幫我。
public ItemReader<?> fileXmlReader(@Value("#{stepExecution}") StepExecution stepExecution) {
StaxEventItemReader<?> xmlFileReader = new StaxEventItemReader<>();
xmlFileReader.setResource(new ClassPathResource("/File.xml"));
xmlFileReader.setFragmentRootElementNames(new String[] {?}); (or)
xmlFileReader.setFragmentRootElementName(?)
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setClassesToBeBound(?);
xmlFileReader.setUnmarshaller(marshaller);
return xmlFileReader;
}
任何1,請幫助我在填補ItemReader法 「?」用正確的類名來獲得正確的輸出 – Afreen