Results 1 to 3 of 3

Thread: XML, how to set value of node

  1. #1
    Join Date
    Jan 2017
    Location
    Vigo
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: XML, how to set value of node

    Hi everyone!

    I am trying to establish the value of a node like this.

    Qt Code:
    1. QDomElement name_loc = document.createElement("Name");
    2. document.createTextNode("Hola Mundo");
    3. name_loc.setNodeValue("AA_upatetext");
    4. location_init.appendChild(name_loc);
    To copy to clipboard, switch view to plain text mode 

    But it doesn't work.

    Node is empty.

    I see this link
    http://www.qtcentre.org/threads/1439...in-xml-docment

    But I don't see clear enough.

    Could you help me with this?


    Added after 26 minutes:


    Sorry, I already found the error.

    I need to create QDomText and after appendChild to Node like:

    [node]

    QDomElement name_loc = document.createElement("Name");
    QDomText name_loc_text = document.createTextNode(QString(def_name));
    name_loc.appendChild(name_loc_text);
    location_init.appendChild(name_loc);

    [/node]
    Last edited by ivanotero76; 17th January 2017 at 14:06.

  2. #2
    Join Date
    Jun 2012
    Posts
    41
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Thumbs up Re: XML, how to set value of node

    Hi, everyone.

    See this video.
    I hope that help you.

    https://www.youtube.com/watch?v=IrFOM0azfxQ

  3. #3
    Join Date
    Jan 2017
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: XML, how to set value of node

    Thanks for sharing the video.

Similar Threads

  1. How to get a whole node of Xml as text
    By rawfool in forum Newbie
    Replies: 3
    Last Post: 18th August 2014, 18:48
  2. Designing a Node Editor (Hint: Blender Node Editor)
    By Mind Calamity in forum Qt Programming
    Replies: 4
    Last Post: 5th October 2011, 17:22
  3. elastic node re-engineering
    By sajis997 in forum Newbie
    Replies: 5
    Last Post: 6th August 2011, 01:05
  4. how to justfy a node is leaf node or not
    By weixj2003ld in forum Qt Programming
    Replies: 4
    Last Post: 9th April 2009, 08:40
  5. remove node in xml file
    By mattia in forum Newbie
    Replies: 1
    Last Post: 6th March 2008, 14:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.