Results 1 to 5 of 5

Thread: HowTo: Map inner XML Attributes

  1. #1

    Post 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 at 08:17 PM.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    Have you tried the XStream documentation?

  3. #3

    Default

    Quote 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

  4. #4

    Default

    Quote 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

  5. #5
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    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)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •