Announcement Announcement Module
Collapse
No announcement yet.
HowTo: Map inner XML Attributes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HowTo: Map inner XML Attributes

    Hi,
    I have a XML like this.
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <Record>
    <username>Adish</username>
     <registrants>
        <registrant>
             <entity>
                 <individual>
                       <name>Adish</name>
                        <address>Some Address </address>
                         <city>Some City</city>
                 </individual>
             </entity>
        </registrant>
     </registrants>
              <Check>    
               <individual>
                       <name>Adish</name>
                        <address>Some Address </address>
                         <city>Some City</city>
                 </individual>
             </Check> 
    </Record>
    I have created an Indivisual class but how i will map with XStreamMarshaller

    Any help will be greatly appreciated..

    Thanks
    Last edited by adish1234; Mar 13th, 2009, 09:17 PM.

  • #2
    Have you tried the XStream documentation?

    Comment


    • #3
      Originally posted by Dave Syer View Post
      Have you tried the XStream documentation?
      Hi Dave,
      Thanks for your reply.
      Code:
      <property name="fragmentDeserializer">
      	<bean
      	    class="org.springframework.batch.item.xml.oxm.UnmarshallingEventReaderDeserializer">
      	       <constructor-arg>
      	           <bean class="org.springframework.oxm.xstream.XStreamMarshaller">
      	              <property name="aliases" ref="aliases" />
      	          </bean>
      	       </constructor-arg>
      	  </bean>
          </property>
      
      <util:map id="aliases">
      		<entry key="trust" value="sample.domain.Record" />
      		<entry key="username" value="java.lang.String" />
                              <entry key="individual" value="sample.domain.individual" />
                               <entry key="name" value="java.lang.String" />
                              <entry key="address" value="java.lang.String" />	
                               <entry key="city" value="java.lang.String" />
      My Record class is a simple POJO and field is username and individual class is simple POJO class having fields are name, address and city..

      Thanks again

      Comment


      • #4
        Originally posted by adish1234 View Post
        Hi Dave,
        Thanks for your reply.
        Code:
        <property name="fragmentDeserializer">
        	<bean
        	    class="org.springframework.batch.item.xml.oxm.UnmarshallingEventReaderDeserializer">
        	       <constructor-arg>
        	           <bean class="org.springframework.oxm.xstream.XStreamMarshaller">
        	              <property name="aliases" ref="aliases" />
        	          </bean>
        	       </constructor-arg>
        	  </bean>
            </property>
        
        <util:map id="aliases">
        		<entry key="trust" value="sample.domain.Record" />
        		<entry key="username" value="java.lang.String" />
                                <entry key="individual" value="sample.domain.individual" />
                                 <entry key="name" value="java.lang.String" />
                                <entry key="address" value="java.lang.String" />	
                                 <entry key="city" value="java.lang.String" />
        My Record class is a simple POJO and field is username and individual class is simple POJO class having fields are name, address and city..

        Thanks again
        Hi Dave,
        Can you please help me to resolve my problem...
        Thanks

        Comment


        • #5
          I don't understand what you want to do. If you need to know more about XStream, I was just suggesting that they have their own documentation, and that migh tbe a good place to look. Are you even using Spring Batch (other than the tiny fragment you posted)?

          Comment

          Working...
          X