Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5992071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:28:43+00:00 2026-05-22T23:28:43+00:00

Somthing wrong here, dont seem to be able to merge XML DOMDocumet’s I get

  • 0

Somthing wrong here, dont seem to be able to merge XML DOMDocumet’s I get the error, “Fatal error: Call to undefined method DOMElement::importNode() in C:\xampp\htdocs\xmltest\xmltest.php on line 27” can anybody help me put this code right…

<?php
// include required files
include 'XML/Query2XML.php';
include 'MDB2.php';

// prepare xml document
$dom = new DomDocument('1.0');

// create tables section
$tables = $dom->appendChild($dom->createElement('tables')); 

// create container for tblclients
$tblclients = $tables->appendChild($dom->createElement('tblclients')); 

try {
// initialize Query2XML object
$q2x = XML_Query2XML::factory(MDB2::factory('mysql://root:@localhost/db_solconmgr'));

// generate SQL query
$sql = "SELECT ClientID, Client, Contacts, 'Address Line 1' as AddressLine1, 'Address Line 2' as AddressLine2, City, County, 'Zip Code' as ZipCode, Telephone, Fax, Mobile, 'E-mail Address' as EmailAddress, Date FROM tblclients";

// get results as XML
$tblclientsXML = $q2x->getFlatXML($sql);

//$dom = $tblclientsXML;

$node = $tblclients->importNode($tblclientsXML, true);

// send output to browser
header('Content-Type: text/xml');
$dom->formatOutput = true;
echo $dom->saveXML();
} catch (Exception $e) {
echo $e->getMessage();
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:28:44+00:00Added an answer on May 22, 2026 at 11:28 pm

    importNode() is a method belonging to the document, not an element. You want to import into the document ($dom) then append to the element ($tblclients).

    A node is needed when importing (and $tblclientsXML is not a node, it’s a document) so importing the generated XML would look similar to:

    $tblclientsElement = $tblclientsXML->documentElement;
    $tblclientsXML = $dom->importNode($tblclientsElement, TRUE);
    $tblclients->appendChild($tblclientsXML);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I must be doing something wrong. I can't seem to execute my CustomValidator's ServerValidate
If something goes wrong in a WCF REST call, such as the requested resource
I am trying to achieve something like the following but dont know whats wrong:
I'm probably doing something stupid but I just can't seem to get the permissions
might be a stupid simple solution but I can't seem to find what's wrong
I was wondering if I do something wrong here. here is the ruby 1.9.2
Well something is wrong but i dont know what. I cannot delete a row
Am I doing something wrong or is it not possible to specify a generic
There's something wrong with my code or I'm just not understanding this fully. I
Am I doing something wrong is this a known issue with the ASP.NET MVC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.