1 | <?php |
||
13 | class XMLReader extends \XMLReader |
||
14 | { |
||
15 | use XMLInternalErrorsHelper; |
||
16 | |||
17 | const ZIP_WRAPPER = 'zip://'; |
||
18 | |||
19 | /** |
||
20 | * Opens the XML Reader to read a file located inside a ZIP file. |
||
21 | * |
||
22 | * @param string $zipFilePath Path to the ZIP file |
||
23 | * @param string $fileInsideZipPath Relative or absolute path of the file inside the zip |
||
24 | * @return bool TRUE on success or FALSE on failure |
||
25 | */ |
||
26 | 291 | public function openFileInZip($zipFilePath, $fileInsideZipPath) |
|
40 | |||
41 | /** |
||
42 | * Returns the real path for the given path components. |
||
43 | * This is useful to avoid issues on some Windows setup. |
||
44 | * |
||
45 | * @param string $zipFilePath Path to the ZIP file |
||
46 | * @param string $fileInsideZipPath Relative or absolute path of the file inside the zip |
||
47 | * @return string The real path URI |
||
48 | */ |
||
49 | 297 | public function getRealPathURIForFileInZip($zipFilePath, $fileInsideZipPath) |
|
53 | |||
54 | /** |
||
55 | * Returns whether the file at the given location exists |
||
56 | * |
||
57 | * @param string $zipStreamURI URI of a zip stream, e.g. "zip://file.zip#path/inside.xml" |
||
58 | * @return bool TRUE if the file exists, FALSE otherwise |
||
59 | */ |
||
60 | 306 | protected function fileExistsWithinZip($zipStreamURI) |
|
78 | |||
79 | /** |
||
80 | * Move to next node in document |
||
81 | * @see \XMLReader::read |
||
82 | * |
||
83 | * @return bool TRUE on success or FALSE on failure |
||
84 | * @throws \Box\Spout\Reader\Exception\XMLProcessingException If an error/warning occurred |
||
85 | */ |
||
86 | 306 | public function read() |
|
96 | |||
97 | /** |
||
98 | * Read until the element with the given name is found, or the end of the file. |
||
99 | * |
||
100 | * @param string $nodeName Name of the node to find |
||
101 | * @return bool TRUE on success or FALSE on failure |
||
102 | * @throws \Box\Spout\Reader\Exception\XMLProcessingException If an error/warning occurred |
||
103 | */ |
||
104 | 249 | public function readUntilNodeFound($nodeName) |
|
113 | |||
114 | /** |
||
115 | * Move cursor to next node skipping all subtrees |
||
116 | * @see \XMLReader::next |
||
117 | * |
||
118 | * @param string|void $localName The name of the next node to move to |
||
119 | * @return bool TRUE on success or FALSE on failure |
||
120 | * @throws \Box\Spout\Reader\Exception\XMLProcessingException If an error/warning occurred |
||
121 | */ |
||
122 | 105 | public function next($localName = null) |
|
132 | |||
133 | /** |
||
134 | * @param string $nodeName |
||
135 | * @return bool Whether the XML Reader is currently positioned on the starting node with given name |
||
136 | */ |
||
137 | 303 | public function isPositionedOnStartingNode($nodeName) |
|
141 | |||
142 | /** |
||
143 | * @param string $nodeName |
||
144 | * @return bool Whether the XML Reader is currently positioned on the ending node with given name |
||
145 | */ |
||
146 | 105 | public function isPositionedOnEndingNode($nodeName) |
|
150 | |||
151 | /** |
||
152 | * @param string $nodeName |
||
153 | * @param int $nodeType |
||
154 | * @return bool Whether the XML Reader is currently positioned on the node with given name and type |
||
155 | */ |
||
156 | 303 | private function isPositionedOnNode($nodeName, $nodeType) |
|
166 | } |
||
167 |