在c linux中加载xml [英] Load xml in c linux

查看:103
本文介绍了在c linux中加载xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

如何通过linux在c编程中加载一个xml文件并对其内容进行一些搜索?

感谢您的帮助:)

Hello,
how to load an in xml file in c programming via linux and do some searches on it content ?
thanks for helping :)

推荐答案

这里有两个用C编写的可用XML解析器:

http://www.jclark.com/xml/expat.html [ ^ ],

http://www.xmlsoft.org/ [ ^ ]。



这样的解析器很不寻常。通常,XML解析器是使用更高级的语言开发的; C似乎不切实际。







好​​的,最后你告诉我你需要写一个解析器。不幸的是,我们没有辅导资源,编写解析器很难用论坛的格式来解释。



首先,你需要知道XML标准非常好:

http://en.wikipedia.org/wiki/XML [ ^ ],

http://www.w3.org/XML/ [ ^ ]。



这是一个非常有用的资源,因为官方XML的表述很差: http://www.xml.com/axml/testaxml.htm [ ^ ]。



和你需要至少学习解析器的一些东西。这个话题并不容易。请参阅:

http://en.wikipedia.org/wiki/Parsing [< a href =http://en.wikipedia.org/wiki/Parsingtarget =_ blanktitle =New Window> ^ ]。



请参阅本维基页面的所有参考资料。



最后,您需要很多耐心。解析一般来说是一个非常困难的主题,到目前为止,XML并不像看起来那么简单,而且C非常困难且容易出错,根本不足以解决这些问题。从好的方面来说,如果你做得好,你可以获得积极和消极的丰富经验。 :-)



祝你好运,

-SA
Here are two available XML parsers written in C:
http://www.jclark.com/xml/expat.html[^],
http://www.xmlsoft.org/[^].

Such parsers are unusual. Usually, XML parsers are developed using more advanced languages; C seems impractical.



OK, finally you told me that you are required to write a parser. Unfortunately, we don''t have resource for tutoring, and writing parsers can hardly be explained in the format of the forum.

First, you need to know the XML standard very well:
http://en.wikipedia.org/wiki/XML[^],
http://www.w3.org/XML/[^].

This is a very useful resource, as the official XML is formulated poorly: http://www.xml.com/axml/testaxml.htm[^].

And you need to learn at least something about parsers. This topic is not so easy. Please see:
http://en.wikipedia.org/wiki/Parsing[^].

Please see all the references from this Wiki page.

And finally, you will need a lot of patience. Parsing in general is a pretty difficult topic, XML is, by far, not as simple as it seems, and C is very difficult and error prone, not adequate at all for solving such problems. On the bright side, if you do this work well, you can get tremendous experience, both positive and negative. :-)

Good luck,
—SA


这篇关于在c linux中加载xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆