如何搜索节点并删除xml中的子元素?

时间:2014-06-11 10:29:33

标签: c# xml

我有以下格式的xml:

<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="font-family: 'lucida grande', 'lucida sans unicode', arial, helvetica, sans-serif;font-size: 12px" xmlns="http://www.w3.org/2000/svg" version="1.1" width="600" height="400">
    <g class="highcharts-axis-labels highcharts-xaxis-labels">
        <text style="position: absolute; color: #606060; font-size: 11px; cursor: default; fill: #606060" opacity="1" z="32" x="107" y="300" transform="translate(0,0) rotate(45 107 300)" text-anchor="start">
            <tspan>% Service FTE</tspan>
            <tspan x="107" dy="15">Offshore/Total</tspan>
            <tspan x="107" dy="15">Service FTE</tspan>
        </text>        
        <text style="position: absolute; color: #606060; font-size: 11px; cursor: default; fill: #606060" opacity="1" z="32" x="493" y="300" transform="translate(0,0) rotate(45 493 300)" text-anchor="start">
            <tspan>Setup costs as %</tspan>
            <tspan x="493" dy="15">of sales EAR</tspan>
        </text>
    </g>        
    <g class="highcharts-axis-labels highcharts-yaxis-labels">
        <text style="position: absolute; color: #606060; font-size: 11px; cursor: default; fill: #606060" opacity="1" z="29" x="64" y="289" text-anchor="end">0</text>
        <text style="position: absolute; color: #606060; font-size: 11px; cursor: default; fill: #606060" opacity="1" z="15" x="62" y="238" text-anchor="end">25</text>
    </g>        
    <g style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; white-space: nowrap; cursor: default; padding-top: 0px" class="highcharts-tooltip"  transform="translate(0,-9999)">
        <path d="M 3 0 L 13 0 C 16 0 16 0 16 3 L 16 13 C 16 16 16 16 13 16 L 3 16 C 0 16 0 16 0 13 L 0 3 C 0 0 0 0 3 0"  fill="none" stroke="black" stroke-width="5" transform="translate(1, 1)" stroke-opacity="0.05"></path>        
        <path d="M 3 0 L 13 0 C 16 0 16 0 16 3 L 16 13 C 16 16 16 16 13 16 L 3 16 C 0 16 0 16 0 13 L 0 3 C 0 0 0 0 3 0" fill="rgba(249, 249, 249, .85)" stroke-width="1"></path>
        <text style="position: absolute; color: #333333; font-size: 12px; fill: #333333" x="8"  y="21"></text>
    </g>
    <text style="position: absolute; color: #909090; font-size: 9px; cursor: pointer; fill: #909090" x="590"  y="395" text-anchor="end"></text>
</svg>

我想更新某些节点     tspan x =&#34; 493&#34; DY =&#34; 15&#34; 等,如果有任何使用c#的话,删除最后一个节点,最后一个节点及其子节点。

请帮忙。

1 个答案:

答案 0 :(得分:0)

循环每个节点完成了这项工作。谢谢大家