【发布时间】:2021-01-07 17:43:08
【问题描述】:
profile.xml 的内容:
<files>
<file folder="CaptureServer" filename="CSConfig" object="CSConfig">
<Profile name="BBH1200Kofax">
<OutputCache>\</OutputCache>
<EncryptedConnectionString>564rgr=</EncryptedConnectionString>
<ConvertDocsBeforeRelease>false</ConvertDocsBeforeRelease>
</Profile>
</file>
<file folder="CaptureServices3" filename="CSConfig" object="CSConfig">
<Profile name="BBH1200Kofax">
<ReleaseToEnterprise>true</ReleaseToEnterprise>
<CaptureServerUrl />
<OutputCache />
<Credentials>
<EncryptedPassword>46s4rg=</EncryptedPassword>
<UserName />
<Domain />
</Credentials>
<ConvertDocsBeforeRelease>false</ConvertDocsBeforeRelease>
</Profile>
</file>
</files>
rules.xml 的内容:
<file folder="" filename="Rules" object="ArrayOfIBarcodeRule">
<Profile name="Test471">
<IBarcodeRule>
<RuleName>DOC-TESTTESTTEST-Code128</RuleName>
<FieldSequenceNumber>1</FieldSequenceNumber>
<FieldRectangle>
<Location>
<X>0</X>
<Y>0</Y>
</Location>
<Size>
<Width>0</Width>
<Height>0</Height>
</Size>
</FieldRectangle>
<SeparationValue>TESTTESTTEST</SeparationValue>
</IBarcodeRule>
</Profile>
</file>
我正在尝试将 rules.xml(文件节点)的全部内容添加为 profile.xml 中的另一个节点。如您所见,profile.xml中还有一堆其他文件节点,而rules.xml将是另一个。
这是我尝试过的代码,它似乎没有做任何事情:
$xml = [xml](Get-Content ".\profile.xml")
$newxml = [xml](Get-Content ".\rules.xml")
$xml.ImportNode($newxml.get_DocumentElement(), $true)
$xml.Save(".\profile.xml")
【问题讨论】:
标签: xml powershell