[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='users.netlab.cz' to='test_soc@jabbim.sk/QXmpp' id='search0' type='result'>
    <query >
    <instructions>You need an x:data capable client to search</instructions>
    <x type='form'>
    <title>Search users in users.netlab.cz</title>
    <instructions>blahblah</instructions>
    <field type='text-single' label='User' var='user'/>
    ...
    <field type='text-single' label='Organization Unit' var='orgunit'/>
    </x>
    </query>
    </iq>@

    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.