【发布时间】:2016-06-24 06:02:31
【问题描述】:
我想从 xml 文件中复制完整的节点并使用该节点创建新的 xml 文件。
假设该节点由对象组成...例如 button-1、Poygon-1...等
我想通过将名称更改为 ....Button-2、Polygon-2..etc 来创建多个节点。
就像我的节点名称是
组名="GO_P_AIn1"
我想创建“GO_P_AIn2”、“GO_P_AIn3”、“GO_P_AIn3”
我想在 VB.net 中创建函数......每次它以节点作为输入并使用相同的节点在输出 xml 文件中创建节点数,只需更改对象的名称即可。
<group name="GO_P_AIn1" visible="true" wallpaper="false" toolTipText="/*S:0 {#102.Cfg_Tag}*/: /*S:0 #102.Cfg_Desc*/" exposeToVba="notExposed" isReferenceObject="true" linkSize="true" linkConnections="true" linkAnimations="linkWithExpression" linkBaseObject="(RA-BAS) P_AIn Graphics Library.GO_P_AIn" linkToolTipText="true">
<rectangle name="AIN_AlarmPolygon1" height="41" width="146" left="500" top="168" visible="true" toolTipText="" exposeToVba="notExposed" isReferenceObject="true" linkSize="true" linkConnections="true" linkAnimations="linkWithExpression" linkBaseObject="(RA-BAS) P_AIn Graphics Library.AIN_AlarmPolygon" linkToolTipText="true" backStyle="transparent" backColor="#E0E0E0" foreColor="black" lineStyle="solid" lineWidth="2" patternStyle="none" patternColor="black" endColor="white" gradientStop="50" gradientDirection="gradientDirectionHorizontal" gradientShadingStyle="gradientHorizontalFromRight">
</rectangle>
<button name="AIN_Button_Faceplate1" height="35" width="140" left="503" top="171" visible="true" toolTipText="" exposeToVba="notExposed" isReferenceObject="true" linkSize="true" linkConnections="true" linkAnimations="linkWithExpression" linkBaseObject="(RA-BAS) P_AIn Graphics Library.AIN_Button_Faceplate" linkToolTipText="true" style="3d" captureCursor="false" highlightOnFocus="true" tabIndex="6">
<command pressAction="" repeatAction="" releaseAction="Display ($#102.Inf_Lib$) $#102.Inf_Type$-Faceplate /T{#102},{#103},"#120","#121",{X} #120 #121" repeatRate="0.25"/>
<up patternColor="black" patternStyle="none" backColor="#E0E0E0" backStyle="solid" foreColor="black" endColor="white" gradientStop="50" gradientDirection="gradientDirectionHorizontal" gradientShadingStyle="gradientHorizontalFromRight">
<caption fontFamily="Arial" fontSize="8" bold="false" italic="false" underline="false" strikethrough="false" caption=""/>
<imageSettings imageReference="noImage"/>
</up>
<down downSameAsUp="true" patternColor="black" patternStyle="none" backColor="#ECE9D8" backStyle="solid" foreColor="black" endColor="white" gradientStop="50" gradientDirection="gradientDirectionHorizontal" gradientShadingStyle="gradientHorizontalFromRight">
<caption fontFamily="Arial" fontSize="8" bold="false" italic="false" underline="false" strikethrough="false" caption=""/>
<imageSettings imageReference="noImage"/>
</down>
<ability showDisabledState="false" expression="" enabledWhenExpressionIsTrue="true" disabledImageType="useGrayscale"/>
<confirm confirmAction="false" buttonSetting="okCancel" titleBar="true" titleBarText="Confirmation" windowPosition="Centered of screen">
<caption fontFamily="Arial" fontSize="10" bold="false" italic="false" underline="false" strikethrough="false" caption="Are you sure you want to perform this action?"/>
<imageSettings imageReference="noImage"/>
</confirm>
</button>
<button name="AIN_Button_Quick1" height="35" width="140" left="503" top="171" visible="true" toolTipText="" exposeToVba="notExposed" isReferenceObject="true" linkSize="true" linkConnections="true" linkAnimations="linkWithExpression" linkBaseObject="(RA-BAS) P_AIn Graphics Library.AIN_Button_Quick" linkToolTipText="true" style="3d" captureCursor="false" highlightOnFocus="true" tabIndex="5">
<command pressAction="" repeatAction="" releaseAction="Display ($#102.Inf_Lib$) $#102.Inf_Type$-Quick /T{#102},{#103},"#120","#121",{X} #120 #121" repeatRate="0.25"/>
</button>
<parameters>
<parameter name="#102" description="Object Tag (P_AIn, P_AInAdv, P_AInDual, or P_AInMulti)" value=" "/>
<parameter name="#103" description="Path (include program scope if tag is a program scope tag)" value="[BOP]"/>
<parameter name="#120" description="Additional display parameter (e.g. /X100 or /CC) (optional)" value="0"/>
<parameter name="#121" description="Additional display parameter (e.g. /Y100) (optional)" value="0"/>
<parameter name="#122" description="0 = Always show Faceplate; 1= Show Quick Display for users without Maintenance Access (Code C); 2 = Always Show Quick Display" value="0"/>
</parameters>
</group>
【问题讨论】:
-
您需要发布一个更好的示例来显示更改后的数据。不要包含 up/down/ability/confirm 等子节点,除非它们很重要。
-
谢谢,我的要求是……我想生成一个包含多个节点的 xmi 文件。假设...输入 xml 节点:
我想要这样的输出: n 次
标签: xml vb.net xml-parsing