I have following XML code:
<?xml version="1.0" encoding="UTF-8"?>
<gfx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Gfx-SE8.xsd">
<displaySettings displayType="replace" position="useCurrentPosition" securityCode="*" backColor="white" />
<group name="Group2" visible="true" wallpaper="false" toolTipText="" exposeToVba="vbaControl" isReferenceObject="true">
<numericDisplay name="NumericDisplay2" height="20" width="252" left="259" top="305" visible="true">
<animations>
<animateVisibility expression="{#2}" expressionTrueState="visible"/>
</animations>
<connections>
<connection name="Value" expression="{#1}"/>
</connections>
</numericDisplay>
<text name="Text1" height="19" width="15" left="356" top="274"/>
<parameters>
<parameter name="#1" description="" value="Tag1"/>
<parameter name="#2" description="" value="Tag2"/>
</parameters>
</group>
I want to duplicate node "Group" several times with following conditions:
1.Value of "Name" Attribute of all child nodes except "Parameter" node, should be unique (It is incremental) like Group1,Group2...etc.
Following is the result that i need:
<?xml version="1.0" encoding="UTF-8"?>
<gfx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Gfx-SE8.xsd">
<displaySettings displayType="replace" position="useCurrentPosition" securityCode="*" backColor="white" />
<group name="Group3" visible="true" wallpaper="false" toolTipText="" exposeToVba="vbaControl" isReferenceObject="true">
<numericDisplay name="NumericDisplay3" height="20" width="252" left="259" top="305" visible="true">
<animations>
<animateVisibility expression="{#2}" expressionTrueState="visible"/>
</animations>
<connections>
<connection name="Value1" expression="{#1}"/>
</connections>
</numericDisplay>
<text name="Text2" height="19" width="15" left="356" top="274"/>
<parameters>
<parameter name="#1" description="" value="Tag1"/>
<parameter name="#2" description="" value="Tag2"/>
</parameters>
</group>
<group name="Group4" visible="true" wallpaper="false" toolTipText="" exposeToVba="vbaControl" isReferenceObject="true">
<numericDisplay name="NumericDisplay4" height="20" width="252" left="259" top="305" visible="true">
<animations>
<animateVisibility expression="{#2}" expressionTrueState="visible"/>
</animations>
<connections>
<connection name="Value2" expression="{#1}"/>
</connections>
</numericDisplay>
<text name="Text3" height="19" width="15" left="356" top="274"/>
<parameters>
<parameter name="#1" description="" value="Tag1"/>
<parameter name="#2" description="" value="Tag2"/>
</parameters>
</group>
Like wise i want duplicate complete node with several times.
I am using VB.net (Visual Studio 2010)
Any help really appreatiate
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…