zoukankan      html  css  js  c++  java
  • FLEX 合并两个XML的属性

    例如:

    oldXml

    <object datePoint="2011-03-05" PT_staticCount="3" UOC_staticCount="3"/>
    <object datePoint="2011-03-06" PT_staticCount="5" UOC_staticCount="9"/>
    <object datePoint="2011-03-07" PT_staticCount="9" UOC_staticCount="7"/>
    <object datePoint="2011-03-08" PT_staticCount="15" UOC_staticCount="9"/>
    <object datePoint="2011-03-09" PT_staticCount="6" UOC_staticCount="5"/>
    <object datePoint="2011-03-10" PT_staticCount="6" UOC_staticCount="4"/>
    

    newXml

    <object datePoint="2011-03-05" UOC_staticCount="3"/>
    <object datePoint="2011-03-06" UOC_staticCount="9"/>
    <object datePoint="2011-03-07" UOC_staticCount="7"/>
    <object datePoint="2011-03-08" UOC_staticCount="9"/>
    <object datePoint="2011-03-09" UOC_staticCount="5"/>
    <object datePoint="2011-03-10" UOC_staticCount="4"/>
    

    可以是用如下函数进行合并

    private function mergeTwoXml(oldXml:XMLList, newXml:XMLList, propertyInNewXMl:String):XMLList
    {
    	for(var i:int = 0; i < oldXml.length(); i++)
    	{
    		oldXml[i].@[propertyInNewXMl+"_staticCount"] = newXml[i].attribute(propertyInNewXMl+"_staticCount");
    	}
        return oldXml;
    }
    

    输出的内容为:

    <object datePoint="2011-03-05" PT_staticCount="3" UOC_staticCount="3"/>
    <object datePoint="2011-03-06" PT_staticCount="5" UOC_staticCount="9"/>
    <object datePoint="2011-03-07" PT_staticCount="9" UOC_staticCount="7"/>
    <object datePoint="2011-03-08" PT_staticCount="15" UOC_staticCount="9"/>
    <object datePoint="2011-03-09" PT_staticCount="6" UOC_staticCount="5"/>
    <object datePoint="2011-03-10" PT_staticCount="6" UOC_staticCount="4"/>
    
  • 相关阅读:
    甘超波:NLP五步脱困法
    甘超波:NLP换框法
    甘超波:NLP先跟后带
    甘超波:NLP瞬间亲和力
    甘超波:NLP回应与建议技巧
    甘超波:NLP复述
    甘超波:NLP新旧ABC觉察法
    甘超波:NLP潜意识和意识
    甘超波:NLP人际界线
    甘超波:NLP表象系统
  • 原文地址:https://www.cnblogs.com/zcy_soft/p/1979900.html
Copyright © 2011-2022 走看看