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
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
-
###XMLReaderReg
1
+
# XMLReaderReg
2
2
An extension of PHP's XMLReader to include a simplified interface.
3
3
4
-
#Quick Start
4
+
### Quick Start
5
5
6
6
Rather than having to use boiler plate code to fetch particular elements, XMLReaderReg allows you to register an interest in certain elements along with a callback. This effectively changes it from a pull parser to a push parser.
7
7
@@ -81,7 +81,7 @@ will produce the following tree...
81
81
/root/firstname[1]
82
82
```
83
83
84
-
#Regex matching
84
+
### Regex matching
85
85
The matching process is as simple as working out where the data you want lies in the document. You can be as explicit or as vague as you wish using regex's ability to match the content of the above hierarchy.
86
86
87
87
From the quick start sample code...
@@ -101,7 +101,7 @@ Also something useful in regex's is capture groups, notice that this last regex
101
101
#The callback function
102
102
The basic callback function definition is
103
103
104
-
```php
104
+
```
105
105
function (mixed $data[, mixed $path]): void {}
106
106
```
107
107
@@ -141,9 +141,9 @@ The capture group(s) from the regex.
141
141
142
142
If you don't use capture groups, you can omit the `$path` parameter. If you do use capture groups, then it will pass an array which is the return value of `$matches` from [preg_match()](https://www.php.net/manual/en/function.preg-match.php) which is used internally to check the path against the regex patterns.
143
143
144
-
##Options
144
+
##Options
145
145
146
-
#DOM Document owner
146
+
### DOM Document owner
147
147
148
148
```php
149
149
public function setDocument ( DOMDocument $doc ): void;
@@ -178,7 +178,7 @@ set to `false`, it will generate a path hierarchy of
178
178
/root
179
179
/root/person
180
180
```
181
-
#Namespace usage - Output
181
+
### Namespace usage - Output
182
182
183
183
```php
184
184
public function setOutputNamespaces ( bool $outputNamespace ) : void;
@@ -187,7 +187,7 @@ If you don't need/want the namespaces in the output, calling this with `false` w
187
187
188
188
Due to the processing this will incur an overhead.
189
189
190
-
#Configuring array notation
190
+
### Configuring array notation
191
191
By default array notation is turned off, this will present duplicated elements as
192
192
193
193
```
@@ -209,7 +209,7 @@ Calling this with `false` will stop the generation of array indicies when matchi
209
209
/root/firstname
210
210
/root/firstname[1]
211
211
```
212
-
#Stop the processing
212
+
### Stop the processing
213
213
214
214
```php
215
215
public function flagToStop () : void;
@@ -225,12 +225,12 @@ function (DOMElement $data, $path)
225
225
$reader->flagToStop();
226
226
}
227
227
```
228
-
##Examples
228
+
##Examples
229
229
examples/XMLReaderBasic.php has a brief set of examples on how to use XMLReaderReg
230
230
231
-
##Tests
231
+
##Tests
232
232
tests/XMLReaderRegTest.php is a PHPUnit test set for XMLReaderReg.
233
233
234
234
Please note that `testFetchLargeFullRead` reads a 25MB XML file so will take some time to complete.
0 commit comments