首页 > 开发 > PHP > 正文

PHP中的DOM XML函数

2024-05-04 22:59:10
字体:
来源:转载
供稿:网友

dom xml functions
these functions are only available if php was configured with --with-dom=[dir], using the gnome xml library. you will need at least libxml-2.0.0 (the beta version will not work). these functions have been added in php4.

this module defines the following constants:

table 1. xml constants

constant value description
xml_element_node 1
xml_attribute_node 2
xml_text_node 3
xml_cdata_section_node 4
xml_entity_ref_node 5
xml_entity_node 6
xml_pi_node 7
xml_comment_node 8
xml_document_node 9
xml_document_type_node 10
xml_document_frag_node 11
xml_notation_node 12
xml_global_namespace 1
xml_local_namespace 2

this module defines a number of classes. the dom xml functions return a parsed tree of the xml document with each node being an object belonging to one of these classes.

xmldoc
(php4 >= 4.0b4)

xmldoc -- creates a dom object of an xml document
description

object xmldoc (string str)


the function parses the xml document in str and returns an object of class "dom document", having the properties "doc" (resource), "version" (string) and "type" (long).

xmldocfile
(php4 >= 4.0b4)

xmldocfile -- creates a dom object from xml file
description

object xmldocfile (string filename)


the function parses the xml document in the file named filename and returns an object of class "dom document", having the properties "doc" (resource), "version" (string).

xmltree
(php4 >= 4.0b4)

xmltree -- creates a tree of php objects from xml document
description

object xmltree (string str)


the function parses the xml document in str and returns a tree php objects as the parsed document.


 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表