Hi all,
i am currently trying to read in quite complex xmls and am suffering from a couple of unsolved issues. The XML has different nodes (e.g. "stats_session", "map_info" or "team", some with child elements and /or attributes).
xml.jpg
This is, how my reader is currently configured:
My questions now are:Code:<bean id="xmlSessionLogItemReader" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="fragmentRootElementName" value="stats_session" /> <property name="unmarshaller" ref="xmlSessionLogMarshaller" /> </bean> <bean id="xmlSessionLogMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"> <property name="aliases"> <util:map id="aliases"> <entry key="stats_session" value="com.crytek.dwh.etl.sources.warface.domain.XmlSessionLog" /> <entry key="map_info" value="com.crytek.dwh.etl.sources.warface.domain.XmlSessionLogMapInfo" /> <entry key="team" value="com.crytek.dwh.etl.sources.warface.domain.XmlSessionLogTeam" /> </util:map> </property> <property name="useAttributeFor"> <util:map id="useAttributeFor"> <entry key="cpu_time_kernel"> <value type="java.lang.Class">com.crytek.dwh.etl.sources.warface.domain.XmlSessionLog</value> </entry> </util:map> </property> <property name="omittedFields"> <util:map id="omittedFields"> <entry key="com.crytek.dwh.etl.sources.warface.domain.XmlSessionLog" value="timelines,round" /> <entry key="com.crytek.dwh.etl.sources.warface.domain.XmlSessionLogMapInfo" value="sublevel" /> <entry key="com.crytek.dwh.etl.sources.warface.domain.XmlSessionLogTeam" value="timelines" /> </util:map> </property> </bean>
How do i achieve that XmlSessionLogMapInfo and XmlSessionLogTeam are injected into XmlSessionLog so i can use the latter's getter methods to retrieve those object?
Also i am not yet sure how to retrieve the attributes (e.g. cpu_time_kernel").
Sorry if my questions seem to be nonsense but i am still not too familiar with Spring / Spring Batch.
Thanks in advance.


Reply With Quote