Questions tagged [qtxml]

For questions related to QtXml, a Qt module providing C++ implementations of SAX and DOM. Only present in Qt4 and Qt5.

Documentation can be found here (Qt4) and here (Qt5).

Support for QtXml was removed from Qt6.

58 questions
15
votes
6 answers

Edit Value of a QDomElement?

I need to edit the text of a QDomElement - Eg I have an XML file with its content as - Edit text here How do I edit the text of the child element ? I don't see any functions in the…
Eternal Learner
  • 3,800
  • 13
  • 48
  • 78
12
votes
3 answers

Converting QDomElement to QString / Container class

Let's say we have the following XML document: ... 12345 abcd
Routa
  • 565
  • 3
  • 6
  • 14
8
votes
1 answer

How can I use Qt's QXmlQuery to run XPath queries on a local file?

I'm trying to grab the coordinates from .kml files that look something like this: Name
Matthew Read
  • 1,365
  • 1
  • 30
  • 50
8
votes
4 answers

Incorrect order of attributes in Qt XML

I have the following code: element.clear(); element.setTagName("accountpoint"); element.setAttribute("code", QString(ID_CONST)+serial); element.setAttribute("name", QString()); element.setAttribute("serial", serial); QFile…
MastAKK
  • 81
  • 1
  • 3
6
votes
1 answer

Qt C++ XML, validating against a DTD?

Is there a way to validate an XML file against a DTD with Qt's XML handling? I've tried googling around but can't seem to get a straight answer. If Qt doesn't include support for validating an XML file, what might be the process of implementing…
Joseph
  • 12,678
  • 19
  • 76
  • 115
6
votes
2 answers

QDomDocument fails to set content of an HTML document with tag

When I use QDomDocument with HTML content, it fails to set content if there is a at the beginning of the document. But actually why?! for example consider the following snippet of code: QDomDocument doc; QString content =…
Alireza Mirian
  • 5,862
  • 3
  • 29
  • 48
5
votes
1 answer

QEventLoop: Cannot be used without QApplication

I'm trying to validate an xml file against a specific schema. So I'm loading the schema into the QXmlSchema object. But I get some strange errors. My code looks like: int main() { QUrl url("http://www.schema-example.org/myschema.xsd"); QXmlSchema…
sundar
  • 456
  • 2
  • 7
  • 19
4
votes
4 answers

How to debug QDomElement in QtXml?

I've got a QDomElement, and I would like to debug it, i.e. see it as plain text in debug console. In order to output it with qDebug(), it needs to be in QString format, however I don't see any conversion method from a QDomElement nor a QDomNode. Any…
moala
  • 5,094
  • 9
  • 45
  • 66
4
votes
1 answer

C++/Qt QDomDocument: iterate over all XML Tags

my Problem is, I have a large XML-styled File represented as QDomDocument and I need to access certain Tags on multiple locations in the XML My XML looks like this Mat_1 10
NIoSaT
  • 423
  • 6
  • 22
3
votes
3 answers

How to get values of child nodes with QDomDocument?

A recieve a string like this: # 998.40 49920 I'd like to use QDomDocument to get the values of arguments' child nodes…
Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180
3
votes
1 answer

How to make a deep copy of an entire QDomDocument

I want to create a deep copy of a QDomDocument in an xml model in order to allow the user to later restore the document to its original state. The QDomDocument documentation says that this can be achieved by using cloneNode(). However, cloneNode()…
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
3
votes
1 answer

Qt XML serialization/deserialization to Q_PROPERTY

QJson (http://qjson.sourceforge.net) implements a very convenient API for serializing and deserializing Q_OBJECTS - by converting their Q_PROPERTIES to qVariant, it allows for a convenient serialization and deserialization of arbitrary model…
qdot
  • 6,195
  • 5
  • 44
  • 95
2
votes
1 answer

QDomDocument won't insert QDomElement

I'm doing something with XML and now I'm confused. This code works perfectly: QDomElement new_item = doc.createElement(name); new_item.setAttribute("type", value.typeName()); new_item.setAttribute("value", value.toString()); …
xx77aBs
  • 4,678
  • 9
  • 53
  • 77
2
votes
1 answer

Writing XML Nodes in QtXML (QDomElement)

I would like to write Nodes like Peter (with start and end tag) into a QDomDocument. When I create QDomElements and append them as child to a parent element: QDomElement node =…
florianbaethge
  • 2,520
  • 3
  • 22
  • 29
2
votes
0 answers

When are qt5 qdom xml nodes deleted?

I would like to understand when qt5 deletes the data of a DOM node. My first question is: when a node is created (QDomDocument factory method) but it isn't placed in the DOM tree, will it's internal data be deleted (or will the QDomDocument still…
Tom Deseyn
  • 1,735
  • 3
  • 17
  • 29
1
2 3 4