mirror of
https://github.com/php/doc-ja.git
synced 2026-04-26 01:18:04 +02:00
768e8d6ed7
- reference/mbstring/functions/mb-decode-numericentity.xml 1. php/doc-en@4e69a9f2b1 - reference/imap/functions/imap-headerinfo.xml 1. php/doc-en@4e69a9f2b1 - reference/ssh2/functions/ssh2-auth-pubkey-file.xml 1. php/doc-en@74ef2355c5 - reference/ssh2/functions/ssh2-connect.xml 1. php/doc-en@74ef2355c5 - reference/stream/functions/stream-filter-append.xml 1. php/doc-en@a684294e0b - reference/stream/functions/stream-filter-prepend.xml 1. php/doc-en@a684294e0b - reference/filesystem/functions/fgetcsv.xml 1. php/doc-en@e1fd0bef1d 2. php/doc-en@0a3648a718 3. `&warning.csv.escape-parameter;` の重複を削除(既訳のバグ修正) - reference/spl/splfileobject/fgetcsv.xml 1. php/doc-en@e1fd0bef1d 2. php/doc-en@3a89b55d11 3. php/doc-en@0a3648a718 - language/predefined/attributes/nodiscard.xml 1. php/doc-en@30bda33771 - reference/pdo_sqlite/pdo/sqlite/createfunction.xml 1. php/doc-en@28930349ca - reference/math/functions/fmod.xml 1. php/doc-en@54a788ca59 - reference/simplexml/simplexmlelement/addChild.xml 1. php/doc-en@dca2a8354f - reference/json/functions/json-last-error.xml 1. php/doc-en@058ea1e842 - features/commandline.xml 1. php/doc-en@96b10a9885 - appendices/migration85/incompatible.xml 1. php/doc-en@048982b729 2. php/doc-en@f81bbcf9d3 - reference/random/random/randomizer/getfloat.xml 1. php/doc-en@1ada637cc8 2. php/doc-en@423a1da63f - reference/mysqli/mysqli/multi-query.xml 1. php/doc-en@1beae37b69 - reference/image/functions/getimagesize.xml 1. php/doc-en@6bb90d24b2 - reference/curl/functions/curl-close.xml 1. php/doc-en@86c8ebd19e - reference/curl/functions/curl-share-close.xml 1. php/doc-en@29c3d13980 - reference/yaml/functions/yaml-parse-file.xml 1. php/doc-en@132d2a8d63 - reference/mysqli/mysqli/options.xml 1. php/doc-en@e309a62b16 2. MYSQLI_SERVER_PUBLIC_KEY の古い「PHP 5.5.0 以降」テキストを削除(既訳のバグ修正) - appendices/transports.xml 1. php/doc-en@ae90ecc932 - reference/soap/soapserver/addfunction.xml 1. php/doc-en@577239f64b - reference/var/functions/settype.xml 1. php/doc-en@8d49e302b4 - features/http-auth.xml 1. php/doc-en@cd4180557a
185 lines
5.3 KiB
XML
185 lines
5.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: dca2a8354fc170f26545210ac78424ccc30950ea Maintainer: takagi Status: ready -->
|
|
<refentry xml:id="simplexmlelement.addchild" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>SimpleXMLElement::addChild</refname>
|
|
<refpurpose>
|
|
XML ノードに子要素を追加する
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis role="SimpleXMLElement">
|
|
<modifier>public</modifier> <type class="union"><type>SimpleXMLElement</type><type>null</type></type><methodname>SimpleXMLElement::addChild</methodname>
|
|
<methodparam><type>string</type><parameter>qualifiedName</parameter></methodparam>
|
|
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>value</parameter><initializer>&null;</initializer></methodparam>
|
|
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>namespace</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
ノードに子要素を追加し、子要素の SimpleXMLElement を返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>qualifiedName</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
追加する子要素の名前。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>value</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
指定されている場合は、子要素の値。
|
|
</para>
|
|
<para>
|
|
特殊文字 <literal><</literal> と <literal>></literal> は自動的にエスケープされますが、
|
|
<literal>&</literal> は手動でエスケープする必要があります。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>namespace</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
指定されている場合は、その子要素が所属する名前空間。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<literal>addChild</literal> メソッドは、
|
|
XML ノードに追加した子要素を表す
|
|
<type>SimpleXMLElement</type> オブジェクトを返します。
|
|
失敗時に &null; を返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<note>
|
|
<para>
|
|
この例では <literal>examples/simplexml-data.php</literal>
|
|
をインクルードしていますが、これは
|
|
<link linkend="simplexml.examples-basic">基本的な使用法</link>
|
|
の最初のサンプルにある XML 文字列を参照しています。
|
|
</para>
|
|
</note>
|
|
<example>
|
|
<title>SimpleXML 要素への属性と子要素の追加</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
include 'examples/simplexml-data.php';
|
|
|
|
$sxe = new SimpleXMLElement($xmlstr);
|
|
$sxe->addAttribute('type', 'documentary');
|
|
|
|
$movie = $sxe->addChild('movie');
|
|
$movie->addChild('title', 'PHP2: More Parser Stories');
|
|
$movie->addChild('plot', 'This is all about the people who make it work.');
|
|
|
|
$characters = $movie->addChild('characters');
|
|
$character = $characters->addChild('character');
|
|
$character->addChild('name', 'Mr. Parser');
|
|
$character->addChild('actor', 'John Doe');
|
|
|
|
$rating = $movie->addChild('rating', '5');
|
|
$rating->addAttribute('type', 'stars');
|
|
|
|
echo $sxe->asXML();
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
<?xml version="1.0" standalone="yes"?>
|
|
<movies type="documentary">
|
|
<movie>
|
|
<title>PHP: Behind the Parser</title>
|
|
<characters>
|
|
<character>
|
|
<name>Ms. Coder</name>
|
|
<actor>Onlivia Actora</actor>
|
|
</character>
|
|
<character>
|
|
<name>Mr. Coder</name>
|
|
<actor>El ActÓr</actor>
|
|
</character>
|
|
</characters>
|
|
<plot>
|
|
So, this language. It's like, a programming language. Or is it a
|
|
scripting language? All is revealed in this thrilling horror spoof
|
|
of a documentary.
|
|
</plot>
|
|
<great-lines>
|
|
<line>PHP solves all my web problems</line>
|
|
</great-lines>
|
|
<rating type="thumbs">7</rating>
|
|
<rating type="stars">5</rating>
|
|
</movie>
|
|
<movie>
|
|
<title>PHP2: More Parser Stories</title>
|
|
<plot>This is all about the people who make it work.</plot>
|
|
<characters>
|
|
<character>
|
|
<name>Mr. Parser</name>
|
|
<actor>John Doe</actor>
|
|
</character>
|
|
</characters>
|
|
<rating type="stars">5</rating>
|
|
</movie>
|
|
</movies>
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>SimpleXMLElement::addAttribute</methodname></member>
|
|
<member><xref linkend="simplexml.examples-basic"/></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|