Skip to Content
PHP编程:第4版
book

PHP编程:第4版

by Kevin Tatroe, Peter MacIntyre
January 2021
Intermediate to advanced
505 pages
9h 45m
Chinese
Publishing House of Electronics Industry
Content preview from PHP编程:第4版
290
12
XML
实体处理程序
实体在
XML
中是占位符。
XML
提供了
5
个标准的实体(
&
>
<
"
'
),
XML
文件也可以定义它自己的实体。很多实体定义不会触发事件,并
XML
解析器在文件中解析大多数实体是在调用其他处理程序之前。
有两种类型的实体
:外部的和未解析的,在
PHP
XML
库中有专门对它们的支持。
部实体
是指替换文本用文件名或
URL
定义而不是显式地在
XML
文件中给出。你可以为
要出现在字符数据中的外部实体定义一个要调用的处理程序,但是你要自己解析文件或
URL
中的内容来确定它是否正确。
未解析实体
必须伴随标记声明,当为未解析实体的声明标记定义处理程序时,出现的未
解析实体在字符数据处理程序调用前被从文本中删除。
外部实体
外部实体的引用允许
XML
文件包含另外一个
XML
文件。通常情况下,由一个外部
实体引用处理程序打开引用文件、解析文件并把结果包含进当前文件。用
xml_set_
external_entity_ref_handler()
来设置处理程序,它接受
XML
解析器引用和处理程序
函数名
xml_set_external_entity_ref_handler(
parser, handler
);
外部实体引用处理程序接受
5
个参数
:触发处理程序的解析器、实体名字、解析实体标
识符的基本统一资源标识符(
URI
通常为空)、系统标识符(比如文件名)和实体的公
共标识符,它们被定义在实体的声明中。例如
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

解密金融数据

解密金融数据

Justin Pauley
算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow
Java持续交付

Java持续交付

Daniel Bryant, Abraham Marín-Pérez

Publisher Resources

ISBN: 9787121404634