日期:2014-05-17 浏览次数:20548 次
<BatchQueryRequest> <logisticProviderID>xxx</logisticProviderID> <clientID>xxx</clientID> <orders> <order> <mailNo>1111111111</mailNo> </order> <order> <mailNo>2222222222</mailNo> </order> </orders> </BatchQueryRequest>
string orderNo = this.IndexwaybillNo.Value.Trim(); string clientId = "xxx"; string logisticProviderID = "xxx"; string[] rs = orderNo.Trim().Split('/'); string xml = "<BatchQueryRequest>" + "<logisticProviderID>" + logisticProviderID + "</logisticProviderID>" + "<clientID>" + clientId + "</clientID>" + "<orders>" + "</orders>" + "</BatchQueryRequest>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); XmlNode xmlNode = xmlDoc.SelectSingleNode("BatchQueryRequest/orders"); foreach (string s in rs) { if (s.Trim().Length!= 10) { this.lblTime.Text = ""; Common.Alert("运单号输入不正确,请输入10位正确运单号"); } else if (!op.StrIsInt(s)) { this.lblTime.Text = ""; Common.Alert("运单号格式不正确,请输入10位正确运单号"); } else { orderNo = s; if (xmlNode != null) { XmlElement newElement = xmlDoc.CreateElement("order");//添加order节点 XmlElement etitle = xmlDoc.CreateElement("mailNo"); //添加mailNo节点 etitle.InnerXml = orderNo; newElement.AppendChild(etitle); xmlNode.AppendChild(newElement); } xmlDoc.LoadXml(xml); } }