/**
  * @param boolean $returnSXE
  * @param \SimpleXMLElement $sxe
  * @return string|\SimpleXMLElement
  */
 public function xmlSerialize($returnSXE = false, $sxe = null)
 {
     if (null === $sxe) {
         $sxe = new \SimpleXMLElement('<EncounterStatusHistory xmlns="http://hl7.org/fhir"></EncounterStatusHistory>');
     }
     parent::xmlSerialize(true, $sxe);
     if (null !== $this->status) {
         $this->status->xmlSerialize(true, $sxe->addChild('status'));
     }
     if (null !== $this->period) {
         $this->period->xmlSerialize(true, $sxe->addChild('period'));
     }
     if ($returnSXE) {
         return $sxe;
     }
     return $sxe->saveXML();
 }
 /**
  * @param boolean $returnSXE
  * @param \SimpleXMLElement $sxe
  * @return string|\SimpleXMLElement
  */
 public function xmlSerialize($returnSXE = false, $sxe = null)
 {
     if (null === $sxe) {
         $sxe = new \SimpleXMLElement('<Encounter xmlns="http://hl7.org/fhir"></Encounter>');
     }
     parent::xmlSerialize(true, $sxe);
     if (0 < count($this->identifier)) {
         foreach ($this->identifier as $identifier) {
             $identifier->xmlSerialize(true, $sxe->addChild('identifier'));
         }
     }
     if (null !== $this->status) {
         $this->status->xmlSerialize(true, $sxe->addChild('status'));
     }
     if (0 < count($this->statusHistory)) {
         foreach ($this->statusHistory as $statusHistory) {
             $statusHistory->xmlSerialize(true, $sxe->addChild('statusHistory'));
         }
     }
     if (null !== $this->class) {
         $this->class->xmlSerialize(true, $sxe->addChild('class'));
     }
     if (0 < count($this->type)) {
         foreach ($this->type as $type) {
             $type->xmlSerialize(true, $sxe->addChild('type'));
         }
     }
     if (null !== $this->priority) {
         $this->priority->xmlSerialize(true, $sxe->addChild('priority'));
     }
     if (null !== $this->patient) {
         $this->patient->xmlSerialize(true, $sxe->addChild('patient'));
     }
     if (0 < count($this->episodeOfCare)) {
         foreach ($this->episodeOfCare as $episodeOfCare) {
             $episodeOfCare->xmlSerialize(true, $sxe->addChild('episodeOfCare'));
         }
     }
     if (0 < count($this->incomingReferral)) {
         foreach ($this->incomingReferral as $incomingReferral) {
             $incomingReferral->xmlSerialize(true, $sxe->addChild('incomingReferral'));
         }
     }
     if (0 < count($this->participant)) {
         foreach ($this->participant as $participant) {
             $participant->xmlSerialize(true, $sxe->addChild('participant'));
         }
     }
     if (null !== $this->appointment) {
         $this->appointment->xmlSerialize(true, $sxe->addChild('appointment'));
     }
     if (null !== $this->period) {
         $this->period->xmlSerialize(true, $sxe->addChild('period'));
     }
     if (null !== $this->length) {
         $this->length->xmlSerialize(true, $sxe->addChild('length'));
     }
     if (0 < count($this->reason)) {
         foreach ($this->reason as $reason) {
             $reason->xmlSerialize(true, $sxe->addChild('reason'));
         }
     }
     if (0 < count($this->indication)) {
         foreach ($this->indication as $indication) {
             $indication->xmlSerialize(true, $sxe->addChild('indication'));
         }
     }
     if (null !== $this->hospitalization) {
         $this->hospitalization->xmlSerialize(true, $sxe->addChild('hospitalization'));
     }
     if (0 < count($this->location)) {
         foreach ($this->location as $location) {
             $location->xmlSerialize(true, $sxe->addChild('location'));
         }
     }
     if (null !== $this->serviceProvider) {
         $this->serviceProvider->xmlSerialize(true, $sxe->addChild('serviceProvider'));
     }
     if (null !== $this->partOf) {
         $this->partOf->xmlSerialize(true, $sxe->addChild('partOf'));
     }
     if ($returnSXE) {
         return $sxe;
     }
     return $sxe->saveXML();
 }