我目前正在研究一些XML文件的版本控制功能。基本的工作流程是,当XML文件被解析时,按顺序将其分解,然后放入数据库表中,然后根据最新版本的XML进行提取,然后重新组合成一个可以使用的对象。
这是一个订单看起来像XML的例子(您可以浏览一下这个-这正是我正在处理的内容):
<Order IsEmpty="N">
<OrderNum>13903899</OrderNum>
<AmtUOM>US$</AmtUOM>
<CompanyUnit>Y</CompanyUnit>
<CreatedBy>PenskeTruckLeasing</CreatedBy>
<Opened>05/01/2018</Opened>
<Priority>5</Priority>
<ShopID>DE PERE</ShopID>
<TaxOverride>F</TaxOverride>
<UnitID>892</UnitID>
<Vendor>64657200-7542</Vendor>
<NonCompUnitID />
<InvOrder IsEmpty="N">
<InvType>REPAIR</InvType>
<PONum>7542-136815</PONum>
</InvOrder>
<RepOrder IsEmpty="N">
<RepSite>FACILITY</RepSite>
<RepClass>NONSCHEDULED</RepClass>
<Opened>05/01/2018</Opened>
<Closed>05/02/2018</Closed>
</RepOrder>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>001</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>219</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>001</CompCode>
<ActionCode>10</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>AC FILTER</PTLComplaint>
<PTLCause>PLUGGED</PTLCause>
<PTLCorrection>REPLACE FILTER AIR CONDITIONER</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>AC FILTER;AIR CONDITIONING, HEATING VENTILATING SYSTEM;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>14.99</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>001</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>219</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>001</CompCode>
<ActionCode>10</ActionCode>
<Descrip>AIR FILTER PANEL</Descrip>
<Hours>0</Hours>
<LineTotal>14.99</LineTotal>
<LineType>PART</LineType>
<Mechanic />
<PartID>AF55777</PartID>
<QtyReqd>1.0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>31.02</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>001</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>219</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>001</CompCode>
<ActionCode>10</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>1</Hours>
<LineTotal>31.02</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>1.37</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>001</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>219</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>001</CompCode>
<ActionCode>10</ActionCode>
<Descrip>SALES TAX</Descrip>
<Hours />
<LineTotal>1.37</LineTotal>
<LineType>TAX</LineType>
<Mechanic />
<PartID />
<QtyReqd>1</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>002</SystemCode>
<AssemblyCode>010</AssemblyCode>
<PartCode>055</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>MIRROR SWITCH</PTLComplaint>
<PTLCause>FAILED</PTLCause>
<PTLCorrection>REPLACE MIRROR POWER DIRECTIONAL CONTROL SWITCH</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>MIRROR SWITCH;CAB SHEET METAL;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>43.51</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>002</SystemCode>
<AssemblyCode>010</AssemblyCode>
<PartCode>055</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Descrip>SWITCH,MOTOR,REMOTE CONTR...</Descrip>
<Hours>0</Hours>
<LineTotal>43.51</LineTotal>
<LineType>PART</LineType>
<Mechanic />
<PartID>DTL 15829700</PartID>
<QtyReqd>1.0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>38.77</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>002</SystemCode>
<AssemblyCode>010</AssemblyCode>
<PartCode>055</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>1</Hours>
<LineTotal>38.77</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>3.98</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>002</SystemCode>
<AssemblyCode>010</AssemblyCode>
<PartCode>055</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Descrip>SALES TAX</Descrip>
<Hours />
<LineTotal>3.98</LineTotal>
<LineType>TAX</LineType>
<Mechanic />
<PartID />
<QtyReqd>1</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>002</SystemCode>
<AssemblyCode>035</AssemblyCode>
<PartCode>015</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>WIPERS</PTLComplaint>
<PTLCause>STREAK</PTLCause>
<PTLCorrection>REPLACE WINDSHIELD WIPER BLADE</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>WIPERS;CAB SHEET METAL;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>3.36</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>002</SystemCode>
<AssemblyCode>035</AssemblyCode>
<PartCode>015</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Descrip>BLADE,WIPER</Descrip>
<Hours>0</Hours>
<LineTotal>6.72</LineTotal>
<LineType>PART</LineType>
<Mechanic />
<PartID>ABP N82 7622</PartID>
<QtyReqd>2.0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>23.26</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>002</SystemCode>
<AssemblyCode>035</AssemblyCode>
<PartCode>015</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>1</Hours>
<LineTotal>23.26</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>.61</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>002</SystemCode>
<AssemblyCode>035</AssemblyCode>
<PartCode>015</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>10</ActionCode>
<Descrip>SALES TAX</Descrip>
<Hours />
<LineTotal>.61</LineTotal>
<LineType>TAX</LineType>
<Mechanic />
<PartID />
<QtyReqd>1</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>002</SystemCode>
<AssemblyCode>042</AssemblyCode>
<PartCode>001</PartCode>
<WorkAccomplishedCode>024</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>15</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>DECK PLATE</PTLComplaint>
<PTLCause>LOSE</PTLCause>
<PTLCorrection>REPAIR DECK PLATE/CROSSWALK AND MOUNTING BRACKETS</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>DECK PLATE;REPAIR DECK PLATE/CROSSWALK AND MOUNTING BRACKETS;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>77.54</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>002</SystemCode>
<AssemblyCode>042</AssemblyCode>
<PartCode>001</PartCode>
<WorkAccomplishedCode>024</WorkAccomplishedCode>
<CompCode>002</CompCode>
<ActionCode>15</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>.50</Hours>
<LineTotal>38.77</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>017</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>020</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>017</CompCode>
<ActionCode>10</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>LEFT REAR DRIVE TIRE</PTLComplaint>
<PTLCause>MISSING TREAD SECTION</PTLCause>
<PTLCorrection>REPLACE DRIVE TIRE(S)-3RD AXLE LEFT</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>LEFT REAR DRIVE TIRE;REAR TIRES;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>46.52</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>017</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>020</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>017</CompCode>
<ActionCode>10</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>1</Hours>
<LineTotal>46.52</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>034</SystemCode>
<AssemblyCode>004</AssemblyCode>
<PartCode>021</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>034</CompCode>
<ActionCode>10</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>BACK UP LIGHT</PTLComplaint>
<PTLCause>BLOWN</PTLCause>
<PTLCorrection>REPLACE CLEARANCE/MARKER LIGHT CAB AND CHASSIS ONLY-REAR RT</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>BACK UP LIGHT;LIGHTING SYSTEM;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>31.02</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>034</SystemCode>
<AssemblyCode>004</AssemblyCode>
<PartCode>021</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>034</CompCode>
<ActionCode>10</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>1</Hours>
<LineTotal>31.02</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>.33</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>034</SystemCode>
<AssemblyCode>004</AssemblyCode>
<PartCode>021</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>034</CompCode>
<ActionCode>10</ActionCode>
<Descrip>SALES TAX</Descrip>
<Hours />
<LineTotal>.33</LineTotal>
<LineType>TAX</LineType>
<Mechanic />
<PartID />
<QtyReqd>1</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>3.59</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>034</SystemCode>
<AssemblyCode>004</AssemblyCode>
<PartCode>021</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>034</CompCode>
<ActionCode>10</ActionCode>
<Descrip>LAMP,BACKUP</Descrip>
<Hours>0</Hours>
<LineTotal>3.59</LineTotal>
<LineType>PART</LineType>
<Mechanic />
<PartID>TL 40204</PartID>
<QtyReqd>1.0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>041</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>005</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>041</CompCode>
<ActionCode>10</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>LOW POWER</PTLComplaint>
<PTLCause>FILTER</PTLCause>
<PTLCorrection>COMPLETE AF - REPLACE AIR FILTER MAIN ENGINE (INCLUDES BOTH ON M2'S)</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>LOW POWER;AIR INTAKE SYSTEM;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>57.70</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>041</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>005</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>041</CompCode>
<ActionCode>10</ActionCode>
<Descrip>FILTER,ELEMENT,AIR FILTER</Descrip>
<Hours>0</Hours>
<LineTotal>57.70</LineTotal>
<LineType>PART</LineType>
<Mechanic />
<PartID>AF27879</PartID>
<QtyReqd>1.0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>31.02</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>041</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>005</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>041</CompCode>
<ActionCode>10</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>1</Hours>
<LineTotal>31.02</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>5.28</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>041</SystemCode>
<AssemblyCode>001</AssemblyCode>
<PartCode>005</PartCode>
<WorkAccomplishedCode>003</WorkAccomplishedCode>
<CompCode>041</CompCode>
<ActionCode>10</ActionCode>
<Descrip>SALES TAX</Descrip>
<Hours />
<LineTotal>5.28</LineTotal>
<LineType>TAX</LineType>
<Mechanic />
<PartID />
<QtyReqd>1</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
<OrderSec IsEmpty="N">
<Billable>Y</Billable>
<SystemCode>053</SystemCode>
<AssemblyCode>004</AssemblyCode>
<PartCode>001</PartCode>
<WorkAccomplishedCode>013</WorkAccomplishedCode>
<CompCode>053</CompCode>
<ActionCode>95</ActionCode>
<Complaint>PM</Complaint>
<CompltDate>05/02/2018 07:56:38 </CompltDate>
<PTLComplaint>CAMPAIGN</PTLComplaint>
<PTLCause>REQUIRED</PTLCause>
<PTLCorrection>COMPLETE OTH KIDDE CAMPAIGN - BUL#50-117 - REPLACE FIRE EXTINGUISHER</PTLCorrection>
<DelReason />
<ExtWarranty>N</ExtWarranty>
<Opened>05/01/2018 11:39:06 </Opened>
<Priority>5</Priority>
<RepReason>PM</RepReason>
<SecComment>CAMPAIGN;EXPENDABLES;INV#:0013903899</SecComment>
<SectionNum />
<TaxOverride />
<WarrType />
<OrderLine IsEmpty="N">
<AdditType />
<AfterMarket />
<ChgAmt>77.50</ChgAmt>
<ChgCateg>STANDARD</ChgCateg>
<ChgDate>05/02/2018 07:56:38 </ChgDate>
<ChgUOM>US$</ChgUOM>
<SystemCode>053</SystemCode>
<AssemblyCode>004</AssemblyCode>
<PartCode>001</PartCode>
<WorkAccomplishedCode>013</WorkAccomplishedCode>
<CompCode>053</CompCode>
<ActionCode>95</ActionCode>
<Descrip>LABOR</Descrip>
<Hours>.10</Hours>
<LineTotal>7.75</LineTotal>
<LineType>LABOR</LineType>
<Mechanic />
<PartID />
<QtyReqd>0</QtyReqd>
<QtyUOM />
<Taxable />
<TaxAmt />
<VendorLine />
</OrderLine>
</OrderSec>
</Order>
现在,一个典型的订单包含了大约60个这样的部分。长话短说,我需要从这些部分重新组合XML。
到目前为止,我已经创建了xml对象并创建了第一个节点(这些节点只是该文件中的一个),这是一个vendorinvoice。
# new xml
[xml]$Newxml = New-Object System.Xml.XmlDocument
$newxml.LoadXml("<?xml version=`"1.0`" encoding=`"us-ascii`"?><VendorInvoices></VendorInvoices>")
我需要将这些订单中的每一个都附加到VendorInvoice的VendorInvoice节点,我正在尝试执行以下操作:
foreach($VendorInvoice in $xml.VendorInvoices)
{
foreach($Order in $VendorInvoices.Order)
{
$newxml.AppendChild($Order.OuterXml)
$newxml.Save($Newxml)
}
}
但是,这样做似乎不会填充vendorinvoices节点下的任何内容:
xml VendorInvoices
--- --------------
version="1.0" encoding="us-ascii"
有人知道我哪里出错了吗?这个过程要求我从xml文件中删除很多内容,但这是我必须构建xml文件的第一个实例。
如果需要的话,我可以提供更多的信息。