Sunil Targe
Sunil Targe

Reputation: 7459

How to create XML file in blackberry 10 device document directory through cascade QML?

I have XML data stored in QString/QByteArray, I want to write that xml data in new sample.xml file and save that file in device document directory.

Anyone please guide me on this.

Thanks in advance.

Upvotes: 1

Views: 353

Answers (2)

Amit Yadav
Amit Yadav

Reputation: 35044

QFile file(QDir::currentPath() + "/shared/documents/yourfile.txt");
if (file.open(QIODevice::WriteOnly)) {
    QTextStream stream(&file);
    stream << "DATA HERE \n";
}

Upvotes: 0

L&#225;szl&#243; Papp
L&#225;szl&#243; Papp

Reputation: 53173

You can use QXmlStreamWriter. Here you can find an official example which reads from a device and then writes that out. You could slightly modify this to allow to read from your QString/QByteArray by the appropriate construct if I understand your query correctly.

Upvotes: 1

Related Questions