You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ The algorithm was written using the XMLParser php library, which is capable of p
9
9
The implementation is Object-oriented, so in order to split the files, an instance of Chunker has to be created first.
10
10
11
11
An example of a simple Chunker instance without validation, with **maximum 100 main tags**/chunk, and with outputfile names of *"out-{CHUNK}.xml"*:
12
-
```
12
+
```php
13
13
$chunkSize = 100;
14
14
$outputFilePrefix = "out-";
15
15
$xmlfile = "bigFile.xml";
@@ -38,7 +38,7 @@ If any of the required parameters are empty/not specified, a Fatal error will be
38
38
### Launch the chunking!
39
39
40
40
After you created an instance of Chunker, and all the parameters were set, you can start the chunking process. You can do this with the `Chunker::chunkXML` method. An example is shown below:
41
-
```
41
+
```php
42
42
// ... the instance is created in $chunker
43
43
$chunker.chunkXML("item", "root");
44
44
```
@@ -50,7 +50,7 @@ THe method returns the logging session's string conversion (see below for more i
50
50
## Logging
51
51
52
52
The class has an implemented logging feature. Everytime the `Chunker::chunkXML` is run, a new logging session is launched, which can be retrieved with the very same function. After its run, it returns the logging session converted into string:
53
-
```
53
+
```php
54
54
// ...
55
55
$log = $chunker.chunkXML(....);
56
56
echo $log;
@@ -71,7 +71,7 @@ It is really helpful, when something is not working for your needs, and has to b
71
71
72
72
Lets say, that you have an XML file (*"feed.xml"*) with a **Shop** root element, and multiple **shopItem** elements inside it (10.000+). You want it to split into files named *"feed-{chunk}.xml"* containing 1000 **shopItem**s maximum. And you also want to only include **shopItem**s, that has a *weight_kg* tag inside, which can only be greater than 10 (or '10 kgs'). The solution is like the following:
0 commit comments