Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
Posts: 3
Registered: ‎04-20-2013
My Device: Z10
My Carrier: Telus

Adding attributes to XML

I'm trying to add attributes to XML elements like this:

 

<root>
     <item name="name1" number="2" />
     <item name="name2" number="3" />
</root>

  

where name and number are the two attributes. On BlackBerry's barely-informative documentation page, it talks about how attributes uses QVariant(QString).

I took this as:

 

QString messageData;
messageData["name"] = "name1";
messageData["number"] = "2";

 

But it's not working... any help?

Highlighted
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Adding attributes to XML

It looks like you are using XmlDataAccess to generate your xml...

Use QXmlStreamWriter instead...