The contents of 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>
The contents of the 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>
I am trying to add the entire contents of rules.xml (node file) as another node in profile.xml. As you can see, there are many other file nodes in the profile.xml file, and rules.xml is another one.
This is the code I tried and it does nothing:
$xml = [xml](Get-Content ".\profile.xml")
$newxml = [xml](Get-Content ".\rules.xml")
$xml.ImportNode($newxml.get_DocumentElement(), $true)
$xml.Save(".\profile.xml")
Seanm source
share