cvs: peardoc /en/package/xml xml-serializer.xml /en/package/xml/xml-serializer/xml-unserializer options.xml setoptions.xml

From: Date: Wed, 26 May 2004 13:21:26 +0000
Subject: cvs: peardoc /en/package/xml xml-serializer.xml /en/package/xml/xml-serializer/xml-unserializer options.xml setoptions.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4105@lists.php.net to get a copy of this message
schst Wed May 26 09:21:26 2004 EDT Added files: /peardoc/en/package/xml/xml-serializer/xml-unserializer options.xml setoptions.xml Modified files: /peardoc/en/package/xml xml-serializer.xml Log: added docs on XML_Unserializer's options

http://cvs.php.net/diff.php/peardoc/en/package/xml/xml-serializer.xml?r1=1.4&r2=1.5&ty=u Index: peardoc/en/package/xml/xml-serializer.xml diff -u peardoc/en/package/xml/xml-serializer.xml:1.4 peardoc/en/package/xml/xml-serializer.xml:1.5 --- peardoc/en/package/xml/xml-serializer.xml:1.4 Thu Jan 8 15:35:55 2004 +++ peardoc/en/package/xml/xml-serializer.xml Wed May 26 09:21:25 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <sect1 id="package.xml.xml-serializer"> <title>XML_Serializer</title> &package.xml.xml-serializer.intro; @@ -54,13 +54,15 @@ </para> </refsect1> </refentry> + &package.xml.xml-serializer.xml-unserializer.options; &package.xml.xml-serializer.xml-unserializer.xml-unserializer; &package.xml.xml-serializer.xml-unserializer.apiversion; &package.xml.xml-serializer.xml-unserializer.unserialize; &package.xml.xml-serializer.xml-unserializer.getunserializeddata; &package.xml.xml-serializer.xml-unserializer.getrootname; - &package.xml.xml-serializer.xml-unserializer.resetoptions; &package.xml.xml-serializer.xml-unserializer.setoption; + &package.xml.xml-serializer.xml-unserializer.setoptions; + &package.xml.xml-serializer.xml-unserializer.resetoptions; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/co.php/peardoc/en/package/xml/xml-serializer/xml-unserializer/options.xml?r=1.1&p=1 Index: peardoc/en/package/xml/xml-serializer/xml-unserializer/options.xml +++ peardoc/en/package/xml/xml-serializer/xml-unserializer/options.xml <!-- $Revision: 1.1 $ --> <refentry id="package.xml.xml-serializer.xml-unserializer.options"> <refnamediv> <refname>XML_Unserializer Options</refname> <refpurpose>List of all XML_Unserializer options</refpurpose> </refnamediv> <refsect1 id="package.xml.xml-serializer.xml-unserializer.options.refsect1"> <title>Introduction to options</title> <para> Options let you influence, how XML_Unserializer treats the parsed XML. It allows you to define, whether attributes should be parsed, whether to use associative arrays or objects for complex data types and more. </para> <para> Options can be passed as an associative array to the <link linkend="package.xml.xml-serializer.xml-unserializer.xml-unserializer">constructor of XML_Unserializer</link>. You may also use <link linkend="package.xml.xml-serializer.xml-unserializer.setoption"><function>setOption</function></link>, or <link linkend="package.xml.xml-serializer.xml-unserializer.setoptions"><function>setOptions</function></link> to set one or more options after the instance of XML_Unserializer has been created. </para> </refsect1> <refsect1 id="package.xml.xml-serializer.xml-unserializer.options.refsect2"> <title>All available options</title> <para> Here is a list of all options supported by XML_Unserializer. </para> <para> <table> <title>XML_Unserializer options</title> <tgroup cols="4"> <thead> <row> <entry>Option</entry> <entry>Possible values</entry> <entry>Default</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>complexTaype</entry> <entry>'array' or 'object'</entry> <entry>'array'</entry> <entry>Defines, whether nested tags should be returned as associative arrays or objects</entry> </row> <row> <entry>keyAttribute</entry> <entry>any string</entry> <entry>'_originalKey'</entry> <entry>If the attribute specified in this option exists for a tag, the value will be used as key or property name in the parent object or array</entry> </row> <row> <entry>typeAttribute</entry> <entry>any string</entry> <entry>'_type'</entry> <entry>If this attribute exists for a tag, the tag content will be converted to the specified type. Possible types are: string, integer, float, boolean, array and object</entry> </row> <row> <entry>classAttribute</entry> <entry>any string</entry> <entry>'_class'</entry> <entry>If XML_Unserializer creates an object, it will be an instance of stdClass, unless the tag has the attribute specified in this option. If it is set, the classname stored in the attribute value will be used.</entry> </row> <row> <entry>parseAttributes</entry> <entry>&true; or &false;</entry> <entry>&true;</entry> <entry>With this option, you may tell XML_Unserializer to also parse the attributes of the tags. The next two options define how to treat the parsed attributes.</entry> </row> <row> <entry>attributesArray</entry> <entry>&false; or any string</entry> <entry>&false;</entry> <entry>If set to false, the attributes will be treated like nested tags. If you set it to a string, a new aray will be created and stored in the parent structure using key you specified in this option</entry> </row> <row> <entry>prependAttributes</entry> <entry>any string</entry> <entry>''</entry> <entry>Allows you to specify a prefix for attribute names.</entry> </row> <row> <entry>contentName</entry> <entry>any string</entry> <entry>'_content'</entry> <entry>If you decide to parse attributes or a tag contains cdata and tags, then the cdata will be stored in the index specified here.</entry> </row> <row> <entry>tagMap</entry> <entry>associative array</entry> <entry>array()</entry> <entry>This allows you to map tag names to PHP classes. The names of the tags have to be in the keys and the values contain the class names to use for each tag.</entry> </row> </tbody> </tgroup> </table> </para> </refsect1> <refsect1 id="package.xml.xml-serializer.xml-unserializer.options.example1"> <title>Options example</title> <simpara> The following examples shows how to set options for XML_Unserializer. </simpara> <example> <title>Using the constructor</title> <programlisting role="php"> <![CDATA[require_once "XML/Unserializer.php"; $options = array( 'complexType' => 'array' ); $us = new XML_Unserializer($options); $result = $us->unserialize('example.xml', true); ]]> </programlisting> </example> <simpara> The following example shows how to set options for XML_Unserializer, if the instance already has been created. </simpara> <example> <title>Using setOption() and setOptions()</title> <programlisting role="php"> <![CDATA[require_once "XML/Unserializer.php"; $us = new XML_Unserializer(); $options = array( 'tagMap' => array( 'util' => 'XML_Util' ), 'classAttribute' => '_classname' ); $us->setOptions($options); $us->setOption('complexType', 'object'); $result = $us->unserialize('example.xml', true); ]]> </programlisting> </example> </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 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/co.php/peardoc/en/package/xml/xml-serializer/xml-unserializer/setoptions.xml?r=1.1&p=1 Index: peardoc/en/package/xml/xml-serializer/xml-unserializer/setoptions.xml +++ peardoc/en/package/xml/xml-serializer/xml-unserializer/setoptions.xml <!-- $Revision: 1.1 $ --> <refentry id="package.xml.xml-serializer.xml-unserializer.setoptions"> <refnamediv> <refname><function>XML_Unserializer::setoptions</function></refname> <refpurpose>set several options</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once &apos;Unserializer.php&apos;; </funcsynopsisinfo> <funcprototype> <funcdef>void <function>XML_Unserializer::setOptions</function></funcdef> <paramdef>array <parameter>$options</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-serializer.xml-unserializer.setoptions.desc"> &title.desc; <para> Options influence the behaviour of XML_Unserializer and are the most important part of XML_Unserializer. </para> <para> You can use this method if you do not want to set all options in the constructor. </para> </refsect1> <refsect1 id="package.xml.xml-serializer.xml-unserializer.setoptions.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>array $options</parameter> - assoc array containing all options </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-serializer.xml-unserializer.setoptions.see"> &title.see; <para> see <link linkend="package.xml.xml-serializer.xml-unserializer.resetoptions"><function>XML_Unserializer::resetOptions</function></link>, <link linkend="package.xml.xml-serializer.xml-unserializer.resetoptions"><function>XML_Unserializer::setOption</function></link> </para> </refsect1> <refsect1 id="package.xml.xml-serializer.xml-unserializer.setoptions.note"> &title.note; &note.notstatic; </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 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 -->
« previous php.pear.doc (#4105) next »