Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XML元素自动值更改_Xml - Fatal编程技术网

XML元素自动值更改

XML元素自动值更改,xml,Xml,嗨,这是一个巨大的文件,我需要将元素“累加器因子”的值更改为元素“价格” 示例:在节点PrePaid2pFactor中,价格是60,所以元素“累加器因子”也应该是60 <NodeCopy><Node>SC14 <Condition>ServiceClass <Comment>SC 14 with access fees of 12500 for 30 days</Comment> <Valu

嗨,这是一个巨大的文件,我需要将元素“累加器因子”的值更改为元素“价格”

示例:在节点PrePaid2pFactor中,价格是60,所以元素“累加器因子”也应该是60

<NodeCopy><Node>SC14
    <Condition>ServiceClass
        <Comment>SC 14 with access fees of 12500 for 30 days</Comment>
        <Values>14</Values>
    </Condition>
    <Node>Community CUG
        <Node>Prepaid2Prepaid
            <Condition>BooleanOperator
                <Operation>AND</Operation>
                <Condition>NumberList
                    <Type>0</Type>
                    <Number>75</Number>
                </Condition>
                <Condition>CommunityId
                    <Value>1-999</Value>
                </Condition>
            </Condition>
            <Tariff>Rate
                <UnitType>Time</UnitType>
                <Price>60.0
                    <Factor>60</Factor>
</Price>
                <Interval>1
                    <Factor>1</Factor>
</Interval>
                <UpdateType>Active</UpdateType>
                <AccumulatorFactor>0.0</AccumulatorFactor>
            </Tariff>
        </Node>
    </Node>
    <Node>A2A
        <Condition>NumberList
            <Type>0</Type>
            <Number>75</Number>
        </Condition>
        <Node>Price
            <Tariff>Rate
                <UnitType>Time</UnitType>
                <Price>163.2
                    <Factor>60</Factor>
</Price>
                <Interval>1
                    <Factor>1</Factor>
</Interval>
                <UpdateType>Active</UpdateType>
                <AccumulatorFactor>0.0</AccumulatorFactor>
            </Tariff>
        </Node>
    </Node>
    <Node>All Operators
        <Condition>NumberList
            <Type>0</Type>
            <Number>77,78
70
76
2911,1108,1177
79
71
3,4,2
121,185,200,91,888,971,2070,890,913,189
555,809</Number>
        </Condition>
        <Node>Price
            <Tariff>Rate
                <UnitType>Time</UnitType>
                <Price>178.8
                    <Factor>60</Factor>
</Price>
                <Interval>1
                    <Factor>1</Factor>
</Interval>
                <UpdateType>Active</UpdateType>
                <AccumulatorFactor>0.0</AccumulatorFactor>
            </Tariff>
        </Node>
    </Node>
</Node>
</NodeCopy>
SC14
服务类
SC 14,30天的访问费为12500
14
社区CUG
预付款
布尔算子
及
数学家
0
75
社区ID
1-999
比率
时间
60
60
1.
1.
活跃的
0
A2A
数学家
0
75
价格
比率
时间
163.2
60
1.
1.
活跃的
0
所有操作员
数学家
0
77,78
70
76
2911,1108,1177
79
71
3,4,2
121,185,200,91,888,971,2070,890,913,189
555,809
价格
比率
时间
178.8
60
1.
1.
活跃的
0

您可以在另一个xml文件的帮助下更改一个xml文件的xml元素。

您尝试了什么?你是用Java做这个的吗?XSLT1?XSLT2?其他语言吗?
prepaid
节点和匹配的
元素在结构上是如何关联的?始终如示例所示,或者它们可能位于不同的位置,您如何知道哪两个匹配?在这里我们可以提供帮助之前,还有很多问题。tariff有价格和累加器因子,我想在xml中更改累加器因子的值,它应该等于元素价格抱歉,我对这一点完全陌生,只是想减少手动更改xml中累加器因子的工作量
    public void OverWriteXMLElement()
     {
        string AppFileurl = System.Web.HttpContext.Current.Server.MapPath(@"~/Config/GlobalConfig.aspx.cs.xml");
        XmlDocument xDoc = new XmlDocument();
        xDoc.Load(AppFileurl);

        string UserFileurl = System.Web.HttpContext.Current.Server.MapPath(@"~/Config/UserManagement.aspx.cs.xml");
        XmlDocument UserDoc = new XmlDocument();
        UserDoc.Load(UserFileurl);


        XmlNodeList aNodes = xDoc.SelectNodes("/Application/PageSetting/Pagination");
        XmlNodeList UNodes = UserDoc.SelectNodes("/UserManagement/PageSetting/Pagination");

        foreach (XmlNode unode in UNodes)           
        {
            XmlNode child1 = unode.SelectSingleNode("PageSize");

            if (child1.InnerText == "" || child1.InnerText == null)
            {
                foreach (XmlNode node in aNodes)
                {
                    child1.InnerText = node.SelectSingleNode("PageSize").InnerText;
                    UserDoc.Save(UserFileurl);
                }
            }
        }