基本信息
源码名称:算法小工具
源码大小:6.35M
文件格式:.rar
开发语言:C#
更新时间:2021-06-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍
ISO8583报文解析工具

#include "StdAfx.h"
#include "DealXML.h"

DealXML::DealXML(void)
{
        xmldoc = (gcnew System::Xml::XmlDocument());
}

array<System::String ^>^ DealXML::read(System::String^ filename)
{
        int i;
        array<System::String ^>^ xmls = (gcnew array<System::String ^>(64));
        try{
                this->xmldoc->Load(filename);
                System::Xml::XmlElement^ root = xmldoc->DocumentElement;
                /*
                System::Xml::XmlElement^ theBook = xmldoc->CreateElement("book");
                System::Xml::XmlElement^ theElem = xmldoc->CreateElement("name");
                theElem->InnerText = "新书";
                theBook->AppendChild(theElem);
                
                theElem = xmldoc->CreateElement("price");
                theElem->InnerText = "100RMB";
                theBook->AppendChild(theElem);
                
                theElem = xmldoc->CreateElement("memo");
                theElem->InnerText = "天天向上";
                theBook->AppendChild(theElem);
                
                root->AppendChild(theBook);
                */
                /*
                System::Xml::XmlElement^ theBook = (System::Xml::XmlElement^)root->GetElementsByTagName("book")->Item(0);
                xmls[0] = theBook->SelectSingleNode("name")->InnerText->ToString();
                xmls[1] = theBook->SelectSingleNode("price")->InnerText->ToString();
                xmls[2] = theBook->SelectSingleNode("memo")->InnerText->ToString();
                xmls[3] = theBook->GetAttribute("id")->ToString();
                */
                System::Xml::XmlNodeList^ fileds = root->SelectNodes("field");
                for(i=0; i<64; i )
                {
                        System::Xml::XmlElement^ field = (System::Xml::XmlElement^)fileds->Item(i);
                        System::String^ ref = field->GetAttribute("ref")->ToString();
                        System::String^ name = field->GetAttribute("name")->ToString();
                        System::String^ len = field->GetAttribute("length")->ToString();
                        System::String^ type = field->GetAttribute("type")->ToString();
                        System::String^ var = field->GetAttribute("var")->ToString();
                        int tp = System::Int16::Parse(ref);
                        xmls[tp-1] = ref ":" name "-" len "-" type;     
                        if(var != "")xmls[tp-1] = "-" var;
                 }
        }catch(System::Exception^ ex){
                ex->Message;
        }
        return xmls;
}

void DealXML::write(System::String^ filename)
{
}