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
Highlighted
Developer
Posts: 206
Registered: ‎07-02-2010
My Device: 8320 Curve
My Carrier: Vodacom
Accepted Solution

Parse String as an xml ?

Hello,

 

I would like to do the following

 

InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xmlRecords))

 

But it looks like those methods are not available on the BB. So what is the equilavent of the above ?

 


InputStream inputStream = /* XML String */
Document document = builder.parse( inputStream );

Thanks in advance

 

Wesley Trollip

Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Parse String as an xml ?

ByteArrayInputStream bis = new ByteArrayInputStream(xmlString.getBytes("UTF-8"));

Document doc = builder.parse(bis);




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Developer
Posts: 206
Registered: ‎07-02-2010
My Device: 8320 Curve
My Carrier: Vodacom

Re: Parse String as an xml ?

Thank you Ted.