|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- EN-Revision: 2c9920402e11ecdc75f604e0d23c23fab1c75b74 Maintainer: PhilDaiguille Status: ready --> |
| 3 | +<!-- Reviewed: no --> |
| 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>Cambia el nombre calificado o el espacio de nombres de un atributo</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 | + Este método cambia el nombre calificado o el espacio de nombres de un atributo. |
| 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 | + El nuevo espacio de nombres <acronym>URI</acronym> del atributo. |
| 30 | + </simpara> |
| 31 | + </listitem> |
| 32 | + </varlistentry> |
| 33 | + <varlistentry> |
| 34 | + <term><parameter>qualifiedName</parameter></term> |
| 35 | + <listitem> |
| 36 | + <simpara> |
| 37 | + El nuevo nombre calificado del atributo. |
| 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><classname>DOMException</classname> con el código <constant>Dom\NAMESPACE_ERR</constant></term> |
| 56 | + <listitem> |
| 57 | + <simpara> |
| 58 | + Lanzada si hay un error con el espacio de nombres, tal como se determina por |
| 59 | + <parameter>qualifiedName</parameter>. |
| 60 | + </simpara> |
| 61 | + </listitem> |
| 62 | + </varlistentry> |
| 63 | + <varlistentry> |
| 64 | + <term><classname>DOMException</classname> con el código <constant>Dom\INVALID_MODIFICATION_ERR</constant></term> |
| 65 | + <listitem> |
| 66 | + <simpara> |
| 67 | + Lanzada si un atributo ya existe en el elemento con el mismo |
| 68 | + nombre calificado. |
| 69 | + </simpara> |
| 70 | + </listitem> |
| 71 | + </varlistentry> |
| 72 | + </variablelist> |
| 73 | + </refsect1> |
| 74 | + |
| 75 | + <refsect1 role="examples"> |
| 76 | + &reftitle.examples; |
| 77 | + <example xml:id="dom-attr.rename.example.basic"> |
| 78 | + <title>Ejemplo de <methodname>Dom\Attr::rename</methodname> para cambiar el espacio de nombres y el nombre calificado</title> |
| 79 | + <simpara> |
| 80 | + Esto cambia el nombre calificado de <literal>my-attr</literal> a |
| 81 | + <literal>my-new-attr</literal> y también cambia su espacio de nombres a |
| 82 | + <literal>urn:my-ns</literal>. |
| 83 | + </simpara> |
| 84 | + <programlisting role="php"> |
| 85 | +<![CDATA[ |
| 86 | +<?php |
| 87 | +
|
| 88 | +$doc = Dom\XMLDocument::createFromString('<root my-attr="value"/>'); |
| 89 | +
|
| 90 | +$root = $doc->documentElement; |
| 91 | +$attribute = $root->attributes['my-attr']; |
| 92 | +$attribute->rename('urn:my-ns', 'my-new-attr'); |
| 93 | +
|
| 94 | +echo $doc->saveXml(); |
| 95 | +
|
| 96 | +?> |
| 97 | +]]> |
| 98 | + </programlisting> |
| 99 | + &example.outputs; |
| 100 | + <screen> |
| 101 | +<![CDATA[ |
| 102 | +<?xml version="1.0" encoding="UTF-8"?> |
| 103 | +<root xmlns:ns1="urn:my-ns" ns1:my-new-attr="value"/> |
| 104 | +]]> |
| 105 | + </screen> |
| 106 | + </example> |
| 107 | + <example xml:id="dom-attr.rename.example.only-name"> |
| 108 | + <title>Ejemplo de <methodname>Dom\Attr::rename</methodname> para cambiar solo el nombre calificado</title> |
| 109 | + <simpara> |
| 110 | + Esto cambia solo el nombre calificado de <literal>my-attr</literal> |
| 111 | + y mantiene el espacio de nombres <acronym>URI</acronym> sin cambios. |
| 112 | + </simpara> |
| 113 | + <programlisting role="php"> |
| 114 | +<![CDATA[ |
| 115 | +<?php |
| 116 | +
|
| 117 | +$doc = Dom\XMLDocument::createFromString('<root my-attr="value"/>'); |
| 118 | +
|
| 119 | +$root = $doc->documentElement; |
| 120 | +$attribute = $root->attributes['my-attr']; |
| 121 | +$attribute->rename($attribute->namespaceURI, 'my-new-attr'); |
| 122 | +
|
| 123 | +echo $doc->saveXml(); |
| 124 | +
|
| 125 | +?> |
| 126 | +]]> |
| 127 | + </programlisting> |
| 128 | + &example.outputs; |
| 129 | + <screen> |
| 130 | +<![CDATA[ |
| 131 | +<?xml version="1.0" encoding="UTF-8"?> |
| 132 | +<root my-new-attr="value"/> |
| 133 | +]]> |
| 134 | + </screen> |
| 135 | + </example> |
| 136 | + </refsect1> |
| 137 | + |
| 138 | + <refsect1 role="notes"> |
| 139 | + &reftitle.notes; |
| 140 | + <note> |
| 141 | + <simpara> |
| 142 | + A veces es necesario cambiar el nombre calificado y el espacio de nombres |
| 143 | + <acronym>URI</acronym> juntos en un solo paso para no infringir |
| 144 | + las reglas de los espacios de nombres. |
| 145 | + </simpara> |
| 146 | + </note> |
| 147 | + </refsect1> |
| 148 | + |
| 149 | + <refsect1 role="seealso"> |
| 150 | + &reftitle.seealso; |
| 151 | + <simplelist> |
| 152 | + <member><methodname>Dom\Element::rename</methodname></member> |
| 153 | + </simplelist> |
| 154 | + </refsect1> |
| 155 | + |
| 156 | +</refentry> |
| 157 | +<!-- Keep this comment at the end of the file |
| 158 | +Local variables: |
| 159 | +mode: sgml |
| 160 | +sgml-omittag:t |
| 161 | +sgml-shorttag:t |
| 162 | +sgml-minimize-attributes:nil |
| 163 | +sgml-always-quote-attributes:t |
| 164 | +sgml-indent-step:1 |
| 165 | +sgml-indent-data:t |
| 166 | +indent-tabs-mode:nil |
| 167 | +sgml-parent-document:nil |
| 168 | +sgml-default-dtd-file:"~/.phpdoc/manual.ced" |
| 169 | +sgml-exposed-tags:nil |
| 170 | +sgml-local-catalogs:nil |
| 171 | +sgml-local-ecat-files:nil |
| 172 | +End: |
| 173 | +vim600: syn=xml fen fdm=syntax fdl=2 si |
| 174 | +vim: et tw=78 syn=sgml |
| 175 | +vi: ts=1 sw=1 |
| 176 | +--> |
0 commit comments