PHP to generate XML

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm trying to generate xml  from a php program using this code:;

$queryexe="SELECT * FROM cust";

$doc = domxml_new_doc('1.0');
$root = $doc->createElement('root');
$root = $doc->appendChild($root);

while($row= odbc_fetch_row($queryexe))
    foreach ($row as $fieldname => $fieldvalue) {
        $child = $doc->createElement($fieldname);
        $child = $occ->appendChild($child);
        $value = $doc->createTextNode($fieldvalue);
        $value = $child->appendChild($value);
  } // foreach
} // while

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

 This gives the following error:
Fatal error: Call to undefined function: domxml_new_doc() in .......

The domxml.dll is in the extensions folder of my php distribution so i
have no idea what the problem is.
Please help

Re: PHP to generate XML


Quoted text here. Click to load it

Is it enabled in your php.ini? Is it listed in the output of phpinfo()?

And why don't you use this extension instead?

XXX. DOM Functions


Re: PHP to generate XML

I just found the XXX.DOM Functions and i've replaced it with

$doc = new DomDocument('1.0');

still getting fatal error undefined function DomDocument

my phpinfo says XML support is active

Any ideas

Michael Fesser wrote:
Quoted text here. Click to load it

Re: PHP to generate XML

Have you removed the semicolon from the "extension=php_domxml.dll" line in  
your php.ini file? Have you read the manual on how to enable this extension?

Tony Marston

Quoted text here. Click to load it

Site Timeline