package com.bizofficer.module.questioncd;

import org.json.*;

import com.fasterxml.jackson.databind.ObjectMapper;


public class XmlToJsonCD {

	public Object parse(String xmlstr)
    {
		QuestionMapperBeanCD questionObj = new QuestionMapperBeanCD();
        
        try{
        	
	        JSONObject jsonObj = XML.toJSONObject(xmlstr);
	        String jsonString = jsonObj.toString();  
	        jsonString = jsonString.replace("\"Description\":", "\"description\":");
	        
	        ////System.out.println("XmlToJsonCD jsonString: >>> "+jsonString);
	        
	        ObjectMapper objectMapper = new ObjectMapper();
	        questionObj = objectMapper.readValue(jsonString, QuestionMapperBeanCD.class);
	        
	        //System.out.println("Title: >>> "+questionObj.getItem().getTitle());
	        
	        //System.out.println("ident: >>> "+questionObj.getItem().getIdent() );
	        
	        //System.out.println("mattext: >>> "+questionObj.getItem().getPresentation().getFlow().getMaterial().getMattext());  
        	
	        //System.out.println("ident: >>> "+questionObj.getItem().getPresentation().getFlow().getResponse_lid().getRender_choice().getResponse_label().get(0).getIdent() );  
			
  	    }catch(Exception ex){
    	   ex.printStackTrace();
   	    }

        
        return questionObj;
        
  }

	
	
}
