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

Java Development

Reply
Developer
saravanaboopati
Posts: 147
Registered: ‎09-10-2008
My Device: Not Specified

Adding XML attribute Problem?

Hi,

Can anyone tellme how to add attribute to the xml tag?

my code below 

 

Element child1 = document.createElement("MainInfo");

child1.setAttribute("ObjID","One");
Text Textval1 = document.createTextNode("Welcome");

child1.appendChild(Textval1);

rootElement.appendChild(child1);

 

 

 

But i am not getting data in the xml

 

<MainInfo>

Welcome

</MainInfo>

 

 

please help

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Adding XML attribute Problem?

[adscasdc a????  this editor is all screwed uip??????  10 minutes later...... ]

 

How did you convert the dom into the xml file? I'm asking just to make sure the problem is reasonably isolated to the code you cite but also curious. I haven't tried to write a DOM and data that is in another format was just

eas easy to write with string commands.

 

I'm also in the middle of a proof of concept location based app where I have a lot of point-of-interest up/download

and am debating about XML versus simple text( space delimited entries on a single line). Right now our server supports both formats but I'm not sure which makes more sense on the phone. I hate xml verbosity for BW, but a fixed unlabelled format does create various problems.

 

Please use plain text.
Developer
saravanaboopati
Posts: 147
Registered: ‎09-10-2008
My Device: Not Specified

Re: Adding XML attribute Problem?

I am not getting you sorry.
Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Adding XML attribute Problem?

How did you determine what the XML output looks like where you show the missing attribute?
Please use plain text.
Developer
saravanaboopati
Posts: 147
Registered: ‎09-10-2008
My Device: Not Specified

Re: Adding XML attribute Problem?

I am using DOM object for Retrive the data from the xml to the screen.

 

Please use plain text.