Reply to Re: XML DOM Setup with PHP

Your name:

Reply:


Posted by Janwillem Borleffs on 11/10/05 22:34

fionathomson wrote:
> As suggested I have added the version to the constructor. I am now
> getting a new error message:
>
> Warning: domdocument(): Start tag expected, '<' not found in test.php
> on line 4
>

It appears that the implementation doesn't follow the documentation: the
first argument supplied must be a valid xml document.

The following appears to work fine:

$dom = new DomDocument('<root />');

This will create a document with like the following:

<?xml version="1.0"?>
<root/>

If you want to set the encoding, you can do the following:

$dom = new DomDocument(
'<?xml version="1.0" encoding="utf-8"?><root />'
);

This will create the following document:

<?xml version="1.0" encoding="utf-8"?>
<root/>


HTH;
JW

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация