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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
WesleyT
Posts: 206
Registered: ‎07-02-2010
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

Please use plain text.
Developer
Ted_Hopp
Posts: 1,304
Registered: ‎01-21-2009

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.
Please use plain text.
Developer
WesleyT
Posts: 206
Registered: ‎07-02-2010
My Carrier: Vodacom

Re: Parse String as an xml ?

Thank you Ted.

Please use plain text.