runei Posted November 11, 2008 Share Posted November 11, 2008 I am not sure if this is the right place to post it but here it goes. I get an error like the one under when i posted my site on freehostia server. It is working on my localhost after i enabeled the extension=php_xsl.dll file to process xml with xslt. Line 25 : $dom = new DomDocument('1.0', 'UTF-16'); Line 28 : $root = $dom->createElement('Myarticles', ''); Warning: domdocument() expects parameter 2 to be long, string given in /home/www/.....net/articles/includes/writingDOM.php on line 25 Fatal error: Call to undefined function: createelement() in /home/www/.....net/articles/includes/writingDOM.php on line 28 Here is the original file <?php /** * Henter id hvis den eksisterer */ $id = ($_GET['id']); /** * For eksempelets skyld sammenlignes id i SESSION med userid(FK) i forum_topics. Her har man da tilgang på alle felt til eksisterende session(userid), * forutsatt at session(userid) eksisterer. */ if ($id){ $sql = "SELECT * FROM forum_topics WHERE userid='".$_SESSION['userid']."'"; $result = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($result) == 0){ echo "You have not published any articles"; }else{ /** * Lager et nytt xml dokument basert på hva man måtte ønske å vise i xml format fra tabellen forum_topics. * UTF-16 må brukes ettersom UTF-8 gir feilmelding. */ $dom = new DomDocument('1.0', 'UTF-16'); $root = $dom->createElement('Myarticles', ''); $root = $dom->appendChild($root); while ($row = mysql_fetch_assoc($result)) { $category = $dom->createElement('category', ''); $category = $root->appendChild($category); $category->setAttribute('id', $row['id']); # $user = $dom->createElement('user', $row['id']); $title = $dom->createElement('title', $row['title']); $title = $category->appendChild($title); $message = $dom->createElement('message', $row['message']); $message = $category->appendChild($message); } $dom->save('Myarticles.xml'); } } ?> <?php /** * Laster inn xsl og xml filen. xsltprosessoren prosesserer begge slik at det er mulig å se resultatet i xhtml format i browser. */ $DOMxsl = new DOMDocument(); $DOMxsl->load('Myarticles.xsl'); $proc = new XSLTProcessor; $xsl = $proc->importStylesheet($DOMxsl); $DOMxml = new DOMDocument(); $DOMxml->load('Myarticles.xml'); $result = $proc->transformToXml($DOMxml); print $result; ?> thx runei Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/ Share on other sites More sharing options...
bobbinsbro Posted November 11, 2008 Share Posted November 11, 2008 i suggest you read the user-notes at the bottom of this page: http://us2.php.net/manual/en/domdocument.construct.php the most relevant of which may be this remark: Make sure that php_domxml.dll on windows is removed before using the domdocument class as they cannot coexist. Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/#findComment-687906 Share on other sites More sharing options...
rhodesa Posted November 11, 2008 Share Posted November 11, 2008 yup...that is probably your problem...it's also documented here: http://bugs.php.net/bug.php?id=32743&edit=1 Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/#findComment-687908 Share on other sites More sharing options...
runei Posted November 11, 2008 Author Share Posted November 11, 2008 What do i do to make the extension=php_domxml.dll inactive? I have no idea, contact the host or? Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/#findComment-687915 Share on other sites More sharing options...
bobbinsbro Posted November 11, 2008 Share Posted November 11, 2008 if you have access to the php.ini, i think just commenting out the extension will work. otherwise, i guess you should contact the host , and see what they are willing to do. Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/#findComment-687919 Share on other sites More sharing options...
runei Posted November 11, 2008 Author Share Posted November 11, 2008 Ok. I will check it out. Thx for the help guys Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/#findComment-687920 Share on other sites More sharing options...
runei Posted November 11, 2008 Author Share Posted November 11, 2008 Freehostia has screwed me over yet again. This is the answer i got from them: Hello. I want this file : extension=php_domxml.dll removed (commented out)but i dont have access to the php.ini file so i tried to make one of my own and commented out the file. But on my webpage i get the same problem when i am trying to write xml with xslt, so it does not work. More specific, this is the problem: http://bugs.php.net/bug.php?id=32743&edit=1 Can you remove the file from php.ini so my page will work? thx This was their reply: Hello, Thank you for contacting our Technical Support Department. I have investigated this issue for you and it appears that this would not be possible. I am afraid that you will not be able to use these scripts with your account with us. Best Regards, .. Bye bye freehostia Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/#findComment-687976 Share on other sites More sharing options...
rhodesa Posted November 11, 2008 Share Posted November 11, 2008 Check out SimpleXML Link to comment https://forums.phpfreaks.com/topic/132316-solved-php-dom/#findComment-688012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.