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
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
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
@@ -29,7 +29,7 @@ $reader->close();
29
29
30
30
The main addition is the `process()` method, rather than looping through the document structure, `process()` is passed an array of regex and associated callback elements. When a particular XML element matches the pattern you are interested in the callback will be passed the data from that element.
31
31
32
-
#How the document hierarchy is encoded
32
+
## How the document hierarchy is encoded
33
33
As the document is loaded, the code builds a simple document hierarchy based on the nesting of the elements. So...
34
34
35
35
```xml
@@ -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...
@@ -98,7 +98,7 @@ will find any `<person>` element and allow an optional suffix for use when multi
98
98
99
99
Also something useful in regex's is capture groups, notice that this last regex is actually `(.*/person(?:\[\d*\])?)` in the code. The capture groups will be passed to the callback.
100
100
101
-
#The callback function
101
+
## The callback function
102
102
The basic callback function definition is
103
103
104
104
```
@@ -152,7 +152,7 @@ When using DOMDocument, the owner of a created node can be important. If you wa
152
152
153
153
If this is not called, all nodes will be owned by an internally created document.
154
154
155
-
#Namespace usage - Matching
155
+
### Namespace usage - Matching
156
156
157
157
```php
158
158
public function setUseNamespaces ( bool $useNamespaces ): void;
0 commit comments