/**
  * Gets the string list.
  *
  * @param filename the filename
  * @param parent the parent
  * @param name the name
  * @return the string list
  * @throws Exception the exception
  */
 public static List<String> getStringList(String filename, Element parent, String name)
     throws Exception {
   NodeList childElements = DomParseUtil.getImmediateChildrenByTagName(parent, name);
   if (childElements == null) {
     return null;
   }
   ArrayList<String> result = new ArrayList<String>();
   for (int i = 0; i < childElements.getLength(); i++) {
     Element oneElement = (Element) childElements.item(i);
     String outValue = DomParseUtil.getText(oneElement);
     result.add(outValue);
   }
   return result;
 }
 /**
  * Put nv list.
  *
  * @param filename the filename
  * @param containerName the container name
  * @param optionContainer the option container
  * @param outList the out list
  * @throws Exception the exception
  */
 public static void putNVList(
     String filename, String containerName, Element optionContainer, List<NameValue> outList)
     throws Exception {
   NodeList childElements = DomParseUtil.getImmediateChildrenByTagName(optionContainer, "option");
   if (childElements == null) {
     return;
   }
   for (int i = 0; i < childElements.getLength(); i++) {
     Element option = (Element) childElements.item(i);
     String name = option.getAttribute("name");
     if (name == null || name.length() == 0) {
       throwError(filename, "Missing option name in option list: '" + containerName + "'");
     }
     String value = DomParseUtil.getText(option);
     if (value == null) {
       throwError(filename, "Missing option value for option list: '" + containerName + "'");
     }
     NameValue nv = new NameValue();
     nv.setName(name);
     nv.setValue(value);
     outList.add(nv);
   }
 }
 /**
  * Gets the option list.
  *
  * @param filename the filename
  * @param parent the parent
  * @param childName the child name
  * @return the option list
  * @throws Exception the exception
  */
 public static OptionList getOptionList(String filename, Element parent, String childName)
     throws Exception {
   if (parent == null) {
     return null;
   }
   OptionList result = new OptionList();
   Element optionContainer = DomParseUtil.getSingleElement(filename, parent, childName);
   if (optionContainer == null) {
     return null;
   }
   List<NameValue> outList = result.getOption();
   putNVList(filename, childName, optionContainer, outList);
   return result;
 }
  /**
   * The main method.
   *
   * @param args the arguments
   */
  public static void main(final String[] args) {
    try {
      // final String src = "<RLRuleExprValidation><Status>Success</Status></RLRuleExprValidation>";
      final String src =
          "<RLRuleExprValidation><Status>Failure</Status><Error>TestError</Error></RLRuleExprValidation>";
      final Document domMessage = DomParseUtil.deserializeDOMTree(src, false);

      final Element root = getRoot(domMessage);
      final Element status = getChildByName(root, "Status");
      String responseStatus = getNodeValue(status);
      System.out.println("The response status is ==> " + responseStatus);
      if (!"Success".equalsIgnoreCase(responseStatus)) {
        final Element error = getChildByName(root, "Error");
        String errorMsg = getNodeValue(error);
        System.out.println("The error message is ==> " + errorMsg);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }