Skip to content

Commit 769fe67

Browse files
author
Yoshinari Takaoka
committed
Add basic xmlwriter_write_cdata() example
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@350614 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent ee509a0 commit 769fe67

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

reference/xmlwriter/functions/xmlwriter-write-cdata.xml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 996c7338d52924681d477a3e03204102734083e1 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 7c015620f966babd49efbba3b22c1371f3f780b0 Maintainer: takagi Status: ready -->
44
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
55
<!-- Credits: mumumu -->
66
<refentry xml:id="function.xmlwriter-write-cdata" xmlns="http://docbook.org/ns/docbook">
@@ -50,6 +50,46 @@
5050
</para>
5151
</refsect1>
5252

53+
<refsect1 role="examples">
54+
&reftitle.examples;
55+
<example xml:id="xmlwriter-write-cdata.example.basic">
56+
<title><function>xmlwriter_write_cdata</function> の基本的な使い方</title>
57+
<programlisting role="php">
58+
<![CDATA[
59+
<?php
60+
// set up the document
61+
$xml = new XmlWriter();
62+
$xml->openMemory();
63+
$xml->setIndent(true);
64+
$xml->startDocument('1.0', 'UTF-8');
65+
$xml->startElement('mydoc');
66+
$xml->startElement('myele');
67+
68+
// CData output
69+
$xml->startElement('mycdataelement');
70+
$xml->writeCData("text for inclusion as CData");
71+
$xml->endElement();
72+
73+
// end the document and output
74+
$xml->endElement();
75+
$xml->endElement();
76+
echo $xml->outputMemory(true);
77+
?>
78+
]]>
79+
</programlisting>
80+
&example.outputs;
81+
<screen>
82+
<![CDATA[
83+
<mydoc>
84+
<myele>
85+
<mycdataelement><![CDATA[text for inclusion as CData]​]></mycdataelement>
86+
</myele>
87+
</mydoc>
88+
]]>
89+
</screen>
90+
</example>
91+
</refsect1>
92+
5393
<refsect1 role="seealso">
5494
&reftitle.seealso;
5595
<para>

0 commit comments

Comments
 (0)