1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
split()
{
CMarkup xmlInput, xmlOutput;
xmlInput.Open( "FILEPATH.xml", MDF_READFILE );
// open instead of load for large files
int nObjectCount = 0, nFileCount = 400000;
while ( xmlInput.FindElem("//BG:object") )
{
if ( nObjectCount == 0 )
{
++nFileCount;
xmlOutput.Open( "OUTPUT" + nFileCount + ".xml", MDF_WRITEFILE );
xmlOutput.AddElem("BG:wplLk01 xmlns:BG=\"http://www.egem.nl/StUF/sector/bg/0310\" xmlns:StUF=\"http://www.egem.nl/StUF/StUF0301\"");
xmlOutput.IntoElem();
xmlOutput.AddElem("BG:stuurgegevens");
xmlOutput.IntoElem();
xmlOutput.AddElem("StUF:berichtcode","Lk01");
xmlOutput.AddElem("StUF:zender");
xmlOutput.IntoElem();
xmlOutput.AddElem("StUF:organisatie","Organisation");
xmlOutput.AddElem("StUF:applicatie","SORT");
xmlOutput.OutOfElem();
xmlOutput.AddElem("StUF:ontvanger");
xmlOutput.IntoElem();
xmlOutput.AddElem("StUF:organisatie","Organisation");
xmlOutput.AddElem("StUF:applicatie","DLVY");
xmlOutput.OutOfElem();
xmlOutput.AddElem("StUF:referentienummer","123456789");
xmlOutput.AddElem("StUF:tijdstipBericht","2015051914542378");
xmlOutput.AddElem("StUF:entiteittype","WPL");
xmlOutput.OutOfElem();
xmlOutput.AddElem("BG:parameters");
xmlOutput.IntoElem();
xmlOutput.AddElem("StUF:mutatiesoort","T");
xmlOutput.AddElem("StUF:indicatorOvername","V");
xmlOutput.OutOfElem();
xmlOutput.IntoElem();
}
xmlOutput.AddSubDoc( xmlInput.GetSubDoc() );
++nObjectCount;
if ( nObjectCount == 1 )
{
xmlOutput.Close();
nObjectCount = 0;
}
}
if ( nObjectCount )
xmlOutput.Close();
xmlInput.Close();
return nFileCount;
}
|