svn: /phpdoc/es/trunk/reference/simplexml/ examples.xml
| From: | Andrés García | Date: | Wed, 28 Sep 2011 23:56:02 +0000 |
| Subject: | svn: /phpdoc/es/trunk/reference/simplexml/ examples.xml | ||
| Groups: | php.doc.es | ||
| Request: | Send a blank email to doc-es+get-4933@lists.php.net to get a copy of this message | ||
andresdzphp Wed, 28 Sep 2011 23:56:02 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=317453
Log:
updated to the most recent version.
Changed paths:
U phpdoc/es/trunk/reference/simplexml/examples.xml
Modified: phpdoc/es/trunk/reference/simplexml/examples.xml
===================================================================
--- phpdoc/es/trunk/reference/simplexml/examples.xml 2011-09-28 21:21:32 UTC (rev 317452)
+++ phpdoc/es/trunk/reference/simplexml/examples.xml 2011-09-28 23:56:02 UTC (rev 317453)
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 311775 Maintainer: yago Status: ready -->
+<!-- EN-Revision: 315548 Maintainer: yago Status: ready -->
+<!-- Reviewed: no -->
+
<chapter xml:id="simplexml.examples" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<section xml:id="simplexml.examples-basic">
@@ -62,9 +64,9 @@
<?php
include 'ejemplo.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
-echo $xml->pelicula[0]->argumento;
+echo $peliculas->pelicula[0]->argumento;
?>
]]>
</programlisting>
@@ -92,9 +94,9 @@
<?php
include 'example.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
-echo $xml->pelicula->{'grandes-lines'}->linea;
+echo $peliculas->pelicula->{'grandes-lines'}->linea;
?>
]]>
</programlisting>
@@ -118,10 +120,10 @@
<?php
include 'example.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
/* Para cada <personaje>, mostramos cada <nombre>. */
-foreach ($xml->pelicula->personajes->personaje as $personaje) {
+foreach ($peliculas->pelicula->personajes->personaje as $personaje) {
echo $personaje->nombre, ' interpretado por ', $personaje->actor, PHP_EOL;
}
@@ -158,11 +160,11 @@
<?php
include 'example.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
/* Acceso a los nodos <puntuacion> de la primera película.
* Mostramos la escala (tipo) también. */
-foreach ($xml->pelicula[0]->puntuacion as $puntuacion) {
+foreach ($peliculas->pelicula[0]->puntuacion as $puntuacion) {
switch((string) $puntuacion['tipo']) { // Toma los atributos como índices del
elemento
case 'pulgares':
echo $puntuacion, ' votos positivos';
@@ -197,13 +199,13 @@
<?php
include 'example.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
-if ((string) $xml->pelicula->titulo == 'PHP: Tras el Parser') {
+if ((string) $peliculas->pelicula->titulo == 'PHP: Tras el Parser') {
print 'Mi película favorita.';
}
-echo htmlentities((string) $xml->pelicula->titulo);
+echo htmlentities((string) $peliculas->pelicula->titulo);
?>
]]>
</programlisting>
@@ -227,9 +229,9 @@
<?php
include 'example.php';
-$el1 = new SimpleXMLElement($xmlstr);
-$el2 = new SimpleXMLElement($xmlstr);
-var_dump($el1 == $el2); // false desde PHP 5.2.0
+$pelicula1 = new SimpleXMLElement($xmlstr);
+$pelicula2 = new SimpleXMLElement($xmlstr);
+var_dump($pelicula1 == $pelicula2); // false desde PHP 5.2.0
?>
]]>
</programlisting>
@@ -253,9 +255,9 @@
<![CDATA[
<?php
include 'example.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
-foreach ($xml->xpath('//personaje') as $personaje) {
+foreach ($peliculas->xpath('//personaje') as $personaje) {
echo $personaje->nombre . ' interpretado por ' . $personaje->actor, PHP_EOL;
}
?>
@@ -285,11 +287,11 @@
<![CDATA[
<?php
include 'example.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
-$xml->pelicula[0]->personajes->personaje[0]->nombre = 'Señorita
Programadora';
+$peliculas->pelicula[0]->personajes->personaje[0]->nombre = 'Señorita
Programadora';
-echo $xml->asXML();
+echo $peliculas->asXML();
?>
]]>
</programlisting>
@@ -338,16 +340,16 @@
<![CDATA[
<?php
include 'example.php';
-$xml = new SimpleXMLElement($xmlstr);
+$peliculas = new SimpleXMLElement($xmlstr);
-$character = $xml->pelicula[0]->personajes->addChild('personaje');
+$character = $peliculas->pelicula[0]->personajes->addChild('personaje');
$character->addChild('nombre', 'Sr. Parser');
$character->addChild('actor', 'John Doe');
-$rating = $xml->pelicula[0]->addChild('puntuacion', 'Todos los
públicos');
+$rating = $peliculas->pelicula[0]->addChild('puntuacion', 'Todos los
públicos');
$rating->addAttribute('tipo', 'clasificación');
-echo $xml->asXML();
+echo $peliculas->asXML();
?>
]]>
</programlisting>