且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将以下C ++代码转换为XML

更新时间:2023-12-02 16:01:40

你不能。

XML是一种类似于HTML的语言,用于创建结构化文档和网页。

C ++是通用的面向对象编程语言。



你无法在C ++中轻松存储信息;您无法处理信息或使用XML编写应用程序。



请参阅此处: http ://www.w3schools.com/xml/ [ ^ ]

这里: http:/ /groups.engin.umd.umich.edu/CIS/course.des/cis400/xml/xml.html [ ^ ]
You can''t.
XML is a language similar to HTML used for creating structured documents and web pages.
C++ is a general purpose object oriented programming langusge.

You cannot comfortably store information in C++; you cannot process information or write an application in XML.

See here: http://www.w3schools.com/xml/[^]
And here: http://groups.engin.umd.umich.edu/CIS/course.des/cis400/xml/xml.html[^]


如前所述,XML不是一种编程语言,它就像HTML一种标记语言。

你能做的***的就是把代码分成两部分,第一部分读取配置xml

和第二部分处理xml。



所以你输入用户输入的地方可以转换为配置xml,如下所示



as stated earlier by others, XML is not a programming language its like HTML a markup language.
what best you can do is break up the code in to two parts, part1 reading the configuration xml
and part2 processing the xml.

so the place where you are taking the user inputs can be converted to configuration xml like below

<atminputs>
 <transaction type="" /> <!-- 1= FASTCASH, 2 = BALANCEINQUIRY, 3 = FUNDTRANSFER -->
 <fastcash amount="" /> <!-- user needs to fill this -->
 <balanceinquiry receipt="" pincode="" />
 <fundtransdfer amount="" toaccount="" />
<atminputs>





因此这将成为您的用户输入XML,然后休息处理保持不变。

所以只需解析xml的输入然后执行其余操作。

如果用户将值设置为1,则表示标签fastcash中的readonly值并进行处理。



so this becomes your input XML from user, and then rest processing remains the same.
so just parse the inputs from the xml and then do rest of the operations.
Like if user sets value as 1, then readonly values present in tag fastcash and do the processing.