Create multiple XML Nodes
Using xml.nsh plugin created by Instructor.
I am trying to create three similar Nodes at the end of Server/Services/Engine/Host. When I create just one Node everything works fine. When I generate multiples, the result is less than desirable.
My test script:
#XML Plugin Examples
Name "XMLTest"
OutFile "XMLTest.exe"
!include "XML.nsh"
# open section
section
; Example of usage
${xml::LoadFile} "C:\Contenta36Install\NSIS Scripts\test.xml" $0
${xml::GotoPath} "/config/local/host" $0
${xml::CreateNode} '<Context docBase="E:\ContentaView\" path="/servlets3"></Context>' $0
${xml::InsertEndChild} "$0" $0
${xml::CreateNode} '<Context docBase="G:\ContentaViewData\collections\NIAPS_ContentaView3.6\httpdocs\" path="/wietmsd"></Context>' $0
${xml::InsertEndChild} "$0" $0
${xml::CreateNode} '<Context docBase="G:\ContentaViewData\collections\" path="/collections"></Context>' $0
${xml::InsertEndChild} "$0" $0
${xml::SaveFile} "C:\Contenta36Install\NSIS Scripts\test.xml" $0
${xml::Unload} ; unload plugin
# end the section
SectionEnd
Test Results:
<config>
<local>
<host>
<Context docBase="E:\ContentaView\" path="/servlets3">
<Context docBase="G:\ContentaViewData\collections\NIAPS_ContentaView3.6\httpdocs\" path="/wietmsd">
<Context docBase="G:\ContentaViewData\collections\" path="/collections" />
</Context>
</Context>
</host>
</local>
</config>
Target Results for Production:
<Valve className="org.jboss.web.tomcat.tc5.jca.CachedConnectionValve" cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager" transactionManagerObjectName="jboss:service=TransactionManager" />
<Context docBase="E:\ContentaView\" path="/servlets3" />
<Context docBase="G:\ContentaViewData\collections\NIAPS_ContentaView3.6\httpdocs\" path="/wietmsd" />
<Context docBase="G:\ContentaViewData\collections\" path="/collections" />
</Host>
</Engine>
</Service>
</Server>
Notes for desired result:
The last three Context Nodes are added just before the closing Host Element without deleting any of the other Host children, i.e Valve.
Any suggestions would be gratefully appreciated.
Thank you in advance