110,561
社区成员
发帖
与我相关
我的任务
分享
XmlDocument xIn = new XmlDocument();
xIn.LoadXml(XMLin);
XmlNode newlog = xIn.SelectSingleNode("//log");
XmlDocument log = new XmlDocument();
log.Load(@"D:\data\log.xml");
XmlNode addNode = log.ImportNode(newlog, true);
(log.GetElementsByTagName("logs"))[0].AppendChild(addNode);
log.Save(@"D:\data\log2.xml");
<logs xmlns="http://www.witsml.org/schemas/1series" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.witsml.org/schemas/1series ../xsd_schemas/obj_log.xsd" version="1.4.0.0">
<!--
These examples are only intended to demonstrate the type of data that can be exchanged.
They totally artificial and are not intended to demonstrate best practices.
-->
<documentInfo>
<documentName>Log</documentName>
<fileCreationInformation>
<fileCreationDate>2001-10-31T08:15:00.000Z</fileCreationDate>
<fileCreator>John Smith</fileCreator>
</fileCreationInformation>
</documentInfo>
<log uidWell="W-12" uidWellbore="B-01" uid="f34a">
...
</log>
<log uidWell="W-12" uidWellbore="B-01" uid="f34a" xmlns="">
......
</log>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example of Log data -->
<logs
xmlns="http://www.witsml.org/schemas/1series"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.witsml.org/schemas/1series ../xsd_schemas/obj_log.xsd"
version="1.4.0.0">
<!--
These examples are only intended to demonstrate the type of data that can be exchanged.
They totally artificial and are not intended to demonstrate best practices.
-->
<documentInfo>
<documentName>Log</documentName>
<fileCreationInformation>
<fileCreationDate>2001-10-31T08:15:00.000Z</fileCreationDate>
<fileCreator>John Smith</fileCreator>
</fileCreationInformation>
</documentInfo>
<log uidWell="W-12" uidWellbore="B-01" uid="f34a">
<nameWell>6507/7-A-42</nameWell>
<nameWellbore>A-42</nameWellbore>
<name>L001</name>
<serviceCompany>Baker Hughes INTEQ</serviceCompany>
<runNumber>12</runNumber>
<creationDate>2001-06-18T13:20:00.000Z</creationDate>
<description>Drilling Data Log</description>
<indexType>measured depth</indexType>
<startIndex uom="m">499</startIndex>
<endIndex uom="m">509.01</endIndex>
<stepIncrement uom="m">0</stepIncrement>
<direction>increasing</direction>
<indexCurve columnIndex="1">Mdepth</indexCurve>
<nullValue>-999.25</nullValue>
<logParam index="1" name="MRES" uom="ohm.m" description="Mud Resistivity">1.25</logParam>
<logParam index="2" name="BDIA" uom="in" description="Bit Diameter">12.25</logParam>
<logCurveInfo uid="lci-1">
<mnemonic>Mdepth</mnemonic>
<classWitsml>measured depth of hole</classWitsml>
<unit>m</unit>
<mnemAlias>md</mnemAlias>
<nullValue>-999.25</nullValue>
<minIndex uom="m">499</minIndex>
<maxIndex uom="m">509.01</maxIndex>
<columnIndex>1</columnIndex>
<curveDescription>Measured depth</curveDescription>
<sensorOffset uom="m">0</sensorOffset>
<traceState>raw</traceState>
<typeLogData>double</typeLogData>
</logCurveInfo>
<logCurveInfo uid="lci-2">
<mnemonic>Vdepth</mnemonic>
<classWitsml>TVD of hole</classWitsml>
<unit>m</unit>
<mnemAlias>tvd</mnemAlias>
<nullValue>-999.25</nullValue>
<minIndex uom="m">499</minIndex>
<maxIndex uom="m">509.01</maxIndex>
<columnIndex>2</columnIndex>
<curveDescription>Vertical depth</curveDescription>
<sensorOffset uom="m">0</sensorOffset>
<traceState>raw</traceState>
<typeLogData>double</typeLogData>
</logCurveInfo>
<logData>
<data>499,498.99,1.25,0,1.45,3.67,11.02,187.66,0.29,116.24,0.01,0.05,0.01,0,886.03,1089.99,1.11,14.67,0.29,1.12,1.11</data>
<data>500.01,500,1.9,0.01,1.42,9.94,11.32,185.7,0.29,116.24,0.01,0.01,0.01,0,795.19,973.48,1.11,14.67,0.29,0.95,1.11</data>
<data>501.03,501.02,2.92,0.02,1.41,20.46,11.62,184.23,0.29,120,0.01,0.01,0.01,0,796.68,956.25,1.11,14.67,0.29,0.83,1.11</data>
<data>502.01,502,3.9,0.06,1.44,21.73,10.37,185.49,0.29,120,0.01,0.01,0.01,0,802.96,1005.68,1.1,14.66,0.3,0.8,1.11</data>
<data>503.01,503,4.9,0.11,1.48,17.65,10.31,185.55,0.29,118.09,0.01,0.01,0.01,0,801.19,1007.77,1.11,14.66,0.3,0.83,1.11</data>
<data>504.05,504.04,5.94,0.18,1.55,15.58,10.4,185.43,0.29,120,0.01,0.01,0.01,0,800.83,1015.89,1.1,14.67,0.29,0.86,1.11</data>
<data>505.03,505.00,612.03,1.83,3.32,37.11,18.5,243.38,91.93,0,8.07,8.35,7.68,0.19,900.07,3205,1.26,29.67,93.74,0.75,1.31</data>
<data>506.04,505.95,613.04,1.9,3.4,9.85,27.79,233.9,79,0,8.31,10.24,6.83,1.02,907.9,3210,1.26,29.8,95,1.09,1.31</data>
<data>507.04,506.91,614.04,1.97,3.46,32.44,23.13,238.59,77.35,0,7.93,8.96,7.76,0.14,911.55,3223.33,1.26,29.88,89.19,0.78,1.31</data>
<data>508.01,507.84,615.01,2,3.49,29.03,19.38,242.36,90.59,0,8.32,8.78,7.76,0.32,899.74,3222.17,1.26,29.95,91.66,0.8,1.31</data>
<data>509.01,508.75,616.01,2.08,3.54,13.09,15.89,245.92,93.38,0,7.62,11.87,6.43,0.86,900.93,3215.78,1.26,30.06,98.51,0.92,1.31</data>
</logData>
<commonData>
<dTimCreation>2003-11-24T08:15:00.000Z</dTimCreation>
<dTimLastChange>2003-11-24T08:17:00.000Z</dTimLastChange>
<itemState>plan</itemState>
<comments>These are the comments associated with the log object.</comments>
</commonData>
</log>
</logs>
<?xml version="1.0" encoding="UTF-8"?>
<logs>
<log uidWell="W-12" uidWellbore="B-01" uid="f34a">
<nameWell>6507/7-A-42</nameWell>
<nameWellbore>A-42</nameWellbore>
<name>L001</name>
<serviceCompany>Baker Hughes INTEQ</serviceCompany>
<runNumber>12</runNumber>
<creationDate>2001-06-18T13:20:00.000Z</creationDate>
<description>Drilling Data Log</description>
<indexType>measured depth</indexType>
<startIndex uom="m">499</startIndex>
<endIndex uom="m">509.01</endIndex>
<stepIncrement uom="m">0</stepIncrement>
<direction>increasing</direction>
<indexCurve columnIndex="1">Mdepth</indexCurve>
<nullValue>-999.25</nullValue>
<logParam index="1" name="MRES" uom="ohm.m" description="Mud Resistivity">1.25</logParam>
<logParam index="2" name="BDIA" uom="in" description="Bit Diameter">12.25</logParam>
<logCurveInfo uid="lci-1">
<mnemonic>Mdepth</mnemonic>
<classWitsml>measured depth of hole</classWitsml>
<unit>m</unit>
<mnemAlias>md</mnemAlias>
<nullValue>-999.25</nullValue>
<minIndex uom="m">499</minIndex>
<maxIndex uom="m">509.01</maxIndex>
<columnIndex>1</columnIndex>
<curveDescription>Measured depth</curveDescription>
<sensorOffset uom="m">0</sensorOffset>
<traceState>raw</traceState>
<typeLogData>double</typeLogData>
</logCurveInfo>
<logCurveInfo uid="lci-2">
<mnemonic>Vdepth</mnemonic>
<classWitsml>TVD of hole</classWitsml>
<unit>m</unit>
<mnemAlias>tvd</mnemAlias>
<nullValue>-999.25</nullValue>
<minIndex uom="m">499</minIndex>
<maxIndex uom="m">509.01</maxIndex>
<columnIndex>2</columnIndex>
<curveDescription>Vertical depth</curveDescription>
<sensorOffset uom="m">0</sensorOffset>
<traceState>raw</traceState>
<typeLogData>double</typeLogData>
</logCurveInfo>
</log>
</logs>