get text between xml tags

What is the xml root element? The first tag except the “<?xml version=”1.0″ encoding=”ISO-8859-1″?>” and the <!DOCTYPE …> is the root element.  How to get the xml document root in Qt? Use dom.documentElement(). How to get the text in between the opening tag and the closing tag? If ele is the QDomElement for the tag, the simplest way to get the text is ele.text(). An alternative method is using QDomNode::nodeValue() as an element is also a node. But do not use ele.nodeValue(),which returns an empty string because only the QDomNode of a QDomText element can return its text. So the correct way is ele.firstChild().nodeValue(). ele.firstChild() returns the QDomText object representing the text.

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Comments are closed, but trackbacks and pingbacks are open.