java - Characters not displayed in endElement() of SAX parser -
java - Characters not displayed in endElement() of SAX parser -
i have received xml response server in format below.(response edited)
1. hello 2. world
hello , world nowadays in separate lines within message tag. able display hello world in characters(). failed same in endelement().
how content in multiple lines within same tag in endelement() of sax parser.
no, correct. characters() supposed getting hello , world, not endelement(). end element signals end of tag , characters gets in between tag.
if want in endelements() 1.hello 2.world why not create variable top? instance.
private string message = null; @override public void endelement(string uri, string localname, string qname) throws saxexception { system.out.println(message); //or whatever want message } @override public void characters(char ch[], int start, int length) throws saxexception { if(ismessage){ //ismessage set when run startelement , runs <message> block. message = new string(ch, start, length); ismessage = false; } } java android saxparser
Comments
Post a Comment