|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- $Revision$ --> |
| 3 | +<!-- EN-Revision: 2c9920402e11ecdc75f604e0d23c23fab1c75b74 Maintainer: mumumu Status: ready --> |
| 4 | +<refentry xml:id="dom-attr.rename" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 5 | + <refnamediv> |
| 6 | + <refname>Dom\Attr::rename</refname> |
| 7 | + <refpurpose>属性の名前空間または、修飾名を変更する</refpurpose> |
| 8 | + </refnamediv> |
| 9 | + |
| 10 | + <refsect1 role="description"> |
| 11 | + &reftitle.description; |
| 12 | + <methodsynopsis role="Dom\\Attr"> |
| 13 | + <modifier>public</modifier> <type>void</type><methodname>Dom\Attr::rename</methodname> |
| 14 | + <methodparam><type class="union"><type>string</type><type>null</type></type><parameter>namespaceURI</parameter></methodparam> |
| 15 | + <methodparam><type>string</type><parameter>qualifiedName</parameter></methodparam> |
| 16 | + </methodsynopsis> |
| 17 | + <simpara> |
| 18 | + このメソッドは、属性の名前空間または、修飾名を変更します。 |
| 19 | + </simpara> |
| 20 | + </refsect1> |
| 21 | + |
| 22 | + <refsect1 role="parameters"> |
| 23 | + &reftitle.parameters; |
| 24 | + <variablelist> |
| 25 | + <varlistentry> |
| 26 | + <term><parameter>namespaceURI</parameter></term> |
| 27 | + <listitem> |
| 28 | + <simpara> |
| 29 | + 属性の新しい名前空間 <acronym>URI</acronym> |
| 30 | + </simpara> |
| 31 | + </listitem> |
| 32 | + </varlistentry> |
| 33 | + <varlistentry> |
| 34 | + <term><parameter>qualifiedName</parameter></term> |
| 35 | + <listitem> |
| 36 | + <simpara> |
| 37 | + 属性の新しい修飾名 |
| 38 | + </simpara> |
| 39 | + </listitem> |
| 40 | + </varlistentry> |
| 41 | + </variablelist> |
| 42 | + </refsect1> |
| 43 | + |
| 44 | + <refsect1 role="returnvalues"> |
| 45 | + &reftitle.returnvalues; |
| 46 | + <simpara> |
| 47 | + &return.void; |
| 48 | + </simpara> |
| 49 | + </refsect1> |
| 50 | + |
| 51 | + <refsect1 role="errors"> |
| 52 | + &reftitle.errors; |
| 53 | + <variablelist> |
| 54 | + <varlistentry> |
| 55 | + <term><constant>Dom\NAMESPACE_ERR</constant> 付きで <classname>DOMException</classname> が発生する場合</term> |
| 56 | + <listitem> |
| 57 | + <simpara> |
| 58 | + <parameter>qualifiedName</parameter> によって決まる名前空間にエラーがあった場合に発生します。 |
| 59 | + </simpara> |
| 60 | + </listitem> |
| 61 | + </varlistentry> |
| 62 | + <varlistentry> |
| 63 | + <term><constant>Dom\INVALID_MODIFICATION_ERR</constant> 付きで <classname>DOMException</classname> が発生する場合</term> |
| 64 | + <listitem> |
| 65 | + <simpara> |
| 66 | + 同じ修飾名を持つ要素中に、属性が存在すると発生します。 |
| 67 | + </simpara> |
| 68 | + </listitem> |
| 69 | + </varlistentry> |
| 70 | + </variablelist> |
| 71 | + </refsect1> |
| 72 | + |
| 73 | + <refsect1 role="examples"> |
| 74 | + &reftitle.examples; |
| 75 | + <example xml:id="dom-attr.rename.example.basic"> |
| 76 | + <title>名前空間と修飾名を両方変更する <methodname>Dom\Attr::rename</methodname> の例</title> |
| 77 | + <simpara> |
| 78 | + この例では、<literal>my-attr</literal> の修飾名を |
| 79 | + <literal>my-new-attr</literal> に変更します。 |
| 80 | + その名前空間も <literal>urn:my-ns</literal> に変更します。 |
| 81 | + </simpara> |
| 82 | + <programlisting role="php"> |
| 83 | +<![CDATA[ |
| 84 | +<?php |
| 85 | +
|
| 86 | +$doc = Dom\XMLDocument::createFromString('<root my-attr="value"/>'); |
| 87 | +
|
| 88 | +$root = $doc->documentElement; |
| 89 | +$attribute = $root->attributes['my-attr']; |
| 90 | +$attribute->rename('urn:my-ns', 'my-new-attr'); |
| 91 | +
|
| 92 | +echo $doc->saveXml(); |
| 93 | +
|
| 94 | +?> |
| 95 | +]]> |
| 96 | + </programlisting> |
| 97 | + &example.outputs; |
| 98 | + <screen> |
| 99 | +<![CDATA[ |
| 100 | +<?xml version="1.0" encoding="UTF-8"?> |
| 101 | +<root xmlns:ns1="urn:my-ns" ns1:my-new-attr="value"/> |
| 102 | +]]> |
| 103 | + </screen> |
| 104 | + </example> |
| 105 | + <example xml:id="dom-attr.rename.example.only-name"> |
| 106 | + <title>修飾名だけを変更する <methodname>Dom\Attr::rename</methodname> の例</title> |
| 107 | + <simpara> |
| 108 | + この例では、<literal>my-attr</literal> の修飾名だけを変更します。 |
| 109 | + 名前空間 <acronym>URI</acronym> は元のままです。 |
| 110 | + </simpara> |
| 111 | + <programlisting role="php"> |
| 112 | +<![CDATA[ |
| 113 | +<?php |
| 114 | +
|
| 115 | +$doc = Dom\XMLDocument::createFromString('<root my-attr="value"/>'); |
| 116 | +
|
| 117 | +$root = $doc->documentElement; |
| 118 | +$attribute = $root->attributes['my-attr']; |
| 119 | +$attribute->rename($attribute->namespaceURI, 'my-new-attr'); |
| 120 | +
|
| 121 | +echo $doc->saveXml(); |
| 122 | +
|
| 123 | +?> |
| 124 | +]]> |
| 125 | + </programlisting> |
| 126 | + &example.outputs; |
| 127 | + <screen> |
| 128 | +<![CDATA[ |
| 129 | +<?xml version="1.0" encoding="UTF-8"?> |
| 130 | +<root my-new-attr="value"/> |
| 131 | +]]> |
| 132 | + </screen> |
| 133 | + </example> |
| 134 | + </refsect1> |
| 135 | + |
| 136 | + <refsect1 role="notes"> |
| 137 | + &reftitle.notes; |
| 138 | + <note> |
| 139 | + <simpara> |
| 140 | + 修飾名と名前空間 <acronym>URI</acronym> を一度にまとめて変更する必要がある場合があります。 |
| 141 | + これは、名前空間の規則を壊さないようにするためです。 |
| 142 | + </simpara> |
| 143 | + </note> |
| 144 | + </refsect1> |
| 145 | + |
| 146 | + <refsect1 role="seealso"> |
| 147 | + &reftitle.seealso; |
| 148 | + <simplelist> |
| 149 | + <member><methodname>Dom\Element::rename</methodname></member> |
| 150 | + </simplelist> |
| 151 | + </refsect1> |
| 152 | + |
| 153 | +</refentry> |
| 154 | +<!-- Keep this comment at the end of the file |
| 155 | +Local variables: |
| 156 | +mode: sgml |
| 157 | +sgml-omittag:t |
| 158 | +sgml-shorttag:t |
| 159 | +sgml-minimize-attributes:nil |
| 160 | +sgml-always-quote-attributes:t |
| 161 | +sgml-indent-step:1 |
| 162 | +sgml-indent-data:t |
| 163 | +indent-tabs-mode:nil |
| 164 | +sgml-parent-document:nil |
| 165 | +sgml-default-dtd-file:"~/.phpdoc/manual.ced" |
| 166 | +sgml-exposed-tags:nil |
| 167 | +sgml-local-catalogs:nil |
| 168 | +sgml-local-ecat-files:nil |
| 169 | +End: |
| 170 | +vim600: syn=xml fen fdm=syntax fdl=2 si |
| 171 | +vim: et tw=78 syn=sgml |
| 172 | +vi: ts=1 sw=1 |
| 173 | +--> |
0 commit comments