try {
InputSource is = new InputSource(new StringReader(uriXML));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( is );
objectList = new Vector<UPSResponseObject>();
NodeList list = document.getElementsByTagName("RatingServiceSelectionResponse");
int responseLength = list.getLength();
for(int i= 0; i < responseLength; i++){
UPSResponseObject object = new UPSResponseObject();
list = document.getElementsByTagName("ResponseStatusCode");
if(list.item(i) != null && list.item(i).getFirstChild() != null)
object.setStatusCode(list.item(i).getFirstChild().getNodeValue());
list = document.getElementsByTagName("ResponseStatusDescription");
if(list.item(i) != null && list.item(i).getFirstChild() != null)
object.setStatusDescription(list.item(i).getFirstChild().getNodeValue());
list = document.getElementsByTagName("ErrorCode");
if(list.item(i) != null && list.item(i).getFirstChild() != null)
object.setErrorCode(list.item(i).getFirstChild().getNodeValue());
list = document.getElementsByTagName("ErrorDescription");
if(list.item(i) != null && list.item(i).getFirstChild() != null)
object.setErrorDescription(list.item(i).getFirstChild().getNodeValue());
list = document.getElementsByTagName("TotalCharges");
if(list.item(i) != null && list.item(i).getFirstChild() != null){
list = document.getElementsByTagName("CurrencyCode");
if(list.item(i) != null && list.item(i).getFirstChild() != null)
object.setCurrencyCode(list.item(i).getFirstChild().getNodeValue());
list = document.getElementsByTagName("MonetaryValue");
if(list.item(i) != null && list.item(i).getFirstChild() != null)
object.setTotalValue(list.item(i).getFirstChild().getNodeValue());
}