vendredi 22 mai 2015

Java XML Parsing using SAXParser

I have an API.When we request it will produce XML as response data

The below is the API Response for Description field:

<parameter>
<name>description</name>
<value>Description Description</value>
</parameter>

The below is the code to parse XML File(SAXPraser)

public class WorkOrderDataHandler extends DefaultHandler {

     if ("description".equals(parameter.getName())) {
         System.out.println("Handler desc"+ parameter.getValue());//DescriptionDescriptionÂ
        ticketData.setDescription((parameter.getValue()));
                }

    }

Output: When i tried to parse the description field. i am getting the output as DescriptionDescriptionÂ

Could anyone please help

Aucun commentaire:

Enregistrer un commentaire