0
@Override
public void characters(char ch[], int start, int length)
        throws SAXException {
    super.characters(ch, start, length);
    String strCharacters = new String(ch,start,length);
    if (itemFound==true){
        // "item" tag found, it's item's parameter
        switch(currentState){
            case state_title:     
                item.setTitle(strCharacters);
                break;
            case state_description:
                item.setDescription(strCharacters);
                break;  
            case state_link:
                item.setLink(strCharacters);
                break;  
            case state_pubdate:
                item.setPubdate(strCharacters);
                break;  
            default:
            break;    
        }    
    } else {
        // not "item" tag found, it's feed's parameter
        switch(currentState){
            case state_title:
            feed.setTitle(strCharacters);
            break;
            case state_description:
            feed.setDescription(strCharacters);
            break;
        case state_link:
            feed.setLink(strCharacters);
            break;
        case state_pubdate:
            feed.setPubdate(strCharacters);
            break;  
        default:
            break;
        }
    }
    currentState = state_unknown;
 }

Please tell me how to parse (&) I am not able to parse & in this

blessanm86
  • 31,439
  • 14
  • 68
  • 79
user971035
  • 35
  • 1
  • 1
  • 6

1 Answers1

0

Try it.. it ll help you.

private StringBuffer curTag = new StringBuffer(); public void endElement(String namespaceURI, String localName, String qName) throws SAXException {

        if(localName.equalsIgnoreCase("Test_tag")){ 
            System.out.println(curTag.toString());
        }
}
public void characters(char ch[], int start, int length) {
        curTag.append(CharBuffer.wrap(ch, start, length));
    }
Thiru
  • 526
  • 1
  • 4
  • 17