cvs: peardoc /en/package xml.xml /en/package/xml xml-util.xml /en/package/xml/xml-util example.xml intro.xml /en/package/xml/xml-util/xml-util
apiversion.xml attributestostring.xml createtag.xml createtagfromarray.xml getxmldeclaration.xml isvalidname.xml replaceentities.xml
splitqualifiedname.xml
| From: | Stephan Schmidt | Date: | Fri, 01 Aug 2003 21:39:19 +0000 |
| Subject: | cvs: peardoc /en/package xml.xml /en/package/xml xml-util.xml /en/package/xml/xml-util example.xml intro.xml /en/package/xml/xml-util/xml-util apiversion.xml attributestostring.xml createtag.xml createtagfromarray.xml getxmldeclaration.xml isvalidname.xml replaceentities.xml splitqualifiedname.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-1155@lists.php.net to get a copy of this message | ||
schst Fri Aug 1 17:39:19 2003 EDT
Added files:
/peardoc/en/package/xml xml-util.xml
/peardoc/en/package/xml/xml-util example.xml intro.xml
/peardoc/en/package/xml/xml-util/xml-util apiversion.xml
attributestostring.xml
createtag.xml
createtagfromarray.xml
getxmldeclaration.xml
isvalidname.xml
replaceentities.xml
splitqualifiedname.xml
Modified files:
/peardoc/en/package xml.xml
Log:
added documentation for XML_Util
Index: peardoc/en/package/xml.xml diff -u peardoc/en/package/xml.xml:1.4 peardoc/en/package/xml.xml:1.5 --- peardoc/en/package/xml.xml:1.4 Wed Mar 26 17:23:24 2003 +++ peardoc/en/package/xml.xml Fri Aug 1 17:39:19 2003 @@ -10,6 +10,7 @@ &package.xml.xml-sql2xml; &package.xml.xml-transformer; &package.xml.xml-tree; + &package.xml.xml-util; </chapter> <!-- Keep this comment at the end of the file Index: peardoc/en/package/xml/xml-util.xml +++ peardoc/en/package/xml/xml-util.xml <!-- $Revision: 1.1 $ --> <sect1 id="package.xml.xml-util"> <title>XML_Util</title> <para> Collection of often needed methods that help you creating XML documents. </para> &package.xml.xml-util.intro; &package.xml.xml-util.example; &package.xml.xml-util.xml-util.apiversion; &package.xml.xml-util.xml-util.attributestostring; &package.xml.xml-util.xml-util.createtag; &package.xml.xml-util.xml-util.createtagfromarray; &package.xml.xml-util.xml-util.getxmldeclaration; &package.xml.xml-util.xml-util.isvalidname; &package.xml.xml-util.xml-util.replaceentities; &package.xml.xml-util.xml-util.splitqualifiedname; </sect1> <!-- 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 --> Index: peardoc/en/package/xml/xml-util/example.xml +++ peardoc/en/package/xml/xml-util/example.xml <!-- $Revision: 1.1 $ --> <refentry id="package.xml.xml-util.example"> <refnamediv> <refname>Example</refname> <refpurpose>Example for the usage of XML_Util</refpurpose> </refnamediv> <refsect1 id="package.xml.xml-util.example.example1"> <title>Usage example</title> <simpara> The following examples shows how some of the methods of XML_Util have to be used. </simpara> <example> <title>Some basic examples</title> <programlisting role="php"> <![CDATA[require_once "XML/Util.php"; // creating an XML tag $tag = XML_Util::createTag("xsl:stylesheet", array("version" => "1.0"), "Place your content here", "http://www.w3.org/1999/XSL/Transform"); // verify tag name $result = XML_Util::isValidName("my Tag"); if (PEAR::isError($result)) { print "Invalid XML name: " . $result->getMessage(); } else { print "Tagname is valid."; }]]> </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 --> Index: peardoc/en/package/xml/xml-util/intro.xml +++ peardoc/en/package/xml/xml-util/intro.xml <!-- $Revision: 1.1 $ --> <refentry id="package.xml.xml-util.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose>Introduction to XML_Util</refpurpose> </refnamediv> <refsect1 id="package.xml.xml-util.intro.refsect1"> <title>Introduction to XML_Util</title> <para> XML_Util is a utility class that helps you working with (and especially creating) XML documents. </para> <para> All methods of XML_Util can be called statically, that means you do not have to instantiate an XML_Util object to use the provided methods. </para> <para> The funcionality of XML_Util ranges from validating an XML tag name (as there are strict rules for tag and attribute names) to the creation of namespaced XML tags. </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 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 --> Index: peardoc/en/package/xml/xml-util/xml-util/apiversion.xml +++ peardoc/en/package/xml/xml-util/xml-util/apiversion.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.apiversion"> <refnamediv> <refname><function>XML_Util::apiVersion</function></refname> <refpurpose>return API version</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::apiVersion</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.apiversion.desc"> &title.desc; <para> Returns API version of XML_Util. </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.apiversion.return"> &title.return; <para> <emphasis>string</emphasis> API version </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.apiversion.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/attributestostring.xml +++ peardoc/en/package/xml/xml-util/xml-util/attributestostring.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.attributestostring"> <refnamediv> <refname><function>XML_Util::attributesToString</function></refname> <refpurpose>create XML attribute string</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::attributesToString</function></funcdef> <paramdef>array <parameter>$attributes</parameter></paramdef> <paramdef>boolean <parameter> <optional>$sort = true</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.attributestostring.desc"> &title.desc; <para> create string representation of an attribute list </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.attributestostring.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>array $attributes</parameter> - assoc array containg attributes </para> </listitem> <listitem> <para> <parameter>boolean $sort</parameter> - whether to sort the attributes alphabetically </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.attributestostring.return"> &title.return; <para> <emphasis>string</emphasis> string representation of the attributes </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.attributestostring.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/createtag.xml +++ peardoc/en/package/xml/xml-util/xml-util/createtag.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.createtag"> <refnamediv> <refname><function>XML_Util::createTag</function></refname> <refpurpose>create a tag</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::createTag</function></funcdef> <paramdef>string <parameter>$qname</parameter></paramdef> <paramdef>array <parameter> <optional>$attributes = array()</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$content = null</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$namespaceUri = null</optional></parameter></paramdef> <paramdef>boolean <parameter> <optional>$replaceEntities = true</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.createtag.desc"> &title.desc; <para> create a tag with attributes, namespace and adds 'xmlns' if needed. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.createtag.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $qname</parameter> - qualified tag name </para> </listitem> <listitem> <para> <parameter>array $attributes</parameter> - assoc array with attributes </para> </listitem> <listitem> <para> <parameter>string $content</parameter> - string content of the tag </para> </listitem> <listitem> <para> <parameter>string $namespaceUri</parameter> - URI of the namespace if xmlns attribute should be added </para> </listitem> <listitem> <para> <parameter>boolean $replaceEntities</parameter> - whether to replace XML entities in content </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtag.return"> &title.return; <para> <emphasis>string</emphasis> xml tag </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtag.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/createtagfromarray.xml +++ peardoc/en/package/xml/xml-util/xml-util/createtagfromarray.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.createtagfromarray"> <refnamediv> <refname><function>XML_Util::createTag</function></refname> <refpurpose>create a tag from an array</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::createTagFromArray</function></funcdef> <paramdef>array <parameter>$tag</parameter></paramdef> <paramdef>boolean <parameter> <optional>$replaceEntities = true</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.desc"> &title.desc; <para> create a tag from an array. This is similar to XML_Util::createTag(), but more flexible. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.createtagfromarray.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>array $tag</parameter> - array containing information about the tag </para> </listitem> <listitem> <para> <parameter>boolean $replaceEntities</parameter> - whether to replace XML entities in content </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.return"> &title.return; <para> <emphasis>string</emphasis> xml tag </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.note"> &title.note; ¬e.canstatic; </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.example1"> <title>Usage example</title> <example> <title>Creating a tag with XML_Util::createTagFromArray()</title> <programlisting role="php"> <![CDATA[require_once "XML/Util.php"; $tag = array( "namespace" => "xslt", "localPart" => "variable" "namespaceUri" => "http://www.w3.org/1999/XSL/Transform", "attributes" => array( "name" => "myVar" ), "content" => "myValue" ); $string = XML_Util::createTagFromArray($tag);]]> </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/getxmldeclaration.xml +++ peardoc/en/package/xml/xml-util/xml-util/getxmldeclaration.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.getxmldeclaration"> <refnamediv> <refname><function>XML_Util::getXMLDeclaration</function></refname> <refpurpose>build an xml declaration</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::getXMLDeclaration</function></funcdef> <paramdef>string <parameter> <optional>$version = "1.0"</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$encoding = null</optional></parameter></paramdef> <paramdef>boolean <parameter> <optional>$standalone = null</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.getxmldeclaration.desc"> &title.desc; <para> Returns an XML declaration based on parameters. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.getxmldeclaration.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $version</parameter> - XML version </para> </listitem> <listitem> <para> <parameter>string $encoding</parameter> - XML encoding </para> </listitem> <listitem> <para> <parameter>boolean $standalone</parameter> - whether document is standalone </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.getxmldeclaration.return"> &title.return; <para> <emphasis>string</emphasis> XML declaration </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.getxmldeclaration.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/isvalidname.xml +++ peardoc/en/package/xml/xml-util/xml-util/isvalidname.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.isvalidname"> <refnamediv> <refname><function>XML_Util::isValidName</function></refname> <refpurpose>verify an XML name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>boolean <function>XML_Util::isValidName</function></funcdef> <paramdef>string <parameter>$string</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.isvalidname.desc"> &title.desc; <para> Checks, whether a string is a valid XML name. In XML the names of tags and attributes must follow strict rules. This method can be used to validate the names you are using. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.isvalidname.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $string</parameter> - string to be checked </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.isvalidname.return"> &title.return; <para> <emphasis>string</emphasis> valid </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.isvalidname.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/replaceentities.xml +++ peardoc/en/package/xml/xml-util/xml-util/replaceentities.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.replaceentities"> <refnamediv> <refname><function>XML_Util::replaceEntities</function></refname> <refpurpose>replace XML entities</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::replaceEntities</function></funcdef> <paramdef>string <parameter>$string</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.replaceentities.desc"> &title.desc; <para> In XML documents you are not allowed to use & and <. The have to be replaced with their respective entities. This method does this for you and furthermore replaces all other predefined XML entities. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.replaceentities.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $string</parameter> - string, in which entities have to be replaced </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.replaceentities.return"> &title.return; <para> <emphasis>string</emphasis> string with entities replaced </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.replaceentities.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/splitqualifiedname.xml +++ peardoc/en/package/xml/xml-util/xml-util/splitqualifiedname.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.splitqualifiedname"> <refnamediv> <refname><function>XML_Util::splitQualifiedName</function></refname> <refpurpose>split qualified name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>array <function>XML_Util::splitQualifiedName</function></funcdef> <paramdef>string <parameter>$qname</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.splitqualifiedname.desc"> &title.desc; <para> Splits a qualified name and returns array with namespace and local part. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.splitqualifiedname.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $qname</parameter> - qualified tag name (e.g. xsl:stylsheet) </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.splitqualifiedname.return"> &title.return; <para> <emphasis>array</emphasis> assoc array containing namespace and local part of the tag </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.splitqualifiedname.note"> &title.note; ¬e.canstatic; </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 -->
Index: peardoc/en/package/xml.xml diff -u peardoc/en/package/xml.xml:1.4 peardoc/en/package/xml.xml:1.5 --- peardoc/en/package/xml.xml:1.4 Wed Mar 26 17:23:24 2003 +++ peardoc/en/package/xml.xml Fri Aug 1 17:39:19 2003 @@ -10,6 +10,7 @@ &package.xml.xml-sql2xml; &package.xml.xml-transformer; &package.xml.xml-tree; + &package.xml.xml-util; </chapter> <!-- Keep this comment at the end of the file Index: peardoc/en/package/xml/xml-util.xml +++ peardoc/en/package/xml/xml-util.xml <!-- $Revision: 1.1 $ --> <sect1 id="package.xml.xml-util"> <title>XML_Util</title> <para> Collection of often needed methods that help you creating XML documents. </para> &package.xml.xml-util.intro; &package.xml.xml-util.example; &package.xml.xml-util.xml-util.apiversion; &package.xml.xml-util.xml-util.attributestostring; &package.xml.xml-util.xml-util.createtag; &package.xml.xml-util.xml-util.createtagfromarray; &package.xml.xml-util.xml-util.getxmldeclaration; &package.xml.xml-util.xml-util.isvalidname; &package.xml.xml-util.xml-util.replaceentities; &package.xml.xml-util.xml-util.splitqualifiedname; </sect1> <!-- 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 --> Index: peardoc/en/package/xml/xml-util/example.xml +++ peardoc/en/package/xml/xml-util/example.xml <!-- $Revision: 1.1 $ --> <refentry id="package.xml.xml-util.example"> <refnamediv> <refname>Example</refname> <refpurpose>Example for the usage of XML_Util</refpurpose> </refnamediv> <refsect1 id="package.xml.xml-util.example.example1"> <title>Usage example</title> <simpara> The following examples shows how some of the methods of XML_Util have to be used. </simpara> <example> <title>Some basic examples</title> <programlisting role="php"> <![CDATA[require_once "XML/Util.php"; // creating an XML tag $tag = XML_Util::createTag("xsl:stylesheet", array("version" => "1.0"), "Place your content here", "http://www.w3.org/1999/XSL/Transform"); // verify tag name $result = XML_Util::isValidName("my Tag"); if (PEAR::isError($result)) { print "Invalid XML name: " . $result->getMessage(); } else { print "Tagname is valid."; }]]> </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 --> Index: peardoc/en/package/xml/xml-util/intro.xml +++ peardoc/en/package/xml/xml-util/intro.xml <!-- $Revision: 1.1 $ --> <refentry id="package.xml.xml-util.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose>Introduction to XML_Util</refpurpose> </refnamediv> <refsect1 id="package.xml.xml-util.intro.refsect1"> <title>Introduction to XML_Util</title> <para> XML_Util is a utility class that helps you working with (and especially creating) XML documents. </para> <para> All methods of XML_Util can be called statically, that means you do not have to instantiate an XML_Util object to use the provided methods. </para> <para> The funcionality of XML_Util ranges from validating an XML tag name (as there are strict rules for tag and attribute names) to the creation of namespaced XML tags. </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 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 --> Index: peardoc/en/package/xml/xml-util/xml-util/apiversion.xml +++ peardoc/en/package/xml/xml-util/xml-util/apiversion.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.apiversion"> <refnamediv> <refname><function>XML_Util::apiVersion</function></refname> <refpurpose>return API version</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::apiVersion</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.apiversion.desc"> &title.desc; <para> Returns API version of XML_Util. </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.apiversion.return"> &title.return; <para> <emphasis>string</emphasis> API version </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.apiversion.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/attributestostring.xml +++ peardoc/en/package/xml/xml-util/xml-util/attributestostring.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.attributestostring"> <refnamediv> <refname><function>XML_Util::attributesToString</function></refname> <refpurpose>create XML attribute string</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::attributesToString</function></funcdef> <paramdef>array <parameter>$attributes</parameter></paramdef> <paramdef>boolean <parameter> <optional>$sort = true</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.attributestostring.desc"> &title.desc; <para> create string representation of an attribute list </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.attributestostring.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>array $attributes</parameter> - assoc array containg attributes </para> </listitem> <listitem> <para> <parameter>boolean $sort</parameter> - whether to sort the attributes alphabetically </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.attributestostring.return"> &title.return; <para> <emphasis>string</emphasis> string representation of the attributes </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.attributestostring.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/createtag.xml +++ peardoc/en/package/xml/xml-util/xml-util/createtag.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.createtag"> <refnamediv> <refname><function>XML_Util::createTag</function></refname> <refpurpose>create a tag</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::createTag</function></funcdef> <paramdef>string <parameter>$qname</parameter></paramdef> <paramdef>array <parameter> <optional>$attributes = array()</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$content = null</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$namespaceUri = null</optional></parameter></paramdef> <paramdef>boolean <parameter> <optional>$replaceEntities = true</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.createtag.desc"> &title.desc; <para> create a tag with attributes, namespace and adds 'xmlns' if needed. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.createtag.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $qname</parameter> - qualified tag name </para> </listitem> <listitem> <para> <parameter>array $attributes</parameter> - assoc array with attributes </para> </listitem> <listitem> <para> <parameter>string $content</parameter> - string content of the tag </para> </listitem> <listitem> <para> <parameter>string $namespaceUri</parameter> - URI of the namespace if xmlns attribute should be added </para> </listitem> <listitem> <para> <parameter>boolean $replaceEntities</parameter> - whether to replace XML entities in content </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtag.return"> &title.return; <para> <emphasis>string</emphasis> xml tag </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtag.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/createtagfromarray.xml +++ peardoc/en/package/xml/xml-util/xml-util/createtagfromarray.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.createtagfromarray"> <refnamediv> <refname><function>XML_Util::createTag</function></refname> <refpurpose>create a tag from an array</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::createTagFromArray</function></funcdef> <paramdef>array <parameter>$tag</parameter></paramdef> <paramdef>boolean <parameter> <optional>$replaceEntities = true</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.desc"> &title.desc; <para> create a tag from an array. This is similar to XML_Util::createTag(), but more flexible. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.createtagfromarray.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>array $tag</parameter> - array containing information about the tag </para> </listitem> <listitem> <para> <parameter>boolean $replaceEntities</parameter> - whether to replace XML entities in content </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.return"> &title.return; <para> <emphasis>string</emphasis> xml tag </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.note"> &title.note; ¬e.canstatic; </refsect1> <refsect1 id="package.xml.xml-util.xml-util.createtagfromarray.example1"> <title>Usage example</title> <example> <title>Creating a tag with XML_Util::createTagFromArray()</title> <programlisting role="php"> <![CDATA[require_once "XML/Util.php"; $tag = array( "namespace" => "xslt", "localPart" => "variable" "namespaceUri" => "http://www.w3.org/1999/XSL/Transform", "attributes" => array( "name" => "myVar" ), "content" => "myValue" ); $string = XML_Util::createTagFromArray($tag);]]> </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/getxmldeclaration.xml +++ peardoc/en/package/xml/xml-util/xml-util/getxmldeclaration.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.getxmldeclaration"> <refnamediv> <refname><function>XML_Util::getXMLDeclaration</function></refname> <refpurpose>build an xml declaration</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::getXMLDeclaration</function></funcdef> <paramdef>string <parameter> <optional>$version = "1.0"</optional></parameter></paramdef> <paramdef>string <parameter> <optional>$encoding = null</optional></parameter></paramdef> <paramdef>boolean <parameter> <optional>$standalone = null</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.getxmldeclaration.desc"> &title.desc; <para> Returns an XML declaration based on parameters. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.getxmldeclaration.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $version</parameter> - XML version </para> </listitem> <listitem> <para> <parameter>string $encoding</parameter> - XML encoding </para> </listitem> <listitem> <para> <parameter>boolean $standalone</parameter> - whether document is standalone </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.getxmldeclaration.return"> &title.return; <para> <emphasis>string</emphasis> XML declaration </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.getxmldeclaration.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/isvalidname.xml +++ peardoc/en/package/xml/xml-util/xml-util/isvalidname.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.isvalidname"> <refnamediv> <refname><function>XML_Util::isValidName</function></refname> <refpurpose>verify an XML name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>boolean <function>XML_Util::isValidName</function></funcdef> <paramdef>string <parameter>$string</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.isvalidname.desc"> &title.desc; <para> Checks, whether a string is a valid XML name. In XML the names of tags and attributes must follow strict rules. This method can be used to validate the names you are using. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.isvalidname.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $string</parameter> - string to be checked </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.isvalidname.return"> &title.return; <para> <emphasis>string</emphasis> valid </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.isvalidname.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/replaceentities.xml +++ peardoc/en/package/xml/xml-util/xml-util/replaceentities.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.replaceentities"> <refnamediv> <refname><function>XML_Util::replaceEntities</function></refname> <refpurpose>replace XML entities</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>XML_Util::replaceEntities</function></funcdef> <paramdef>string <parameter>$string</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.replaceentities.desc"> &title.desc; <para> In XML documents you are not allowed to use & and <. The have to be replaced with their respective entities. This method does this for you and furthermore replaces all other predefined XML entities. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.replaceentities.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $string</parameter> - string, in which entities have to be replaced </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.replaceentities.return"> &title.return; <para> <emphasis>string</emphasis> string with entities replaced </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.replaceentities.note"> &title.note; ¬e.canstatic; </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 --> Index: peardoc/en/package/xml/xml-util/xml-util/splitqualifiedname.xml +++ peardoc/en/package/xml/xml-util/xml-util/splitqualifiedname.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.xml-util.xml-util.splitqualifiedname"> <refnamediv> <refname><function>XML_Util::splitQualifiedName</function></refname> <refpurpose>split qualified name</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once 'XML/Util.php'; </funcsynopsisinfo> <funcprototype> <funcdef>array <function>XML_Util::splitQualifiedName</function></funcdef> <paramdef>string <parameter>$qname</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.xml.xml-util.xml-util.splitqualifiedname.desc"> &title.desc; <para> Splits a qualified name and returns array with namespace and local part. </para> </refsect1> <refsect1 id="package.default.xml-util.xml-util.splitqualifiedname.param"> &title.param; <para> <itemizedlist> <listitem> <para> <parameter>string $qname</parameter> - qualified tag name (e.g. xsl:stylsheet) </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.splitqualifiedname.return"> &title.return; <para> <emphasis>array</emphasis> assoc array containing namespace and local part of the tag </para> </refsect1> <refsect1 id="package.xml.xml-util.xml-util.splitqualifiedname.note"> &title.note; ¬e.canstatic; </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 -->