XML ÎļþÓüÇʱ¾´ò¿ª»»ÐÐÓë²»»»ÐÐÎÊÌâ
C# code:
public void WriteISFXml(string RefNo,string TransType,string ShipmentType)
{
///³õʼ»¯XMLÀàµÈ²Ù×÷
XmlDocument xmlDoc = new XmlDocument();
///¼ÓÔØ±¾µØXMLÎļþ
xmlDoc.Load(sPath);
XmlNode root = xmlDoc.SelectSingleNode("ISF");
XmlElement SendersUniqueRefer = xmlDoc.CreateElement("SendersUniqueReference");
SendersUniqueRefer.InnerText = RefNo;
root.AppendChild(SendersUniqueRefer);
XmlElement SubType = xmlDoc.CreateElement("SubmissionType");
SubType.InnerText = TransType;
root.AppendChild(SubType);
XmlElement ShprTypeCode = xmlDoc.CreateElement("ShipmentTypeCode");
ShprTypeCode.InnerText = ShipmentType;
root.AppendChild(ShprTypeCode);
///±£´æXMLÎļþµ½Ö¸¶¨Îļþ¼Ð,²¢ÒÔÌØ¶¨µÄÃû×ÖÃüÃû
xmlDoc.Save("D:\\In\\hls201004091024172300001.xml");
}
Éú³É³ö來µÄhls201004091024172300001.xmlÎļþÓüÇʱ¾´ò¿ª¿´Ê±,µ±½ÚµãShipmentTypeCodeֵΪ¿Õʱ,
<ShipmentTypeCode>
</ShipmentTypeCode>(»»ÐÐÁË)
¶øÎÒÏÖÔÚÏëÒªµ±ÆäֵΪ¿ÕʱºòΪ<ShipmentTypeCode></ShipmentTypeCode>(²»»»ÐÐ)
請¸÷λָ½Ì,ÓеÄ說¿ÉÒÔÓà XmlReaderSettings ,µ«ÊDz»ÖªµÀÔÚÄÄÀïÉèÖÃ,請´ó¼Ò°ïÖ
Ïà¹ØÎÊ´ð£º
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<video>
<device deviceid="\\?\usb#vid_0c45&pid_613b#5&2d0620de& ......
<?xml version="1.0" encoding="utf-8" ?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical&q ......
ÎÒÏÖÔÚÓÐÒ»¸öXML¶ÔÏó
var merxml
merxml ±£´æµÄÄÚÈÝ ÊÇ
<root>
<a>a</a>
<b>b</b>
</root>
ÎÒÏÖÔÚµÄÄ¿µÄÊÇÒª°Ñ merxml Õâ¸öXML¶ÔÏó ÍêÕûµÄÊä³öµ½Ò»¸öÎı¾¿ò tx ......
ÓÐÒ»¸öXML
XML code:
<Person>
<Node>
<Name>admin</Name>
<Date>2010-4-6</Date>
</Node>
<Node>
<Name>lisi</Name>
......
ÎÒÓÃXmlDocumentÉú³ÉXML
XmlElement remarkNode = node.OwnerDocument.CreateElement("remark");
remark1Node.InnerXml = "";
Èç¹ûInnerXml¸³Öµ²»Îª¿Õ£¬ÔòÉú³ÉµÄ±ê¼ÇÊÇûÎÊÌâµÄ£¬±ÈÈ磺<r ......