FamilyTree::toXml - jcobban/Genealogy GitHub Wiki

$tree->toXml($top, $print, $options)

Up: class FamilyTree

This method emits an Extensible Markup Language (XML) document in which the name of the root tag is supplied by the parameter $top. This document contains a tag for each field in the associated database record whose name is the name of the field, and which encloses the textual value of the field. This is used by many PHP scripts, in particular those that permit Javascript to use AJAX to retrieve the contents of a database record for dynamic display to the user. The function returns the generated XML document as a string.

parameter description
$top A string containing the the tag name to use for the root XML tag of the document. If this is not a string or is an empty string it is replaced by "header".
$print If this is omitted or is true the XML document is also sent to standard output. For compatibility with classes which support an associative array of settings this can also be specified as array('print' => true/false)
$options This contains a bit mask which is used by derived classes and is present here only because of the requirement that the signature of overloaded functions in derived classes must match the signature of the base implementation.

This generates something like:

<header>
<Compiler0>13 Dec 2009</Compiler0>
<Compiler1/>
<Compiler2/>
<Compiler3/>
<Compiler4/>
<Compiler5/>
<Compiler6/>
<Compiler7/>
<Compiler8/>
<Compiler9/>
<cReturn0> 0</cReturn0>
<cReturn1> 0</cReturn1>
<cReturn2> 0</cReturn2>
<FileDesc> </FileDesc>
<IDIRHead> 0</IDIRHead>
<IDIRLast> 0</IDIRLast>
<IDMRHead> 0</IDMRHead>
<IDMRLast> 0</IDMRLast>
<IVWhoLast> 0</IVWhoLast>
<Language>EnglishCA</Language>
<LegacyVer>7.4.0.45</LegacyVer>
<MLIDBook> 0</MLIDBook>
<MLIDLast> 0</MLIDLast>
<MLWhoLast> 0</MLWhoLast>
<mReturn0> 0</mReturn0>
<mReturn1> 0</mReturn1>
<mReturn2> 0</mReturn2>
<NLIDBook> 0</NLIDBook>
<NLIDLast> 30357</NLIDLast>
<NLWhoLast> 0</NLWhoLast>
<NoHolesIR>-1</NoHolesIR>
<NoHolesMR>-1</NoHolesMR>
<SLIDBook> 0</SLIDBook>
<SLIDLast> 57014</SLIDLast>
<SLWhoLast> 0</SLWhoLast>
<TagDesc10/>
<TagDesc2/>
<TagDesc3/>
<TagDesc4/>
<TagDesc5/>
<TagDesc6/>
<TagDesc7/>
<TagDesc8/>
<TagDesc9/>
<TempleVer>005</TempleVer>
<UseDelIR>-1</UseDelIR>
<Version>7k</Version>
</header>

Next: $tree->toJson($print, $options)

⚠️ **GitHub.com Fallback** ⚠️