QT DOMXml - Change the name of a node

QT DOMXml - Change the name of a node

By : electroplasma
Date : November 20 2020, 11:01 PM
may help you . You could use setTagName and maybe setAttribute if you want to set a value for the name attribute.
With the following example, myxml.xml is converted to xmlout.xml
code :
<window name="">
<element x="" y=""/>
<element1 a="" b=""/>
<window name="">
<element x="" y=""/>
<element1 a="" b=""/>
    <group name="value">
        <element y="" x=""/>
        <element1 a="" b=""/>
    <window name="">
        <element y="" x=""/>
        <element1 a="" b=""/>
#include <iostream>
#include <QtXml>
#include <QFile>

int main(int argc, char *argv[])
    QDomDocument doc;
    // Load xml file as raw data
    QFile inFile(":myxml.xml");
    if (!inFile.open(QIODevice::ReadOnly ))
        std::cerr << "Error - inFile: " << inFile.errorString().toStdString();
        return 1;
    // Set data into the QDomDocument before processing

    // Get element in question
    QDomElement root = doc.documentElement();
    QDomElement nodeTag = root.firstChildElement("window");



    // Save the modified data
    QFile outFile("xmlout.xml");
    if (!outFile.open(QIODevice::WriteOnly ))
        // Error while loading file
        std::cerr << "Error - outFile: " << outFile.errorString().toStdString();
        return 1;

    QTextStream stream;

    return 0;

Share : facebook icon twitter icon


By : user755729
Date : March 29 2020, 07:55 AM
I wish did fix the issue. In PHP5 the DOMXML was replaced by DOM:
DomXML xpath what do I do next?

DomXML xpath what do I do next?

By : cmbData
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further print_r - ing a DOMNodeList (or any of the DOM-classes) doesn't do you much good: they're mostly implemented at C / Libxml2 level, and not natively exposed to PHP. As far as I can tell, this will work, add this after your query, and see if you get results:
code :
foreach($res as $node){
domxml new doc function issue in php

domxml new doc function issue in php

By : h.f.
Date : March 29 2020, 07:55 AM
To fix the issue you can do Using mysqli and DOMDocument you should be able to do the same with the following - though it's not tested.
code :

    $dbhost =   'localhost';
    $dbuser =   'root'; 
    $dbpwd  =   'xxx'; 
    $dbname =   'xxx';
    $db =   new mysqli( $dbhost, $dbuser, $dbpwd, $dbname );

    $sql='select * from `markers`;';
    $result=$db->query( $sql );


    $dom=new DOMDocument('1.0','utf-8');

    $dom->appendChild( $root );

    while( $rs=$result->fetch_object() ){
        $root->appendChild( $node );

        foreach( $attribs as $attrib ){
            $attr = $dom->createAttribute( $attrib );
            $value= $dom->createTextNode( $rs->$attrib );
            $attr->appendChild( $value );
            $node->appendChild( $attr );

    header("Content-Type: application/xml");
    echo $dom->saveXML();

Enabling domxml in php

Enabling domxml in php

By : user3906143
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further DOMXML is the old PHP4 XML extension and no longer bundled with PHP5. You have to get it from PECL:
php domxml error with google map

php domxml error with google map

By : Emily Wilhem
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , There are two common ways to do this.
Related Posts Related Posts :
  • How could I link the Boost (not in usr/include) in CMakeList.txt using find_package
  • C++, Linker Issue returning undefined reference
  • Can you use std::string in a 3rd party dll?
  • Why does this use of std::sort with a custom comparator not compile?
  • Fixed base address in MSVC2015
  • Armadillo C++ Matrix Library - simplest way to initialize all values in a matrix to 999?
  • How do you end while loop
  • C++ Basic While Loop: Unknown Inputs and Value Increment
  • Cmake build failed with CMAKE_AR-NOTFOUND (cr exe not found)
  • c++ typeid on class member operator() overloads
  • Different size of string showing when going by two different methods
  • what the meaning "source of entropy of sth." on stack
  • wxWidgets - wxStyledTextCtrl - Text alignment RTL
  • get the entry point to a 64bit process memory from a 32bit process
  • Stroustrup: For C++, how do I install FLTK library?
  • Getting a word after a certain character?
  • How can I convert a char vector to a char array?
  • Comparing vectors of different length c++
  • How do I add four seperate times together?
  • How to replace data in a certain node in a linked list?
  • Prepared statements in C++ libneo4j_client?
  • FindFirstVolume does not return EFI system partition
  • User Inputs Value, but Arbitrary Value Printed to Screen. Printed Value doesn't Match Entered Value
  • How to work with std::make_unique function and interface classes?
  • Refresh image in command line (C++)
  • How to flip a Char array with pointers in C++
  • Outputting time in minutes and seconds C++
  • Creating a for loop to continue to count
  • how to get to field of 2D object dynamic array?
  • Multiple class object share common variable
  • Why is my multi-threaded program not terminating properly?
  • How do I open a file in C++ using just the filename?
  • Using undeclared list as argument in c++
  • While loop won't continue
  • If/else if always goes to else statement
  • Why shared_timed_mutex is defined in c++14, but shared_mutex in c++17?
  • Confused by pipes. 'cat -A' seems to filter out part of output
  • Cannot open source file gtest/gtest.h
  • How to get a certain word in string of getline?
  • glGetShaderInfoLog to std::string?
  • Read in a certain line only?
  • C++ Vector read access violation Mylast returned 0x8
  • In C++ why is ifstream getline returning every other number in my .txt file, rather than all of them?
  • Can't convert string to int in return. No string variable declared whatsoever in int returning function getsocial()
  • Segmentation fault due to size() function of self-implemented data structure in C++
  • i need help making this little c++ program work
  • Template function wrapper
  • static variable in #define directive c++
  • In Qt MainWindow, why does an instance have a pointer to an instance?
  • OpenGL glDrawElements
  • Trying to disable a function if any type of list is passed in
  • make a variable inaccessible in a certain scope, possible?
  • Implement Node Addon in Xcode
  • Controlling compiler directive in file from other file C++
  • QSqlQuery INSERT statement with sqlite3
  • Why doesn't clang/llvm optimize this?
  • STL map declaration in c++
  • No warning, when passing a member variable by (const) reference to a non-const member function
  • I got the first size working but can't set the size for my other constructors
  • Vulkan error: Cannot submit cmd buffer using deleted buffer 0x0
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com