Announcement Announcement Module
Collapse
No announcement yet.
XML with attributes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML with attributes

    Hello,

    My XML file looks like below.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <Count>
    	<subCount version="" Date="2007-07-31T10:03:00" newDate="2007-08-01T10:03:00" id="A00001">
    		<Counter id="41015" Number="00001" value="Test">
    			<Code codeNumber="02000" id="">
    				<PurchaseSet>
    					  <Purchase type="0" count="1" code="ABC" value="1.00" /> 
    					  <Purchase type="0" count="1" code="XYZ" value="10.00" /> 
    					  <Purchase type="0" count="1" code="QWE" value="20.00" /> 
    			  </PurchaseSet>
    			  <CounterSet>
    				  <Counter strap="" countercode="123456789123456789" /> 
    				  <Counter strap="" countercode="123456789123456777" /> 
    			  </CounterSet>
    		  </Code>
    
    		  <Code codeNumber="02001" id="">
    			<PurchaseSet>
    				  <Purchase type="0" count="1" code="ABC" value="1.00" /> 
    				  <Purchase type="0" count="1" code="XYZ" value="10.00" /> 
    				  <Purchase type="0" count="1" code="QWE" value="20.00" /> 
    			  </PurchaseSet>
    			  <CounterSet>
    				  <Counter strap="" countercode="123456789123444444" /> 
    				  <Counter strap="" countercode="123456789123455555" /> 
    			  </CounterSet>
    		  </Code>
    		</Counter>
    	</subCount>
    </Count>
    I tried by creating individual class and checked out XStream documentation but could able to get much.

    I need to read this file and write it into a csv file.

    Can any one share some examples if you have. I need to do this ASAP, u r quick response will be highly appreciated

    Thanks

  • #2
    Hello,

    Can anyone give me some idea on this, i m struck with this.
    Pl share some idea or code with me.

    Thanks

    Comment


    • #3
      Your XML doesn't really look much like a Batch input file. Or is this just an example of an entit yfrom a much larger file? Maybe you need to clarify a bit what you are trying to do. Also, as far as XML to object mapping goes, you should read the Spring OXM documentation (since Batch only delegates to that and doesn't do any XML mapping itself).

      Comment


      • #4
        Thanks Dave,
        yes, the XML pasted is just sample entity of a larger file.actual XML file will have n number of <counter> nodes.

        I am able to convert 'Trade' Sample XMl file to CSV file.

        I had gone through Spring OXM documents for Object mapping for attributes and inner nodes for XML,but couldnt able to get much out of it and implement.

        Can you share some examples if you have.

        Thanks

        Comment

        Working...
        X