xml格式封装数据
xml层级关系
XDocument obj = new XDocument(new XDeclaration("1.0", "utf-8", "yes")); //构造根节点 obj.Add(new XElement("request", new XElement("criteriaList", new XElement("criteria", new XElement("warehouseCode", warehousecode), new XElement("ownerCode", whse), new XElement("itemCode", sku.sku), new XElement("itemId", "")))));
XmlDocument doc = new XmlDocument();
doc.LoadXml(obj.ToString());
var obj = new JObject { {"?xml",new JObject { {"@version","1.0" }, {"@encoding","utf-8"} } }, { "request", new JObject { {"actionType","add"}, {"warehouseCode", warehousecode}, {"ownerCode", whse}, {"supplierCode", ""}, {"supplierName", "" }, { "item", j }, {"extendProps", new JObject { {"key1", "" }, {"key2", "" }, {"key3", "" }, {"key4", "" }, {"key5", "" } } } } } }; XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(JsonConvert.SerializeObject(obj));
人各有命,上天注定,有人天生为王,有人落草为寇。脚下的路,如果不是你自己的选择,那么旅程的终点在哪,也没人知道。你会走到哪,会遇到谁,都不一定。