XML解析器与正则表达式 [英] XML parser vs regex

查看:113
本文介绍了XML解析器与正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用什么?

我将获取链接,图像,文本等,并将其用于构建seo统计信息和页面分析.

I am going to fetch links, images, text, etc and use it for using it building seo statistics and analysis of the page.

您建议使用什么? XML解析器或正则表达式

What do you recommend to be used? XML Parser or regex

我一直在使用正则表达式,但从未遇到过任何问题,但是,我一直在听人们说它不能做某些事情,等等……但是说实话,我不知道为什么,但是我恐怕要使用XML解析器,而更喜欢使用正则表达式(它可以很好地工作并且可以很好地达到目的)

I have been using regex and never have had any problems with it however, I have been hearing from people that it can not do some things and blah blah blah...but to be honest I don't know why but I am afraid to use XML parser and prefer regex (and it works and serves the purpose pretty well)

因此,如果正则表达式一切正常,为什么我要问您使用什么呢?好吧,我认为即使到目前为止一切都很好,并不意味着将来也会如此,所以我只想知道在正则表达式上使用XML解析器的好处是什么?在性能方面是否有任何改进,更少的错误发生,更好的支持,其他亮点功能等?

So, if everything is working well with regex why am I here to ask you what to use? Well, I think that even though everything has been fine so far doesn't mean it will be in the future as well, so I just wanted to know what are the benifits of using a XML parser over regex? Are there any improvements in performances, less error prone, better support, other shine features, etc?

如果您建议使用XML解析器,则推荐将其与PHP一起使用

If you do suggest to use XML parser then which is recommended one to be used with PHP

我绝对想知道您为什么要选择一个?

I would most definitely like to know why would you pick one over the other?

推荐答案

我应该使用什么?

What should I use?

您应该使用 XML解析器.

如果您建议使用XML解析器,则推荐将其与PHP一起使用

If you do suggest to use XML parser then which is recommended one to be used with PHP

请参阅:适用于PHP的健壮且成熟的HTML解析器.

这篇关于XML解析器与正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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