|
|
|
<memberdef kind="function" id="dd/d40/classefun_1a522a28bfff281a6c0c47f26f75d056d4" prot="package" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
|
<type>string</type> |
|
<definition>string efun.xml_generate</definition> |
|
<argsstring>(mixed *xml)</argsstring> |
|
<name>xml_generate</name> |
|
<param> |
|
<type>mixed *</type> |
|
<declname>xml</declname> |
|
</param> |
|
<briefdescription> |
|
<para>Converts the given <computeroutput>xml</computeroutput> array into an XML conformant string, if possible. </para> |
|
</briefdescription> |
|
<detaileddescription> |
|
<para>The <computeroutput>xml</computeroutput> argument array must have the following structure:</para> |
|
<para>It must contain tag arrays of three elements, with the following indices:</para> |
|
<para>string <computeroutput>XML_TAG_NAME</computeroutput> The name of the XML tag.</para> |
|
<para>mapping <computeroutput>XML_TAG_ATTRIBUTES</computeroutput> All attributes given to the XML tag as a mapping where the key is the attribute name and the value is its string value.</para> |
|
<para>If the xml tag does not contain any attributes, this element is set to 0.</para> |
|
<para>mixed * <computeroutput>XML_TAG_CONTENTS</computeroutput> The contents of this xml tag as an array. This array may contain either strings, or arrays of sub-tags again with three elements. (see example)</para> |
|
<para>If the xml tag does not contain anything, the element is set to 0.</para> |
|
<para>In case the parameter does not follow these rules, errors are raised. The method returns a valid XML string otherwise.</para> |
|
<para>The function is available only if the driver is compiled with Iksemel support. In that case, <ref refid="dc/d46/driver_topics_predefined" kindref="compound">__XML_DOM__</ref> is defined.</para> |
|
<para> |
|
<simplesect kind="par"> |
|
<title>Synopsis:</title> |
|
<para> |
|
<programlisting> |
|
<codeline><highlight class="normal">string<sp/>xml_generate(mixed *xml)</highlight></codeline> |
|
</programlisting> |
|
</para> |
|
</simplesect> |
|
<simplesect kind="par"> |
|
<title>Usage:</title> |
|
<para> |
|
<parblock> |
|
<para>For starters, here's how you can generate individual tags:</para> |
|
<para> |
|
<programlisting> |
|
<codeline><highlight class="normal"><ref refid="dd/d40/classefun_1a522a28bfff281a6c0c47f26f75d056d4" kindref="member">xml_generate</ref>(({<sp/></highlight><highlight class="stringliteral">"abc"</highlight><highlight class="normal">,<sp/>0,<sp/>0<sp/>}));<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>"<abc/>"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><ref refid="dd/d40/classefun_1a522a28bfff281a6c0c47f26f75d056d4" kindref="member">xml_generate</ref>(({<sp/></highlight><highlight class="stringliteral">"abc"</highlight><highlight class="normal">,<sp/>([<sp/></highlight><highlight class="stringliteral">"xyz"</highlight><highlight class="normal"><sp/>:<sp/></highlight><highlight class="stringliteral">"cde"</highlight><highlight class="normal"><sp/>]),<sp/>0<sp/>}));<sp/></highlight><highlight class="comment">//<sp/>"<abc<sp/>xyz="cde"/>"</highlight></codeline> |
|
</programlisting> |
|
Nested tags get complicated (and hard to read) quickly, so it's important to format them consistently: |
|
</para> |
|
<para> |
|
<programlisting> |
|
<codeline><highlight class="normal">mixed<sp/>*xml<sp/>=<sp/>({<sp/></highlight><highlight class="stringliteral">"book"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>([<sp/></highlight><highlight class="stringliteral">"language"</highlight><highlight class="normal"><sp/>:<sp/></highlight><highlight class="stringliteral">"common"</highlight><highlight class="normal"><sp/>])</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/>({<sp/></highlight><highlight class="stringliteral">"title"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>0</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/></highlight><highlight class="stringliteral">"This<sp/>is<sp/>a<sp/>title"</highlight><highlight class="normal"><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/></highlight><highlight class="stringliteral">"chapter"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>0</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/></highlight><highlight class="stringliteral">"This<sp/>is<sp/>a<sp/>chapter"</highlight><highlight class="normal"><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/></highlight><highlight class="stringliteral">"chapter"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>0</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/></highlight><highlight class="stringliteral">"We<sp/>want<sp/>"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/></highlight><highlight class="stringliteral">"b"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>0</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/>({<sp/></highlight><highlight class="stringliteral">"bold"</highlight><highlight class="normal"><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/></highlight><highlight class="stringliteral">"here"</highlight><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>})</highlight></codeline> |
|
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>});</highlight></codeline> |
|
<codeline><highlight class="normal"></highlight></codeline> |
|
<codeline><highlight class="normal"><ref refid="dd/d40/classefun_1a522a28bfff281a6c0c47f26f75d056d4" kindref="member">xml_generate</ref>(xml);<sp/></highlight><highlight class="comment">//<sp/>"<book<sp/>language="common"><title>This<sp/>is<sp/>the<sp/>title</title><chapter>This<sp/>is<sp/>a<sp/>chapter</chapter><chapter>We<sp/>want<sp/><b>bold</b><sp/>here.</chapter></book>"</highlight></codeline> |
|
</programlisting> |
|
</para> |
|
<para></para> |
|
</parblock> |
|
</para> |
|
</simplesect> |
|
</para> |
|
<para> |
|
<simplesect kind="par"> |
|
<title>History:</title> |
|
<para> |
|
<programlisting><codeline><highlight class="normal">introduced<sp/>(3.3.718)</highlight></codeline></programlisting> |
|
</para> |
|
</simplesect> |
|
<simplesect kind="see"><para>efun::xml_parse() </para></simplesect> |
|
</para> |
|
</detaileddescription> |
|
<inbodydescription></inbodydescription> |
|
<location file="obj/doxy_guide/driver/efun/xml_generate.c" line="76" column="1"/> |
|
</memberdef> |