|
Home > Archive > BizTalk Server General > April 2005 > Splitting an XMl file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Splitting an XMl file
|
|
|
| Hi,
I want to split a large XML file which contains multiple records into
smaller XML files with groups of records.
eg: My parent XML may be like
<Customers>
<Customer>
<CustomerID>1</CustomerID>
<Name>Customer 1</Name>
</Customer>
<Customer>
<CustomerID>2</CustomerID>
<Name>Customer 2</Name>
</Customer>
<Customer>
<CustomerID>3</CustomerID>
<Name>Customer 3</Name>
</Customer>
<Customer>
<CustomerID>4</CustomerID>
<Name>Customer 4</Name>
</Customer>
<Customer>
<CustomerID>5</CustomerID>
<Name>Customer 5</Name>
</Customer>
</Customers>
I want to split it into multiple files with each having a maximum of 2
records (this 2 should be configurable).
So, in the above case I should get 3 files like :-
File 1.
<Customers>
<Customer>
<CustomerID>1</CustomerID>
<Name>Customer 1</Name>
</Customer>
<Customer>
<CustomerID>2</CustomerID>
<Name>Customer 2</Name>
</Customer>
</Customers>
AND File 2.
<Customers>
<Customer>
<CustomerID>3</CustomerID>
<Name>Customer 3</Name>
</Customer>
<Customer>
<CustomerID>4</CustomerID>
<Name>Customer 4</Name>
</Customer>
</Customers>
AND File 3.
<Customers>
<Customer>
<CustomerID>5</CustomerID>
<Name>Customer 5</Name>
</Customer>
</Customers>
I have found a way to split the large file into multiple files with each
file having only a single record in it.
[http://weblogs.asp.net/jan/archive/...3/07/85259.aspx]
I want to have multiple records in one file.
Please help.
Thanks in advance,
Gopakumar R
| |
| Stephen W. Thomas 2005-04-28, 2:47 am |
| Hello.
I have a sample here
(http://www.geekswithblogs.net/sthom...3/21/26924.aspx) that
can break up a message into any size of output. It works better with smaller
messages (less then a few MB total size).
Let me know if you have any additional questions.
Hope this helps.
Stephen W. Thomas
http://www.geekswithblogs.net/sthomas
"Gopz" wrote:
> Hi,
> I want to split a large XML file which contains multiple records into
> smaller XML files with groups of records.
>
> eg: My parent XML may be like
>
> <Customers>
> <Customer>
> <CustomerID>1</CustomerID>
> <Name>Customer 1</Name>
> </Customer>
> <Customer>
> <CustomerID>2</CustomerID>
> <Name>Customer 2</Name>
> </Customer>
> <Customer>
> <CustomerID>3</CustomerID>
> <Name>Customer 3</Name>
> </Customer>
> <Customer>
> <CustomerID>4</CustomerID>
> <Name>Customer 4</Name>
> </Customer>
> <Customer>
> <CustomerID>5</CustomerID>
> <Name>Customer 5</Name>
> </Customer>
> </Customers>
>
> I want to split it into multiple files with each having a maximum of 2
> records (this 2 should be configurable).
> So, in the above case I should get 3 files like :-
>
> File 1.
>
> <Customers>
> <Customer>
> <CustomerID>1</CustomerID>
> <Name>Customer 1</Name>
> </Customer>
> <Customer>
> <CustomerID>2</CustomerID>
> <Name>Customer 2</Name>
> </Customer>
> </Customers>
>
> AND File 2.
>
> <Customers>
>
> <Customer>
> <CustomerID>3</CustomerID>
> <Name>Customer 3</Name>
> </Customer>
> <Customer>
> <CustomerID>4</CustomerID>
> <Name>Customer 4</Name>
> </Customer>
> </Customers>
>
> AND File 3.
>
> <Customers>
> <Customer>
> <CustomerID>5</CustomerID>
> <Name>Customer 5</Name>
> </Customer>
> </Customers>
>
> I have found a way to split the large file into multiple files with each
> file having only a single record in it.
> [http://weblogs.asp.net/jan/archive/...3/07/85259.aspx]
>
> I want to have multiple records in one file.
> Please help.
>
> Thanks in advance,
> Gopakumar R
>
| |
|
| Hi Stephen,
Thanks for your help.
I have downloaded the code you had provided, its working fine. But, my
requirement is to split the files inside the receive pipeline itself. ie;
before the message is placed in the MessageBox by the receive pipeline, I
want the file to be splitted.
So, I need the splitting to be happened inside the receive pipeline itself.
Expecting your valuable suggestions/comments.
"Stephen W. Thomas" wrote:
[vbcol=seagreen]
> Hello.
>
> I have a sample here
> (http://www.geekswithblogs.net/sthom...3/21/26924.aspx) that
> can break up a message into any size of output. It works better with smaller
> messages (less then a few MB total size).
>
> Let me know if you have any additional questions.
>
> Hope this helps.
>
> Stephen W. Thomas
> http://www.geekswithblogs.net/sthomas
>
>
> "Gopz" wrote:
>
| |
| Stephen W. Thomas 2005-04-28, 5:55 pm |
| Hello.
Ok, that will take a little more effort then what I used to build the
Orchestration sample.
I’m sure it can be done inside a custom pipeline component, just I have not
seen any samples that do it. Sorry I can not help you more on this one.
Stephen W. Thomas
http://www.geekswithblogs.net/sthomas
"Gopz" wrote:
[vbcol=seagreen]
> Hi Stephen,
> Thanks for your help.
> I have downloaded the code you had provided, its working fine. But, my
> requirement is to split the files inside the receive pipeline itself. ie;
> before the message is placed in the MessageBox by the receive pipeline, I
> want the file to be splitted.
>
> So, I need the splitting to be happened inside the receive pipeline itself.
> Expecting your valuable suggestions/comments.
>
>
>
> "Stephen W. Thomas" wrote:
>
|
|
|
|
|