• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2636
  • Last Modified:

DomDocument :Call to undefined method domdocument::createElement()

Please does anyone no why I would be getting this when running version 5 of php?

faultCode1faultStringWarning:domdocument::domdocument() expects at least 1 parameter, 0 given in C:\Apache\htdocs\ajax\foundations\phptest.php on line 5faultCode1faultStringFatal error:Call to undefined method domdocument::createElement() in C:\Apache\htdocs\ajax\foundations\phptest.php on line
//set the conte type as xml
header ('content type: text/xml');
// create new XML document
$dom = new DOMDocument();

// create the root <response> element

//create the <boooks> element and append it as a child of response

//create the title element for the book
$titletext=$dom->createTextNode('Builing responsive web applications with PHP and AJAX');

//create isbn element

//create the book element
//append book as a child of books
//build the xml structure is a string variable
//output the xml string
echo $xmlString;


Open in new window

1 Solution
See http://www.php.net/manual/en/domdocument.construct.php#86267
Or use
$dom = new DOMDocument('1.0', 'UTF-8');

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now