note 103361 added to domimplementation.createdocumenttype
| From: | until-all-bytes-are-free at example dot org | Date: | Sat, 09 Apr 2011 11:28:21 +0000 |
| Subject: | note 103361 added to domimplementation.createdocumenttype | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178657@lists.php.net to get a copy of this message | ||
I had problems to use a DTD from a file. It needed to be resolved relatively and it contained
characters that made DomDocument failed to resolve the file.
Encoding and an absolute filename did not help much. So I used the data:// streamwrapper ( http://php.net/manual/en/wrappers.data.php )
as a work-around:
<?php
// relative or absolute filename
$path = '...';
// convert file contents into a filename
$data = file_get_contents($path);
$systemId = 'data://text/plain;base64,'.base64_encode($data);
// ...
// Creates a DOMDocumentType instance
$dtd = $aImp->createDocumentType('qualified name', '', $systemId);
?>
Works like a charm.
----
Server IP: 69.147.83.197
Probable Submitter: 79.225.61.222
----
Manual Page -- http://www.php.net/manual/en/domimplementation.createdocumenttype.php
Edit -- https://master.php.net/note/edit/103361
Del: integrated -- https://master.php.net/note/delete/103361/integrated
Del: useless -- https://master.php.net/note/delete/103361/useless
Del: bad code -- https://master.php.net/note/delete/103361/bad+code
Del: spam -- https://master.php.net/note/delete/103361/spam
Del: non-english -- https://master.php.net/note/delete/103361/non-english
Del: in docs -- https://master.php.net/note/delete/103361/in+docs
Del: other reasons-- https://master.php.net/note/delete/103361
Reject -- https://master.php.net/note/reject/103361
Search -- https://master.php.net/manage/user-notes.php