| @@ 62-74 (lines=13) @@ | ||
| 59 | return new php4DOMDocument(); |
|
| 60 | } |
|
| 61 | ||
| 62 | function domxml_open_file($filename, $mode = DOMXML_LOAD_PARSING, &$error = null) |
|
| 63 | { |
|
| 64 | $dom = new php4DOMDocument($mode); |
|
| 65 | $errorMode = (func_num_args() > 2) && defined('LIBXML_VERSION'); |
|
| 66 | if ($errorMode) { |
|
| 67 | libxml_use_internal_errors(true); |
|
| 68 | } |
|
| 69 | if (!$dom->myDOMNode->load($filename)) { |
|
| 70 | $dom = null; |
|
| 71 | } |
|
| 72 | if ($errorMode) { |
|
| 73 | $error = array_map('_error_report', libxml_get_errors()); |
|
| 74 | libxml_clear_errors(); |
|
| 75 | } |
|
| 76 | return $dom; |
|
| 77 | } |
|
| @@ 79-91 (lines=13) @@ | ||
| 76 | return $dom; |
|
| 77 | } |
|
| 78 | ||
| 79 | function domxml_open_mem($str, $mode = DOMXML_LOAD_PARSING, &$error = null) |
|
| 80 | { |
|
| 81 | $dom = new php4DOMDocument($mode); |
|
| 82 | $errorMode = (func_num_args() > 2) && defined('LIBXML_VERSION'); |
|
| 83 | if ($errorMode) { |
|
| 84 | libxml_use_internal_errors(true); |
|
| 85 | } |
|
| 86 | if (!$dom->myDOMNode->loadXML($str)) { |
|
| 87 | $dom = null; |
|
| 88 | } |
|
| 89 | if ($errorMode) { |
|
| 90 | $error = array_map('_error_report', libxml_get_errors()); |
|
| 91 | libxml_clear_errors(); |
|
| 92 | } |
|
| 93 | return $dom; |
|
| 94 | } |
|