Important: Please read the Qt Code of Conduct -

[Solved]QDomDocument to QDomElement help needed

  • I have xmpp iq which I loaded from QByteArray to QDomDocument, but I need it as QDomElement

    @<iq from='' to='' id='search0' type='result'>
    <query >
    <instructions>You need an x:data capable client to search</instructions>
    <x type='form'>
    <title>Search users in</title>
    <field type='text-single' label='User' var='user'/>
    <field type='text-single' label='Organization Unit' var='orgunit'/>

    so I just used

    @QDomElement element = doc.toElement();@

    but it returned no data, I am not really familiar with xml so I'm not really sure if this is right. Anyone can tell me how to convert this document to element or if its able to directly load data from QByteArray to QDomElement somehow?

    Thanks, Marek.

  • You can use QDomDocument::documentElement() to get the root element of the document and go from there.

  • yes this one works thanks:)

Log in to reply