BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-19-2009, 10:01 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question xml parsing leaving text after &

Please Login to Remove!

Hi All,


I am pasring an XML file using dom.


Here is my code snippet


DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
factory.setExpandEntityReferences(false);
factory.setCoalescing(true);
factory.setValidating(false);
Document document = builder.parse( inStream );
vecData = new Vector(1, 1);
Element rootElement = document.getDocumentElement();
rootElement.normalize();


I have used getNodeValue() to retrieve node's value.

The text i am getting without the text after &..


like if i have node value as


http://imypage.ashx?imageurl=http%3a...128&height=128


Can any one help me in this.


Thanks & Regards,

Sachin
__________________
Crazy for BlackBerry
Offline  
Old 11-19-2009, 10:14 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

The amphersand '&' is a reserved character in an XML or HTML file - it needs to be encoded using the standard HTML entities, like &
Offline  
Old 11-20-2009, 01:08 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy xml parsing leaving text after &

I am receiving an xml containing & as & still I did not get the text after &.

Can you please help me in this regard.

Any settings to be made for this.. I already place my code...

Thanks
__________________
Crazy for BlackBerry
Offline  
Old 11-20-2009, 08:49 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Then there must be something else wrong with the XML.
Offline  
Old 11-20-2009, 09:35 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question xml parsing leaving text after &

Same xml will run fine for iphone and android application.

on blackberry when i tried to parse i am getting text before & only.


Thanks
__________________
Crazy for BlackBerry
Offline  
Old 11-20-2009, 10:50 AM   #6 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Try replacing the & with the unicode equivalent: & # 38;

(spaces inserted to prevent the HTML editor from converting to '&' character)
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.