You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, December 3rd 2011, 1:39pm

Update attribute value in XML using QdomDocument supported functions

Hello,

I am using QDomDocument supported functions to update attributes of XML element but not successful :(

ex: sample XML file below

<Terminal>

<address> Some text </address>

<Ethernet port = " " baudrate = " "/>

</Terminal>


With below line, I am able to edit 'address' element text value.

firstChildElement("address").firstChild().setNodeValue("XYZ");



But, I am not able to update attributes value for 'Ethernet' element, I mean I want to update 'port' and 'baudrate' values. Can someone please help me.

I have above question when I am trying to update the existing XML file.

This post has been edited 1 times, last edit by "mohan.ostfold" (Dec 6th 2011, 2:29pm) with the following reason: mistakes in the post


2

Tuesday, December 6th 2011, 2:31pm

eID_attribute = eID.firstChildElement("Ethernet");
eID_attribute.setAttribute("Port", "XXXX");
eID_attribute.setAttribute("baudrate", "XXXX");

3

Wednesday, December 7th 2011, 12:51pm

read attributes value of element in XML in QT

<CAN Acceptance_Filter="ZZZZ" Baud_rate="YYYY" Acceptance_Mask="XXXX"/>

How to read attributes value in above line using QT functions.