BizTalk Server will split up your documents for you.
Lots of people have asked me how you split up a documents. You don't have to write code for this it is a built in feature of the parsers in BizTalk Server. For example check out this sample .txt document. It has a header (Northwind Shipping) and multiple purchase orders (PO1999-10-20 and PO1999-10-21) and a trailer (END OF RECORD).
“Northwind Shipping
PO1999-10-20
US Alice Smith 123 Maple Street Mill Valley CA 90952
US Robert Smith 8 Oak Avenue Old Town PA 95819
Hurry, my lawn is going wild!
ITEMS,ITEM872-AA|Lawnmower|1|148.95|Confirm this is electric,ITEM926-AA|Baby Monitor|1|39.98|Confirm this is electric|1999-10-21
PO1999-10-21
US John Dow 123 Elm Street Mill Valley CA 90952
US July Dow 8 Pine Avenue Old Town PA 95819
Please ship it urgent!
ITEMS,ITEM398-BB|Tire|4|324.99|Wrap them up nicely,ITEM201-BB|Engine Oil|1|12.99|SAE10W30|1999-05-22
1234567“
In the XML dissassembler you can a schema for the header (Northwind Shipping), the envelope (the repeating unit), and the document (specification) and the trailer (1234567).
For more details check out the SDK sample in C:\Program Files\Microsoft BizTalk Server 2004\SDK\Samples\Pipelines\AssemblerDisassembler\EnvelopeProcessing.