/**
  * @param boolean $returnSXE
  * @param \SimpleXMLElement $sxe
  * @return string|\SimpleXMLElement
  */
 public function xmlSerialize($returnSXE = false, $sxe = null)
 {
     if (null === $sxe) {
         $sxe = new \SimpleXMLElement('<TimingRepeat xmlns="http://hl7.org/fhir"></TimingRepeat>');
     }
     parent::xmlSerialize(true, $sxe);
     if (null !== $this->boundsQuantity) {
         $this->boundsQuantity->xmlSerialize(true, $sxe->addChild('boundsQuantity'));
     }
     if (null !== $this->boundsRange) {
         $this->boundsRange->xmlSerialize(true, $sxe->addChild('boundsRange'));
     }
     if (null !== $this->boundsPeriod) {
         $this->boundsPeriod->xmlSerialize(true, $sxe->addChild('boundsPeriod'));
     }
     if (null !== $this->count) {
         $this->count->xmlSerialize(true, $sxe->addChild('count'));
     }
     if (null !== $this->duration) {
         $this->duration->xmlSerialize(true, $sxe->addChild('duration'));
     }
     if (null !== $this->durationMax) {
         $this->durationMax->xmlSerialize(true, $sxe->addChild('durationMax'));
     }
     if (null !== $this->durationUnits) {
         $this->durationUnits->xmlSerialize(true, $sxe->addChild('durationUnits'));
     }
     if (null !== $this->frequency) {
         $this->frequency->xmlSerialize(true, $sxe->addChild('frequency'));
     }
     if (null !== $this->frequencyMax) {
         $this->frequencyMax->xmlSerialize(true, $sxe->addChild('frequencyMax'));
     }
     if (null !== $this->period) {
         $this->period->xmlSerialize(true, $sxe->addChild('period'));
     }
     if (null !== $this->periodMax) {
         $this->periodMax->xmlSerialize(true, $sxe->addChild('periodMax'));
     }
     if (null !== $this->periodUnits) {
         $this->periodUnits->xmlSerialize(true, $sxe->addChild('periodUnits'));
     }
     if (null !== $this->when) {
         $this->when->xmlSerialize(true, $sxe->addChild('when'));
     }
     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('<Goal xmlns="http://hl7.org/fhir"></Goal>');
     }
     parent::xmlSerialize(true, $sxe);
     if (0 < count($this->identifier)) {
         foreach ($this->identifier as $identifier) {
             $identifier->xmlSerialize(true, $sxe->addChild('identifier'));
         }
     }
     if (null !== $this->subject) {
         $this->subject->xmlSerialize(true, $sxe->addChild('subject'));
     }
     if (null !== $this->startDate) {
         $this->startDate->xmlSerialize(true, $sxe->addChild('startDate'));
     }
     if (null !== $this->startCodeableConcept) {
         $this->startCodeableConcept->xmlSerialize(true, $sxe->addChild('startCodeableConcept'));
     }
     if (null !== $this->targetDate) {
         $this->targetDate->xmlSerialize(true, $sxe->addChild('targetDate'));
     }
     if (null !== $this->targetQuantity) {
         $this->targetQuantity->xmlSerialize(true, $sxe->addChild('targetQuantity'));
     }
     if (0 < count($this->category)) {
         foreach ($this->category as $category) {
             $category->xmlSerialize(true, $sxe->addChild('category'));
         }
     }
     if (null !== $this->description) {
         $this->description->xmlSerialize(true, $sxe->addChild('description'));
     }
     if (null !== $this->status) {
         $this->status->xmlSerialize(true, $sxe->addChild('status'));
     }
     if (null !== $this->statusDate) {
         $this->statusDate->xmlSerialize(true, $sxe->addChild('statusDate'));
     }
     if (null !== $this->statusReason) {
         $this->statusReason->xmlSerialize(true, $sxe->addChild('statusReason'));
     }
     if (null !== $this->author) {
         $this->author->xmlSerialize(true, $sxe->addChild('author'));
     }
     if (null !== $this->priority) {
         $this->priority->xmlSerialize(true, $sxe->addChild('priority'));
     }
     if (0 < count($this->addresses)) {
         foreach ($this->addresses as $addresses) {
             $addresses->xmlSerialize(true, $sxe->addChild('addresses'));
         }
     }
     if (0 < count($this->note)) {
         foreach ($this->note as $note) {
             $note->xmlSerialize(true, $sxe->addChild('note'));
         }
     }
     if (0 < count($this->outcome)) {
         foreach ($this->outcome as $outcome) {
             $outcome->xmlSerialize(true, $sxe->addChild('outcome'));
         }
     }
     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();
 }
 /**
  * @param boolean $returnSXE
  * @param \SimpleXMLElement $sxe
  * @return string|\SimpleXMLElement
  */
 public function xmlSerialize($returnSXE = false, $sxe = null)
 {
     if (null === $sxe) {
         $sxe = new \SimpleXMLElement('<MedicationOrderDispenseRequest xmlns="http://hl7.org/fhir"></MedicationOrderDispenseRequest>');
     }
     parent::xmlSerialize(true, $sxe);
     if (null !== $this->medicationCodeableConcept) {
         $this->medicationCodeableConcept->xmlSerialize(true, $sxe->addChild('medicationCodeableConcept'));
     }
     if (null !== $this->medicationReference) {
         $this->medicationReference->xmlSerialize(true, $sxe->addChild('medicationReference'));
     }
     if (null !== $this->validityPeriod) {
         $this->validityPeriod->xmlSerialize(true, $sxe->addChild('validityPeriod'));
     }
     if (null !== $this->numberOfRepeatsAllowed) {
         $this->numberOfRepeatsAllowed->xmlSerialize(true, $sxe->addChild('numberOfRepeatsAllowed'));
     }
     if (null !== $this->quantity) {
         $this->quantity->xmlSerialize(true, $sxe->addChild('quantity'));
     }
     if (null !== $this->expectedSupplyDuration) {
         $this->expectedSupplyDuration->xmlSerialize(true, $sxe->addChild('expectedSupplyDuration'));
     }
     if ($returnSXE) {
         return $sxe;
     }
     return $sxe->saveXML();
 }