dsgixl5195 2012-08-28 00:03
浏览 146
已采纳

PHP和XML之间有什么关系?

I'm learning about PHP and web coding.
Specifically, the PHP book I'm using that covers PHP 5.3 (by Matt Doyle and published by Wrox), says:

XML ... lets you create text documents that can hold data in a structured way...
XML isn't really a language but rather a sepcification for creating your own markup languages...

Wikipedia says of XML:

As of 2009, hundreds of XML-based languages have been developed,[8] including RSS, Atom, SOAP, and XHTML. XML-based formats have become the default for many office-productivity tools, including Microsoft Office (Office Open XML), OpenOffice.org and LibreOffice (OpenDocument), and Apple's iWork.[9] XML has also been employed as the base language for communication protocols, such as XMPP.

It sounds like XML is more like a protocol, a standard for allowing compuers to communicate and share information.

So XML is like a grammar I can use to create a markup language, but the language I create only formats data?

I want help defining the relationship between PHP and XML. When during the processesing of PHP and HTML does XML get parsed?

  • 写回答

3条回答 默认 最新

  • donglan6777 2012-08-28 00:05
    关注

    XML is not a grammar (that's another thing entirely). XML (as the name suggests) is a markup language that essentially defines a set of rules that describe something. The "something" could be a protocol, the structure of a document, or any kind of data. XML is designed to be machine readable and human readable (although in my opinion, with bias towards the former ;)).

    XML documents use something called a schema which describes the structure of the XML itself, and so you can validate an XML document against a schema to make sure that it is well-formed.

    There is no relation between PHP and XML. XML is something that PHP can consume and produce. There is nowhere during processing that PHP consumes or produces XML unless you explicitly tell PHP to do so.

    XML is sometimes used as sort a of "glue" that allows dissimilar or disparate systems to communicate with each other, but even that is just one of its functions. For example, PHP can consume XML produced by a program written in another language entirely, or XML produced by some website. PHP can also produce XML which can then be consumed by a program written in another language, or by some other source. As you found from the Wikipedia article, SOAP uses XML and this allows clients written in different languages to consume data exposed by a SOAP service.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 广告联盟的兜底广告是什么意思
  • ¥15 如何证明高斯噪声的包络公式
  • ¥150 寻找王者荣耀开发作者,合作或者解答
  • ¥15 乳腺癌数据集 相关矩阵 特征选择
  • ¥15 我的游戏账号被盗取,请问我该怎么做
  • ¥15 通关usb3.0.push文件,导致usb频繁断连
  • ¥15 有没有能解决微信公众号,只能实时拍照,没有选择相册上传功能,我不懂任何技术,,有没有给我发个软件就能搞定的方法
  • ¥15 Pythontxt文本可视化
  • ¥15 如何基于Ryu环境下使用scapy包进行数据包构造
  • ¥15 springboot国际化