xml ,json 直接的比较 c++builder 2010

 

推荐一个我自己做的一个电影站,绝对没弹窗:-)  www.fastdy.com 速看电影吧,每天都更新,

最新的电影电视剧都在速看电影吧!~

 

 

 下面是循环 是与xml直接比较并赋值

 

xml

<?xml version="1.0" ?>

- <Root id="ESB_CORT_001">
- <FieldSet border="true" title_ch="基本" collapsible="true" autoHeight="true" iconCls="Relation" title_en="Major"> 
    <Field xtype="listbox" fieldLabel_ch="联络人二城市" fieldLabel_en="contact2 city" fieldtype="int" datatype="NUMBER" selectOnFocus="true" columnWidth_ch="0.25" columnWidth_en="0.25" form_echo="true" hidden="false" locked="false" menuDisabled="false" sortType="false" sortable="false" grid_echo="true" groupField="false" grid_editor="none" readOnly="false" disabled="false" editable="true" allowBlank="true" field_search="false" anchor_ch="0.95" anchor_en="0.95" width_ch="100" width_en="100" displayInfo="true" emptyMsg_ch="无记录" emptyMsg_en="No data to Displaying" field_ch="CONT_EMPE2_CITY" field_en="CONT_EMPE2_CITY" joinedfield_ch="CITY_NAME" joinedfield_en="EN_CITY_NAME" joinedkeyfield="CITY_NUM_ID" joinedtable_ch="CITY3" joinedtable_en="CITY3" language="all" table_ch="EX_ARC_CORT" table_en="EX_ARC_CORT" id="EX_ARC_CORT.CONT_EMPE2_CITY" field_actual="true" listBoxConfig="CITY" gridtitle_ch="城市" gridtitle_en="City" url="3.2" pageSize="20" displayMsg_ch="第 {0} - {1} 条记录 共{2}条" beforePageText_ch="" afterPageText_ch="页 共{0}页" displayMsg_en="Displaying {0} - {1} of {2}" beforePageText_en="Page" afterPageText_en="of {0}" resizable="false" joinedbasictable_ch="DISB_ARC_CITY" joinedbasictable_en="DISB_ARC_CITY" renderer="" serials="49" />
  </FieldSet>
  </Root>

 

 json

 

{
   "baseTable" : "EX_ARC_CORT",
   "baserightcontrol" : "true",
   "descreption" : "",
   "diffDomain" : "false",
   "fields" : [
      {
         "client" : {
            "allowBlank" : "true",
            "anchor_ch" : "0.95",
            "anchor_en" : "0.95",
            "columnWidth_ch" : "0.25",
            "columnWidth_en" : "0.25",
            "datatype" : "NUMBER",
            "disabled" : "true",
            "displayInfo" : "true",
            "editable" : "false",
            "emptyMsg_ch" : "无记录",
            "emptyMsg_en" : "No data to Displaying",
            "fieldClass" : "primary",
            "fieldLabel_ch" : "行号",
            "fieldLabel_en" : "No.",
            "field_actual" : "true",
            "field_autoget" : "01",
            "field_ch" : "SERIES",
            "field_default" : "SEQ_EX_ARC_CORT",
            "field_default_action" : "ADDGET",
            "field_default_type" : "AUTOGET",
            "field_en" : "SERIES",
            "field_search" : "false",
            "fieldtype" : "int",
            "form_echo" : "true",
            "grid_echo" : "true",
            "grid_editor" : "none",
            "groupField" : "false",
            "hidden" : "false",
            "joinedbasictable_ch" : "",
            "joinedbasictable_en" : "",
            "language" : "all",
            "locked" : "true",
            "menuDisabled" : "false",
            "primkey" : "true",
            "readOnly" : "false",
            "selectOnFocus" : "true",
            "serials" : "1",
            "sortable" : "false",
            "table_ch" : "EX_ARC_CORT",
            "table_en" : "EX_ARC_CORT",
            "width_ch" : "50",
            "width_en" : "50",
            "xtype" : "icotextfield"
         }
      },

 

{
         "client" : {
            "allowBlank" : "false",
            "anchor_ch" : "0.95",
            "anchor_en" : "0.95",
            "columnWidth_ch" : "0.25",
            "columnWidth_en" : "0.25",
            "datatype" : "VARCHAR2",
            "disabled" : "false",
            "displayInfo" : "true",
            "editable" : "true",
            "fieldLabel_ch" : "组织机构代码",
            "fieldLabel_en" : "Organization Code",
            "field_actual" : "true",
            "field_ch" : "ORG_CODE",
            "field_en" : "ORG_CODE",
            "field_search" : "true",
            "fieldtype" : "string",
            "form_echo" : "true",
            "grid_echo" : "true",
            "grid_editor" : "none",
            "groupField" : "false",
            "hidden" : "false",
            "joinedbasictable_ch" : "",
            "joinedbasictable_en" : "",
            "language" : "all",
            "locked" : "false",
            "menuDisabled" : "false",
            "readOnly" : "false",
            "selectOnFocus" : "true",
            "serials" : "56",
            "sortable" : "false",
            "table_ch" : "EX_ARC_CORT",
            "table_en" : "EX_ARC_CORT",
            "width_ch" : "150",
            "width_en" : "150",
            "xtype" : "icotextfield"
         }
      }
   ],
   "pageSize" : 50,
   "relations" : [
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "OWN_NUM_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "OWN_NUM_ID",
         "rightTable" : "EX_ARC_OWN",
         "rightTableAlias" : "OWN",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "ORN_NUM_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "ORN_NUM_ID",
         "rightTable" : "EX_ARC_CORT_ORN",
         "rightTableAlias" : "ORN",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "PRV_NUM_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "PRV_NUM_ID",
         "rightTable" : "DISB_ARC_PRV",
         "rightTableAlias" : "PRV",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "CITY_NUM_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "CITY_NUM_ID",
         "rightTable" : "DISB_ARC_CITY",
         "rightTableAlias" : "CITY",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "CITY_AREA_NUM_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "CITY_AREA_NUM_ID",
         "rightTable" : "DISB_ARC_CITY_AREA",
         "rightTableAlias" : "CITY_AREA",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "TOWN_NUM_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "TOWN_NUM_ID",
         "rightTable" : "DISB_ARC_TOWN",
         "rightTableAlias" : "TOWN",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "BEHF_CITY",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "CITY_NUM_ID",
         "rightTable" : "DISB_ARC_CITY",
         "rightTableAlias" : "CITY1",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "inner",
         "leftField" : "CREATE_USER_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "EMPE_NUM_ID",
         "rightTable" : "EX_ARC_EMPE",
         "rightTableAlias" : "EMPE1",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "inner",
         "leftField" : "LAST_UPDATE_USER_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "EMPE_NUM_ID",
         "rightTable" : "EX_ARC_EMPE",
         "rightTableAlias" : "EMPE2",
         "rightcontrol" : "",
         "sign" : ""
      },
      {
         "joinOperator" : "=",
         "joinType" : "outer",
         "leftField" : "ORN_SUB_NUM_ID",
         "leftTable" : "EX_ARC_CORT",
         "rightField" : "ORN_SUB_NUM_ID",
         "rightTable" : "EX_ARC_CORT_ORN_SUB",
         "rightTableAlias" : "ORN_SUB",
         "rightcontrol" : "",
         "sign" : ""
      }
   ],
   "tables" : [
      "EX_ARC_CORT",
      "EX_ARC_CORT_ORN",
      "EX_ARC_CORT_TYPE",
      "EX_ARC_OWN",
      "EX_ARC_EMPE",
      "DISB_ARC_CUY",
      "DISB_ARC_PRV",
      "DISB_ARC_CITY",
      "DISB_ARC_CITY_AREA",
      "DISB_ARC_TOWN",
      "EX_ARC_CORT_ORN_SUB"
   ],
   "thispagecount" : "false",
   "total" : "false",
   "where" : null
}
  
    IXMLDOMNodePtr fds = ManageForm->m_xmlFormDetal->selectSingleNode(L"Root");
    IXMLDOMNodeListPtr fields = fds->childNodes;
    int len = fields->length;
   int size = m_viewServer["fields"].size();
    Json::Value & client = m_viewServer["fields"];
    for (int k = 0; k < size; k++) {

        for (int i = 0; i < len; i++) {
            IXMLDOMElementPtr fieldsets = fields->get_item(i);
            IXMLDOMNodeListPtr fieldss = fieldsets->childNodes;
            int lengf = fieldss->length;
            for (int j = 0; j < lengf; j++) {
                IXMLDOMElementPtr fieldsss = fieldss->get_item(j);
                Variant fieldname = fieldsss->getAttribute(L"id");
                UnicodeString IDNAME = fieldname.VOleStr;

                if (client[k]["client"]["table_en"].asString()
                    + "." + client[k]["client"]["field_en"].asString()
                    == AnsiString(IDNAME).c_str()) {
                    irec++;
                    fieldsss->setAttribute(L"serials",
                        Variant(AnsiString(irec).c_str()));

                    client[k]["client"]["serials"] = AnsiString(irec).c_str();
                    break;
                }

            }
        }

    }
posted @ 2011-04-01 15:22  K.chaos  阅读(539)  评论(0编辑  收藏  举报