Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
September 1, 2008 - Submit Your Web Site for the Sept 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 08, 2008, 09:10:27 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Problem with XML set-up "Call to undefined function: domxml_new_doc()"  (Read 434 times)
almeriastu
Newbie
*
Offline Offline

Posts: 3


« on: April 24, 2008, 05:15:29 AM »

Hi Folks,

Can anyone help me with this problem? I am trying to create an XML document (my first) with PHP and keep getting a fatal error:

Fatal error: Call to undefined function: domxml_new_doc() in . . . . .

My trial code is as follows:-

Code:
<?php
$outer_table 
'parent_table';
$inner_table 'child_table';

// create a new XML document
$doc domxml_new_doc('1.0');

// add root node
$root $doc->create_element('root');
$root $doc->append_child($root);
// add node for parent/outer table
$outer $doc->create_element($outer_table);
$outer $root->append_child($outer);

  
$child $doc->create_element('fieldname');
  
$child $outer->append_child($child);
  
$value $doc->create_text_node('fieldvalue');
  
$value $child->append_child($value);

  
$inner $doc->create_element('inner_table');
  
$inner $outer->append_child($inner);

  
// add a child node for each field
    
$child $doc->create_element('fieldname');
    
$child $inner->append_child($child);
    
$value $doc->create_text_node('fieldvalue');
    
$value $child->append_child($value);

// get completed xml document
$xml_string $doc->dump_mem(true);
echo 
$xml_string;
?>

also tried a different version
Code:
<?php
$doc 
new_xmldoc('1.0');
$root $doc->add_root('members');
$member $root->new_child('member','');

$member->new_child('lastName','John');
$member->new_child('firstName','Adams');
$member->new_child('contribution','3400');

$member $root->new_child('member','');

$member->new_child('lastName','Debra');
$member->new_child('firstName','Hones');
$member->new_child('contribution','2400');

$member $root->new_child('member','');

$member->new_child('lastName','Jake');
$member->new_child('firstName','Tudor');
$member->new_child('contribution','1200');

$fp = @fopen('d:\\testxml\\testfile01.xml','w');
if(!
$fp) {
    die(
'Error cannot create XML file');
}
fwrite($fp,$doc->dumpmem());
fclose($fp);
?>

this one gave the error:

Fatal error: Call to undefined function: new_xmldoc() in . . . . .

. . . . or is there another way?

Any help would be most appreciated.

Thanks
« Last Edit: April 24, 2008, 10:32:51 AM by almeriastu » Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3266



« Reply #1 on: April 24, 2008, 04:40:35 PM »

Do an advanced search for domxml. This thread may also be of interest. As I understand it, if you're on PHP 5 you have DOM, not DOMXML.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM