Child::toXml - jcobban/Genealogy GitHub Wiki

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

Up: class Child

This method creates an Extensible Markup Language (XML) document. 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 the class name in lower case.
$print If this is omitted or is boolean true the XML document is also sent to standard output. This can also be specified as an array of settings: 'print' may be set to boolean false.
$options This contains a bit mask which is present to match the signature of Record::toXml.

This method is customized to interpret the following fields:

fieldname display as
cpdadprivate a flag field interpreted as a letter 'Y' or 'N' or as null.
cpmomprivate a flag field interpreted as a letter 'Y' or 'N' or as null.
prefchild a flag field interpreted as a letter 'Y' or 'N' or as null.
parseald moved to Event
parsealsd moved to Event
ldsp moved to Event
templetag moved to Event
parsealnote moved to Event

This returns the document as a string. If there is an LDS Sealed to Parents event for this child then it is displayed by calling Event::toXml.

For example:

<child idcr="1">
    <idcr>1</idcr>
    <idmr>1 </idmr>
    <family>
        James Collins and Sarah Richardson on 30 Jun 1886
    </family>
    <idir>51745 </idir>
    <child>Lilly Collins (about 1888—) </child>
    <order>0</order>
    <prefchild>Y</prefchild>
    <idcs>1</idcs>
    <idcpdad>1</idcpdad>
    <idcpmom>1</idcpmom>
    <cpdadprivate>N</cpdadprivate>
    <cpmomprivate>N</cpmomprivate>
</child>

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

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