ramsey          Thu May 11 06:32:45 2006 UTC

  Added files:                 
    /phpdoc/en/reference/simplexml/functions    
                                                
simplexml-element-addAttribute.xml 
                                                simplexml-element-addChild.xml 
                                                
simplexml-element-getDocNamespaces.xml 
                                                simplexml-element-getName.xml 
                                                
simplexml-element-getNamespaces.xml 
  Log:
  Added addAttribute(), addChild(), getDocNamespaces(), getName(), and 
  getNamespaces() methods to SimpleXMLElement documentation.
  
  
http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/simplexml/functions/simplexml-element-addAttribute.xml?view=markup&rev=1.1
Index: 
phpdoc/en/reference/simplexml/functions/simplexml-element-addAttribute.xml
+++ phpdoc/en/reference/simplexml/functions/simplexml-element-addAttribute.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision -->
<refentry id='function.simplexml-element-addAttribute'>
 <refnamediv>
  <refname>SimpleXMLElement->addAttribute</refname>
  <refpurpose>
   Adds an attribute to the SimpleXML element
  </refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>void</type><methodname>SimpleXMLElement->addAttribute</methodname>
   <methodparam><type>string</type><parameter>name</parameter></methodparam>
   <methodparam><type>string</type><parameter>value</parameter></methodparam>
   <methodparam 
choice="opt"><type>string</type><parameter>namespace</parameter></methodparam>
  </methodsynopsis>
  <para>
   Adds an attribute to the SimpleXML element.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>name</parameter></term>
     <listitem>
      <para>
       The name of the attribute to add.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>value</parameter></term>
     <listitem>
      <para>
       The value of the attribute.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>namespace</parameter></term>
     <listitem>
      <para>
       If specified, the namespace to which the attribute belongs.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Add attributes and children to a SimpleXML element</title>
    <programlisting role="php">
<![CDATA[
<?php
 
$sxe = new SimpleXMLElement($xmlstr); // or use simplexml_load_string()
$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>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><xref linkend="function.simplexml-element-addChild" /></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:"../../../../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
-->

http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/simplexml/functions/simplexml-element-addChild.xml?view=markup&rev=1.1
Index: phpdoc/en/reference/simplexml/functions/simplexml-element-addChild.xml
+++ phpdoc/en/reference/simplexml/functions/simplexml-element-addChild.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision -->
<refentry id='function.simplexml-element-addChild'>
 <refnamediv>
  <refname>SimpleXMLElement->addChild</refname>
  <refpurpose>
   Adds a child element to the XML node
  </refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   
<type>SimpleXMLElement</type><methodname>SimpleXMLElement->addChild</methodname>
   <methodparam><type>string</type><parameter>name</parameter></methodparam>
   <methodparam 
choice="opt"><type>string</type><parameter>value</parameter></methodparam>
   <methodparam 
choice="opt"><type>string</type><parameter>namespace</parameter></methodparam>
  </methodsynopsis>
  <para>
   Adds a child element to the node and returns a SimpleXMLElement of the child.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>name</parameter></term>
     <listitem>
      <para>
       The name of the child element to add.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>value</parameter></term>
     <listitem>
      <para>
       If specified, the value of the child element.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>namespace</parameter></term>
     <listitem>
      <para>
       If specified, the namespace to which the child element belongs.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The <literal>addChild</literal> method returns a 
<type>SimpleXMLElement</type>
   object representing the child added to the XML node.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Add attributes and children to a SimpleXML element</title>
    <programlisting role="php">
<![CDATA[
<?php
 
$sxe = new SimpleXMLElement($xmlstr); // or use simplexml_load_string()
$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>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><xref linkend="function.simplexml-element-addAttribute" /></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:"../../../../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
-->

http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/simplexml/functions/simplexml-element-getDocNamespaces.xml?view=markup&rev=1.1
Index: 
phpdoc/en/reference/simplexml/functions/simplexml-element-getDocNamespaces.xml
+++ 
phpdoc/en/reference/simplexml/functions/simplexml-element-getDocNamespaces.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision -->
<refentry id='function.simplexml-element-getDocNamespaces'>
 <refnamediv>
  <refname>SimpleXMLElement->getDocNamespaces</refname>
  <refpurpose>
   Returns namespaces declared in document
  </refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>array</type><methodname>SimpleXMLElement->getDocNamespaces</methodname>
   <methodparam 
choice="opt"><type>bool</type><parameter>recursive</parameter></methodparam>
  </methodsynopsis>
  <para>
   Returns namespaces declared in document
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>recursive</parameter></term>
     <listitem>
      <para>
       If specified, returns all namespaces declared in parent and child nodes. 
       Otherwise, returns only namespaces declared in root node.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The <literal>getDocNamespaces</literal> method returns an <type>array</type> 
   of namespace names with their associated URIs.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Get document namespaces</title>
    <programlisting role="php">
<![CDATA[
<?php

$xml = <<<XML
<people xmlns:p="http://example.org/ns";>
    <p:person id="1">John Doe</p:person>
    <p:person id="2">Susie Q. Public</p:person>
</people>
XML;
 
$sxe = new SimpleXMLElement($xml); // or use simplexml_load_string()

$namespaces = $sxe->getDocNamespaces();
var_dump($namespaces);

?>
]]>
    </programlisting>
   </example>
  </para>
  <para>
   <example>
    <title>Working with multiple namespaces</title>
    <programlisting role="php">
<![CDATA[
<?php

$xml = <<<XML
<people xmlns:p="http://example.org/ns"; xmlns:t="http://example.org/test";>
    <p:person t:id="1">John Doe</p:person>
    <p:person t:id="2" a:addr="123 Street" xmlns:a="http://example.org/addr";>
        Susie Q. Public
    </p:person>
</people>
XML;
 
$sxe = new SimpleXMLElement($xml); // or use simplexml_load_string()

$namespaces = $sxe->getDocNamespaces(TRUE);
var_dump($namespaces);

?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><xref linkend="function.simplexml-element-getNamespaces" /></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:"../../../../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
-->

http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/simplexml/functions/simplexml-element-getName.xml?view=markup&rev=1.1
Index: phpdoc/en/reference/simplexml/functions/simplexml-element-getName.xml
+++ phpdoc/en/reference/simplexml/functions/simplexml-element-getName.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision -->
<refentry id='function.simplexml-element-getName'>
 <refnamediv>
  <refname>SimpleXMLElement->getName</refname>
  <refpurpose>Gets the name of the XML element</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>SimpleXMLElement->getName</methodname>
   <void/>
  </methodsynopsis>
  <para>
   Gets the name of the XML element.
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The <literal>getName</literal> method returns as a <type>string</type> the 
   name of the XML tag referenced by the SimpleXMLElement object.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Get XML element names</title>
    <programlisting role="php">
<![CDATA[
<?php
 
$sxe = new SimpleXMLElement($xmlstr); // or use simplexml_load_string()

echo $sxe->getName() . "\n";

foreach ($sxe->children() as $child)
{
    echo $child->getName() . "\n";
}

?>
]]>
    </programlisting>
   </example>
  </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:"../../../../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
-->

http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/simplexml/functions/simplexml-element-getNamespaces.xml?view=markup&rev=1.1
Index: 
phpdoc/en/reference/simplexml/functions/simplexml-element-getNamespaces.xml
+++ phpdoc/en/reference/simplexml/functions/simplexml-element-getNamespaces.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision -->
<refentry id='function.simplexml-element-getNamespaces'>
 <refnamediv>
  <refname>SimpleXMLElement->getNamespaces</refname>
  <refpurpose>
   Returns namespaces used in document
  </refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>array</type><methodname>SimpleXMLElement->getNamespaces</methodname>
   <methodparam 
choice="opt"><type>bool</type><parameter>recursive</parameter></methodparam>
  </methodsynopsis>
  <para>
   Returns namespaces used in document
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>recursive</parameter></term>
     <listitem>
      <para>
       If specified, returns all namespaces used in parent and child nodes. 
       Otherwise, returns only namespaces used in root node.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The <literal>getNamespaces</literal> method returns an <type>array</type> of 
   namespace names with their associated URIs.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Get document namespaces in use</title>
    <programlisting role="php">
<![CDATA[
<?php

$xml = <<<XML
<people xmlns:p="http://example.org/ns"; xmlns:t="http://example.org/test";>
    <p:person id="1">John Doe</p:person>
    <p:person id="2">Susie Q. Public</p:person>
</people>
XML;
 
$sxe = new SimpleXMLElement($xml); // or use simplexml_load_string()

$namespaces = $sxe->getNamespaces(TRUE);
var_dump($namespaces);

?>
]]>
    </programlisting>
    &example.outputs.similar;
    <screen>
<![CDATA[
array(1) {
  ["p"]=>
  string(21) "http://example.org/ns";
}
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><xref linkend="function.simplexml-element-getDocNamespaces" 
/></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:"../../../../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
-->

Reply via email to