xml_is_well_formed()

检查 XML 数据是否格式良好的函数

xml_is_well_formed() 是一个系统函数,它会检查提供的 XML 文本值是否表示格式良好的内容或格式良好的文档(取决于当前的 xmloption 设置)。

xml_is_well_formed() 添加于 PostgreSQL 9.1

用法

xml_is_well_formed ( text ) → boolean

xml_is_well_formed() 有助于确定是否可以将普通类型转换为 xml 数据类型并成功。

变更历史

示例

xml_is_well_formed() 的基本用法示例

postgres=# SHOW xmloption;
 xmloption 
-----------
 content
(1 row)
postgres=# SELECT xml_is_well_formed('foobar'); xml_is_well_formed -------------------- t (1 row) postgres=# SET xmloption TO document; SET postgres=# SELECT xml_is_well_formed('foobar'); xml_is_well_formed -------------------- f (1 row) postgres=# SELECT xml_is_well_formed('<baz>foobar</baz>'); xml_is_well_formed -------------------- t (1 row)

分类

系统函数, XML

另请参阅

xml_is_well_formed_content(), xml_is_well_formed_document(), xmloption

反馈

提交关于“xml_is_well_formed()”的任何评论、建议或更正 在此处