Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By SurfMan

Thread: Split multiple records for a single xml

  1. #1
    biplab.nits is offline Member
    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Default Split multiple records for a single xml

    Hi,

    I am new to this forum.

    This is my input XML.

    ` <?xml version="1.0" encoding="UTF-8"?>
    <queryResponse>
    <result>
    <done>true</done>
    <queryLocator xsi:nil="true" />
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwheIAC</sf:Id>
    <sf:SAP_QuoteItemNumber__c>000001</sf:SAP_QuoteItemNumber__c>
    </records>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwhfIA </sf:Id>
    <sf:SAP_QuoteItemNumber__c>000002</sf:SAP_QuoteItemNumber__c>
    </records>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwhgIAC</sf:Id>
    <sf:SAP_QuoteItemNumber__c>000003</sf:SAP_QuoteItemNumber__c>
    </records>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwhhIAC</sf:Id>
    <sf:SAP_QuoteItemNumber__c>000004</sf:SAP_QuoteItemNumber__c>
    </records>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwhiIAC</sf:Id>
    <sf:SAP_QuoteItemNumber__c>000005</sf:SAP_QuoteItemNumber__c>
    </records>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwhjIAC</sf:Id>
    <sf:SAP_QuoteItemNumber__c>000006</sf:SAP_QuoteItemNumber__c>
    </records>
    <size>6</size>
    </result>
    </queryResponse>`

    I have to read this XML and split into 6 XMLper records.
    so output should look like

    1st XML
    `
    <?xml version="1.0" encoding="UTF-8"?>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwheIAC</sf:Id> <sf:SAP_QuoteItemNumber__c>000001</sf:SAP_QuoteItemNumber__c>
    </records>`

    2nd xml

    ` <?xml version="1.0" encoding="UTF-8"?>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id> 00kS0000005RwhfIAC</sf:Id> <sf:SAP_QuoteItemNumber__c>000002</sf:SAP_QuoteItemNumber__c>
    </records>`

    3rd XML

    ` <?xml version="1.0" encoding="UTF-8"?>
    <records xsi:type="sf:OpportunityLineItem">
    <sf:Id>00kS0000005RwhgIAC</sf:Id>
    <sf:SAP_QuoteItemNumber__c>000003</sf:SAP_QuoteItemNumber__c>
    </records>`

    .....
    ....

    so on upto 6th xml.

    Please help , how to get it.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Split multiple records for a single xml

    Moved from Advanced Java.

    Please learn to use the code tags: Guide For New Members and BB Code List - Java Programming Forum - Learn Java Programming

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    732
    Rep Power
    2

Similar Threads

  1. How to add multiple delimiters in split()?
    By rahul405804 in forum Advanced Java
    Replies: 6
    Last Post: 04-05-2012, 01:53 PM
  2. Replies: 2
    Last Post: 06-29-2011, 09:40 AM
  3. JDBC | Unable to update multiple records
    By bittu218 in forum New To Java
    Replies: 5
    Last Post: 06-28-2010, 02:45 PM
  4. Replies: 3
    Last Post: 12-17-2007, 02:35 AM
  5. Query with 1 record vs. multiple records
    By anderma8 in forum JDBC
    Replies: 5
    Last Post: 07-09-2007, 11:33 PM

Tags for this Thread

Posting Permissions

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