maskat.sample={};

maskat.sampleSendTeleParser=function(sourceNode, validator){
  var resultXML = "";
  var sourceNodeName = maskat.xpath(sourceNode, '@node');
  var sourceChildNodeName = maskat.xpath(sourceNode, '@childNode');
  var bindNodes = maskat.xpath(sourceNode, 'bind');

  if (bindNodes.length == 0){
    return resultXML;
  }
  
  var dataXML = "";

  for (var i = 0; i < bindNodes.length; i++){
    var bindNode = bindNodes[i];
    var bindFromkeyName = maskat.xpath(bindNode, '@fromkey');
    var bindNodeName = maskat.xpath(bindNode, '@node');
    var schemaType = maskat.xpath(bindNode, '@schemaType');
    var sendBlankElement = maskat.xpath(bindNode, '@sendBlankElement');
    
    var bindFromkeyObj = maskat.getObjByName(bindFromkeyName);
    if (bindFromkeyObj){
      var bindFromkeyObjWrap = new ObjWrapper(bindFromkeyObj);
      if (bindFromkeyObjWrap.isSingleDataObj()){
        var value = bindFromkeyObjWrap.getSingleValue();
        if ((value!=null && value != "") || sendBlankElement=="true"){
          if (schemaType=="date"){
              dataXML += "<" + bindNodeName + ">" + maskat.transferDate(value) + "</" + bindNodeName + ">";
              continue;
          }else{
              dataXML += "<" + bindNodeName + ">" + value + "</" + bindNodeName + ">";
          }
        }
      }
    }
  }

  if (dataXML != ""){
    resultXML += "<" + sourceNodeName + ">" + dataXML
                     + "</" + sourceNodeName + ">";
  }
  
  return resultXML;

}

maskat.transferDate = function(dateStr){
    var year = dateStr.slice(6,10);
    var month = dateStr.slice(3,5);
    var day = dateStr.slice(0,2);
    return year+"-"+month+"-"+day+"T00:00:00.000+09:00";//XXX ハードコーディングで+09:00
}