Thread: Converting XML
View Single Post
Old 07-11-2007, 11:13 AM   #2 (permalink)
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

here's some code from a template i created, have you actually implented a handler class?

try{
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
InputStream in = new ByteArrayInputStream(serverResponse.getBytes());
InputSource inputSource = new InputSource(in);
saxParser.parse(in, new newBlackberrySoapSaxClassHandler());
}catch(Exception ex){

}

and then the handler:

static class newBlackberrySoapSaxClassHandler extends DefaultHandler {
String builder;
String temp;

public void startDocument() throws SAXException {
}

public void startElement(String uri, String name, String qName, Attributes atts){
if ("".equals(uri)){
System.out.println("Start element: " + qName);
}
temp = "";
}

public void endElement(String uri, String name, String qName){
if ("".equals(uri)){
System.out.println("End element: " + qName);
}
}

public void characters(char buf[],int offset,int len) throws SAXException {
temp="";
String temp2;
temp2 = new String(buf, offset, len).trim();
if (!temp2.equals("") || !temp2.equals(" ")){
temp = temp2;
}else{
temp = "";
}
}

public void endDocument() throws SAXException {

}
}
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline