All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hl7.fhir.dstu3.formats.XmlParser Maven / Gradle / Ivy

There is a newer version: 7.4.0
Show newest version
package org.hl7.fhir.dstu3.formats;

/*
  Copyright (c) 2011+, HL7, Inc.
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:
  
   * Redistributions of source code must retain the above copyright notice, this 
     list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, 
     this list of conditions and the following disclaimer in the documentation 
     and/or other materials provided with the distribution.
   * Neither the name of HL7 nor the names of its contributors may be used to 
     endorse or promote products derived from this software without specific 
     prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
  POSSIBILITY OF SUCH DAMAGE.
  
*/

// Generated on Mon, Apr 17, 2017 08:38+1000 for FHIR v3.0.1

import org.hl7.fhir.dstu3.model.DateType;
import org.hl7.fhir.dstu3.model.DateTimeType;
import org.hl7.fhir.dstu3.model.CodeType;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.IntegerType;
import org.hl7.fhir.dstu3.model.OidType;
import org.hl7.fhir.dstu3.model.UriType;
import org.hl7.fhir.dstu3.model.UuidType;
import org.hl7.fhir.dstu3.model.InstantType;
import org.hl7.fhir.dstu3.model.BooleanType;
import org.hl7.fhir.dstu3.model.Base64BinaryType;
import org.hl7.fhir.dstu3.model.UnsignedIntType;
import org.hl7.fhir.dstu3.model.MarkdownType;
import org.hl7.fhir.dstu3.model.TimeType;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.PositiveIntType;
import org.hl7.fhir.dstu3.model.DecimalType;
import org.hl7.fhir.dstu3.model.*;
import org.xmlpull.v1.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.exceptions.FHIRException;
import java.io.IOException;

public class XmlParser extends XmlParserBase {

  public XmlParser() {
    super();
  }

  public XmlParser(boolean allowUnknownContent) {
    super();
    setAllowUnknownContent(allowUnknownContent);
  }


  protected boolean parseElementContent(int eventType, XmlPullParser xpp, Element res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extension")) 
      res.getExtension().add(parseExtension(xpp));
    else
      return false;
      
    return true;
  }

  protected boolean parseBackboneContent(int eventType, XmlPullParser xpp, BackboneElement res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifierExtension")) 
      res.getModifierExtension().add(parseExtension(xpp));
    else
      return parseElementContent(eventType, xpp, res);
      
    return true;
  }

  @SuppressWarnings("unchecked")
  protected > Enumeration parseEnumeration(XmlPullParser xpp, E item, EnumFactory e) throws XmlPullParserException, IOException, FHIRFormatError {
    Enumeration res = new Enumeration(e);
    parseElementAttributes(xpp, res);
    res.setValue((E) e.fromCode(xpp.getAttributeValue(null, "value")));
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected DateType parseDate(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DateType res = new DateType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected DateTimeType parseDateTime(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DateTimeType res = new DateTimeType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected CodeType parseCode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeType res = new CodeType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected StringType parseString(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StringType res = new StringType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected IntegerType parseInteger(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    IntegerType res = new IntegerType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected OidType parseOid(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    OidType res = new OidType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected UriType parseUri(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    UriType res = new UriType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected UuidType parseUuid(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    UuidType res = new UuidType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected InstantType parseInstant(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    InstantType res = new InstantType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected BooleanType parseBoolean(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    BooleanType res = new BooleanType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected Base64BinaryType parseBase64Binary(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Base64BinaryType res = new Base64BinaryType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected UnsignedIntType parseUnsignedInt(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    UnsignedIntType res = new UnsignedIntType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected MarkdownType parseMarkdown(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MarkdownType res = new MarkdownType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected TimeType parseTime(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TimeType res = new TimeType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected IdType parseId(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    IdType res = new IdType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected PositiveIntType parsePositiveInt(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PositiveIntType res = new PositiveIntType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected DecimalType parseDecimal(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DecimalType res = new DecimalType(xpp.getAttributeValue(null, "value"));
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected Extension parseExtension(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Extension res = new Extension();
    parseElementAttributes(xpp, res);
    if (xpp.getAttributeValue(null, "url") != null)
        res.setUrl(xpp.getAttributeValue(null, "url"));
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExtensionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExtensionContent(int eventType, XmlPullParser xpp, Extension res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Narrative parseNarrative(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Narrative res = new Narrative();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNarrativeContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNarrativeContent(int eventType, XmlPullParser xpp, Narrative res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("div")) {
        res.setDiv(parseXhtml(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Reference parseReference(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Reference res = new Reference();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseReferenceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseReferenceContent(int eventType, XmlPullParser xpp, Reference res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReferenceElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Quantity parseQuantity(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Quantity res = new Quantity();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuantityContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuantityContent(int eventType, XmlPullParser xpp, Quantity res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comparator")) {
        res.setComparatorElement(parseEnumeration(xpp, Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unit")) {
        res.setUnitElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Period parsePeriod(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Period res = new Period();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePeriodContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePeriodContent(int eventType, XmlPullParser xpp, Period res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStartElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
        res.setEndElement(parseDateTime(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Attachment parseAttachment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Attachment res = new Attachment();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAttachmentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAttachmentContent(int eventType, XmlPullParser xpp, Attachment res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
        res.setContentTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
        res.setDataElement(parseBase64Binary(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("size")) {
        res.setSizeElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hash")) {
        res.setHashElement(parseBase64Binary(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("creation")) {
        res.setCreationElement(parseDateTime(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Duration parseDuration(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Duration res = new Duration();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDurationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDurationContent(int eventType, XmlPullParser xpp, Duration res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (!parseQuantityContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Count parseCount(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Count res = new Count();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCountContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCountContent(int eventType, XmlPullParser xpp, Count res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (!parseQuantityContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Range parseRange(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Range res = new Range();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRangeContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRangeContent(int eventType, XmlPullParser xpp, Range res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("low")) {
        res.setLow(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("high")) {
        res.setHigh(parseSimpleQuantity(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Annotation parseAnnotation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Annotation res = new Annotation();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAnnotationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAnnotationContent(int eventType, XmlPullParser xpp, Annotation res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "author")) {
        res.setAuthor(parseType("author", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
        res.setTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Money parseMoney(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Money res = new Money();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMoneyContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMoneyContent(int eventType, XmlPullParser xpp, Money res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (!parseQuantityContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Identifier parseIdentifier(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Identifier res = new Identifier();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseIdentifierContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseIdentifierContent(int eventType, XmlPullParser xpp, Identifier res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUseElement(parseEnumeration(xpp, Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assigner")) {
        res.setAssigner(parseReference(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Coding parseCoding(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Coding res = new Coding();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodingContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodingContent(int eventType, XmlPullParser xpp, Coding res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("userSelected")) {
        res.setUserSelectedElement(parseBoolean(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Signature parseSignature(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Signature res = new Signature();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSignatureContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSignatureContent(int eventType, XmlPullParser xpp, Signature res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("when")) {
        res.setWhenElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "who")) {
        res.setWho(parseType("who", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "onBehalfOf")) {
        res.setOnBehalfOf(parseType("onBehalfOf", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
        res.setContentTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("blob")) {
        res.setBlobElement(parseBase64Binary(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SampledData parseSampledData(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SampledData res = new SampledData();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSampledDataContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSampledDataContent(int eventType, XmlPullParser xpp, SampledData res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("origin")) {
        res.setOrigin(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriodElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lowerLimit")) {
        res.setLowerLimitElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("upperLimit")) {
        res.setUpperLimitElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dimensions")) {
        res.setDimensionsElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
        res.setDataElement(parseString(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Ratio parseRatio(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Ratio res = new Ratio();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRatioContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRatioContent(int eventType, XmlPullParser xpp, Ratio res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numerator")) {
        res.setNumerator(parseQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("denominator")) {
        res.setDenominator(parseQuantity(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Distance parseDistance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Distance res = new Distance();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDistanceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDistanceContent(int eventType, XmlPullParser xpp, Distance res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (!parseQuantityContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Age parseAge(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Age res = new Age();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAgeContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAgeContent(int eventType, XmlPullParser xpp, Age res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (!parseQuantityContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CodeableConcept parseCodeableConcept(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeableConcept res = new CodeableConcept();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodeableConceptContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeableConceptContent(int eventType, XmlPullParser xpp, CodeableConcept res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coding")) {
        res.getCoding().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SimpleQuantity parseSimpleQuantity(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SimpleQuantity res = new SimpleQuantity();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSimpleQuantityContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSimpleQuantityContent(int eventType, XmlPullParser xpp, SimpleQuantity res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comparator")) {
        res.setComparatorElement(parseEnumeration(xpp, Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unit")) {
        res.setUnitElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Meta parseMeta(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Meta res = new Meta();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMetaContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMetaContent(int eventType, XmlPullParser xpp, Meta res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versionId")) {
        res.setVersionIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastUpdated")) {
        res.setLastUpdatedElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.getProfile().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("security")) {
        res.getSecurity().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tag")) {
        res.getTag().add(parseCoding(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Address parseAddress(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Address res = new Address();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAddressContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAddressContent(int eventType, XmlPullParser xpp, Address res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUseElement(parseEnumeration(xpp, Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("line")) {
        res.getLine().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("city")) {
        res.setCityElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("district")) {
        res.setDistrictElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("state")) {
        res.setStateElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("postalCode")) {
        res.setPostalCodeElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
        res.setCountryElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TriggerDefinition parseTriggerDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TriggerDefinition res = new TriggerDefinition();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTriggerDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTriggerDefinitionContent(int eventType, XmlPullParser xpp, TriggerDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventName")) {
        res.setEventNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "eventTiming")) {
        res.setEventTiming(parseType("eventTiming", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventData")) {
        res.setEventData(parseDataRequirement(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contributor parseContributor(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Contributor res = new Contributor();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContributorContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContributorContent(int eventType, XmlPullParser xpp, Contributor res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DataRequirement parseDataRequirement(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DataRequirement res = new DataRequirement();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDataRequirementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementContent(int eventType, XmlPullParser xpp, DataRequirement res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.getProfile().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mustSupport")) {
        res.getMustSupport().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("codeFilter")) {
        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateFilter")) {
        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(xpp, res));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(XmlPullParser xpp, DataRequirement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDataRequirementDataRequirementCodeFilterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementDataRequirementCodeFilterComponentContent(int eventType, XmlPullParser xpp, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "valueSet")) {
        res.setValueSet(parseType("valueSet", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueCode")) {
        res.getValueCode().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueCoding")) {
        res.getValueCoding().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueCodeableConcept")) {
        res.getValueCodeableConcept().add(parseCodeableConcept(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(XmlPullParser xpp, DataRequirement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDataRequirementDataRequirementDateFilterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementDataRequirementDateFilterComponentContent(int eventType, XmlPullParser xpp, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Dosage parseDosage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Dosage res = new Dosage();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDosageContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDosageContent(int eventType, XmlPullParser xpp, Dosage res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalInstruction")) {
        res.getAdditionalInstruction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientInstruction")) {
        res.setPatientInstructionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timing")) {
        res.setTiming(parseTiming(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "asNeeded")) {
        res.setAsNeeded(parseType("asNeeded", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
        res.setSite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("route")) {
        res.setRoute(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
        res.setMethod(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "dose")) {
        res.setDose(parseType("dose", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerPeriod")) {
        res.setMaxDosePerPeriod(parseRatio(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerAdministration")) {
        res.setMaxDosePerAdministration(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerLifetime")) {
        res.setMaxDosePerLifetime(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "rate")) {
        res.setRate(parseType("rate", xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RelatedArtifact parseRelatedArtifact(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RelatedArtifact res = new RelatedArtifact();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRelatedArtifactContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRelatedArtifactContent(int eventType, XmlPullParser xpp, RelatedArtifact res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citation")) {
        res.setCitationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("document")) {
        res.setDocument(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseReference(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ContactDetail parseContactDetail(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ContactDetail res = new ContactDetail();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContactDetailContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContactDetailContent(int eventType, XmlPullParser xpp, ContactDetail res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected HumanName parseHumanName(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    HumanName res = new HumanName();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseHumanNameContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHumanNameContent(int eventType, XmlPullParser xpp, HumanName res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUseElement(parseEnumeration(xpp, HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("family")) {
        res.setFamilyElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("given")) {
        res.getGiven().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prefix")) {
        res.getPrefix().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suffix")) {
        res.getSuffix().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ContactPoint parseContactPoint(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ContactPoint res = new ContactPoint();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContactPointContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContactPointContent(int eventType, XmlPullParser xpp, ContactPoint res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseEnumeration(xpp, ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUseElement(parseEnumeration(xpp, ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rank")) {
        res.setRankElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected UsageContext parseUsageContext(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    UsageContext res = new UsageContext();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseUsageContextContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseUsageContextContent(int eventType, XmlPullParser xpp, UsageContext res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Timing parseTiming(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Timing res = new Timing();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTimingContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTimingContent(int eventType, XmlPullParser xpp, Timing res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
        res.getEvent().add(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeat")) {
        res.setRepeat(parseTimingTimingRepeatComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(XmlPullParser xpp, Timing owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTimingTimingRepeatComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTimingTimingRepeatComponentContent(int eventType, XmlPullParser xpp, Timing owner, Timing.TimingRepeatComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "bounds")) {
        res.setBounds(parseType("bounds", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("count")) {
        res.setCountElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("countMax")) {
        res.setCountMaxElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
        res.setDurationElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("durationMax")) {
        res.setDurationMaxElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("durationUnit")) {
        res.setDurationUnitElement(parseEnumeration(xpp, Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequency")) {
        res.setFrequencyElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequencyMax")) {
        res.setFrequencyMaxElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriodElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("periodMax")) {
        res.setPeriodMaxElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("periodUnit")) {
        res.setPeriodUnitElement(parseEnumeration(xpp, Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dayOfWeek")) {
        res.getDayOfWeek().add(parseEnumeration(xpp, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timeOfDay")) {
        res.getTimeOfDay().add(parseTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("when")) {
        res.getWhen().add(parseEnumeration(xpp, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("offset")) {
        res.setOffsetElement(parseUnsignedInt(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition parseElementDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition res = new ElementDefinition();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionContent(int eventType, XmlPullParser xpp, ElementDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("representation")) {
        res.getRepresentation().add(parseEnumeration(xpp, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sliceName")) {
        res.setSliceNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
        res.setLabelElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("slicing")) {
        res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("short")) {
        res.setShortElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinitionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requirements")) {
        res.setRequirementsElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alias")) {
        res.getAlias().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
        res.setMinElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
        res.setMaxElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
        res.setBase(parseElementDefinitionElementDefinitionBaseComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentReference")) {
        res.setContentReferenceElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseElementDefinitionTypeRefComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "defaultValue")) {
        res.setDefaultValue(parseType("defaultValue", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meaningWhenMissing")) {
        res.setMeaningWhenMissingElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderMeaning")) {
        res.setOrderMeaningElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "fixed")) {
        res.setFixed(parseType("fixed", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "pattern")) {
        res.setPattern(parseType("pattern", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("example")) {
        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "minValue")) {
        res.setMinValue(parseType("minValue", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "maxValue")) {
        res.setMaxValue(parseType("maxValue", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxLength")) {
        res.setMaxLengthElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.getCondition().add(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("constraint")) {
        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mustSupport")) {
        res.setMustSupportElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isModifier")) {
        res.setIsModifierElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isSummary")) {
        res.setIsSummaryElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("binding")) {
        res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mapping")) {
        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(xpp, res));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionElementDefinitionSlicingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionElementDefinitionSlicingComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("discriminator")) {
        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ordered")) {
        res.setOrderedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rules")) {
        res.setRulesElement(parseEnumeration(xpp, ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionElementDefinitionBaseComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionElementDefinitionBaseComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
        res.setMinElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
        res.setMaxElement(parseString(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionTypeRefComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionTypeRefComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfileElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetProfile")) {
        res.setTargetProfileElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("aggregation")) {
        res.getAggregation().add(parseEnumeration(xpp, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versioning")) {
        res.setVersioningElement(parseEnumeration(xpp, ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionElementDefinitionExampleComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionElementDefinitionExampleComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
        res.setLabelElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionElementDefinitionConstraintComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionElementDefinitionConstraintComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("key")) {
        res.setKeyElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requirements")) {
        res.setRequirementsElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
        res.setSeverityElement(parseEnumeration(xpp, ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("human")) {
        res.setHumanElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("xpath")) {
        res.setXpathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSourceElement(parseUri(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionElementDefinitionBindingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionElementDefinitionBindingComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strength")) {
        res.setStrengthElement(parseEnumeration(xpp, Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "valueSet")) {
        res.setValueSet(parseType("valueSet", xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(XmlPullParser xpp, ElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseElementDefinitionElementDefinitionMappingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionElementDefinitionMappingComponentContent(int eventType, XmlPullParser xpp, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identity")) {
        res.setIdentityElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("map")) {
        res.setMapElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ParameterDefinition parseParameterDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ParameterDefinition res = new ParameterDefinition();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseParameterDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseParameterDefinitionContent(int eventType, XmlPullParser xpp, ParameterDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUseElement(parseEnumeration(xpp, ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
        res.setMinElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
        res.setMaxElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseReference(xpp));
      } else if (!parseElementContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected void parseDomainResourceAttributes(XmlPullParser xpp, DomainResource res) throws XmlPullParserException, IOException, FHIRFormatError {
    parseResourceAttributes(xpp, res);
  }

  protected boolean parseDomainResourceContent(int eventType, XmlPullParser xpp, DomainResource res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setText(parseNarrative(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contained")) {
        res.getContained().add(parseResourceContained(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extension")) {
        res.getExtension().add(parseExtension(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifierExtension")) {
        res.getModifierExtension().add(parseExtension(xpp));
    } else
    return parseResourceContent(eventType, xpp, res);
    return true;
  }

  protected Parameters parseParameters(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Parameters res = new Parameters();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseParametersContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseParametersContent(int eventType, XmlPullParser xpp, Parameters res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
        res.getParameter().add(parseParametersParametersParameterComponent(xpp, res));
      } else if (!parseResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(XmlPullParser xpp, Parameters owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseParametersParametersParameterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseParametersParametersParameterComponentContent(int eventType, XmlPullParser xpp, Parameters owner, Parameters.ParametersParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseResourceContained(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("part")) {
        res.getPart().add(parseParametersParametersParameterComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected void parseResourceAttributes(XmlPullParser xpp, Resource res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (!comments.isEmpty()) {
      res.getFormatCommentsPre().addAll(comments);
      comments.clear();
     }
  }

  protected boolean parseResourceContent(int eventType, XmlPullParser xpp, Resource res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("id")) {
        res.setIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meta")) {
        res.setMeta(parseMeta(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implicitRules")) {
        res.setImplicitRulesElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseCode(xpp));
    } else
        return false;
    return true;
  }

  protected Account parseAccount(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Account res = new Account();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAccountContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAccountContent(int eventType, XmlPullParser xpp, Account res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActive(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("balance")) {
        res.setBalance(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.getCoverage().add(parseAccountCoverageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("owner")) {
        res.setOwner(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("guarantor")) {
        res.getGuarantor().add(parseAccountGuarantorComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Account.CoverageComponent parseAccountCoverageComponent(XmlPullParser xpp, Account owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Account.CoverageComponent res = new Account.CoverageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAccountCoverageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAccountCoverageComponentContent(int eventType, XmlPullParser xpp, Account owner, Account.CoverageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.setCoverage(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parsePositiveInt(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Account.GuarantorComponent parseAccountGuarantorComponent(XmlPullParser xpp, Account owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Account.GuarantorComponent res = new Account.GuarantorComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAccountGuarantorComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAccountGuarantorComponentContent(int eventType, XmlPullParser xpp, Account owner, Account.GuarantorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
        res.setParty(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onHold")) {
        res.setOnHoldElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ActivityDefinition parseActivityDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ActivityDefinition res = new ActivityDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseActivityDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseActivityDefinitionContent(int eventType, XmlPullParser xpp, ActivityDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
        res.setUsageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
        res.setApprovalDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
        res.setLastReviewDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
        res.setEffectivePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
        res.getContributor().add(parseContributor(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
        res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("library")) {
        res.getLibrary().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
        res.setTiming(parseType("timing", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "product")) {
        res.setProduct(parseType("product", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosage")) {
        res.getDosage().add(parseDosage(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.getBodySite().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("transform")) {
        res.setTransform(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dynamicValue")) {
        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(XmlPullParser xpp, ActivityDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseActivityDefinitionActivityDefinitionParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseActivityDefinitionActivityDefinitionParticipantComponentContent(int eventType, XmlPullParser xpp, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(XmlPullParser xpp, ActivityDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseActivityDefinitionActivityDefinitionDynamicValueComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseActivityDefinitionActivityDefinitionDynamicValueComponentContent(int eventType, XmlPullParser xpp, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AdverseEvent parseAdverseEvent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent res = new AdverseEvent();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAdverseEventContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventContent(int eventType, XmlPullParser xpp, AdverseEvent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategoryElement(parseEnumeration(xpp, AdverseEvent.AdverseEventCategory.NULL, new AdverseEvent.AdverseEventCategoryEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reaction")) {
        res.getReaction().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("seriousness")) {
        res.setSeriousness(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorder")) {
        res.setRecorder(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventParticipant")) {
        res.setEventParticipant(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suspectEntity")) {
        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subjectMedicalHistory")) {
        res.getSubjectMedicalHistory().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceDocument")) {
        res.getReferenceDocument().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("study")) {
        res.getStudy().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(XmlPullParser xpp, AdverseEvent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAdverseEventAdverseEventSuspectEntityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventAdverseEventSuspectEntityComponentContent(int eventType, XmlPullParser xpp, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
        res.setInstance(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causality")) {
        res.setCausalityElement(parseEnumeration(xpp, AdverseEvent.AdverseEventCausality.NULL, new AdverseEvent.AdverseEventCausalityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causalityAssessment")) {
        res.setCausalityAssessment(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causalityProductRelatedness")) {
        res.setCausalityProductRelatednessElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causalityMethod")) {
        res.setCausalityMethod(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causalityAuthor")) {
        res.setCausalityAuthor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causalityResult")) {
        res.setCausalityResult(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AllergyIntolerance parseAllergyIntolerance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AllergyIntolerance res = new AllergyIntolerance();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAllergyIntoleranceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAllergyIntoleranceContent(int eventType, XmlPullParser xpp, AllergyIntolerance res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("clinicalStatus")) {
        res.setClinicalStatusElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL, new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verificationStatus")) {
        res.setVerificationStatusElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL, new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criticality")) {
        res.setCriticalityElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "onset")) {
        res.setOnset(parseType("onset", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assertedDate")) {
        res.setAssertedDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorder")) {
        res.setRecorder(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("asserter")) {
        res.setAsserter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastOccurrence")) {
        res.setLastOccurrenceElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reaction")) {
        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(XmlPullParser xpp, AllergyIntolerance owner) throws XmlPullParserException, IOException, FHIRFormatError {
    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAllergyIntoleranceAllergyIntoleranceReactionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAllergyIntoleranceAllergyIntoleranceReactionComponentContent(int eventType, XmlPullParser xpp, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substance")) {
        res.setSubstance(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manifestation")) {
        res.getManifestation().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onset")) {
        res.setOnsetElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
        res.setSeverityElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposureRoute")) {
        res.setExposureRoute(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Appointment parseAppointment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Appointment res = new Appointment();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAppointmentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAppointmentContent(int eventType, XmlPullParser xpp, Appointment res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceCategory")) {
        res.setServiceCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceType")) {
        res.getServiceType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
        res.getSpecialty().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appointmentType")) {
        res.setAppointmentType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.getReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indication")) {
        res.getIndication().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
        res.getSupportingInformation().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStartElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
        res.setEndElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("minutesDuration")) {
        res.setMinutesDurationElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("slot")) {
        res.getSlot().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("incomingReferral")) {
        res.getIncomingReferral().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestedPeriod")) {
        res.getRequestedPeriod().add(parsePeriod(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(XmlPullParser xpp, Appointment owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAppointmentAppointmentParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAppointmentAppointmentParticipantComponentContent(int eventType, XmlPullParser xpp, Appointment owner, Appointment.AppointmentParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("required")) {
        res.setRequiredElement(parseEnumeration(xpp, Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AppointmentResponse parseAppointmentResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AppointmentResponse res = new AppointmentResponse();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAppointmentResponseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAppointmentResponseContent(int eventType, XmlPullParser xpp, AppointmentResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appointment")) {
        res.setAppointment(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStartElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
        res.setEndElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participantType")) {
        res.getParticipantType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participantStatus")) {
        res.setParticipantStatusElement(parseEnumeration(xpp, AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AuditEvent parseAuditEvent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent res = new AuditEvent();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAuditEventContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventContent(int eventType, XmlPullParser xpp, AuditEvent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtype")) {
        res.getSubtype().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.setActionElement(parseEnumeration(xpp, AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorded")) {
        res.setRecordedElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcomeElement(parseEnumeration(xpp, AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcomeDesc")) {
        res.setOutcomeDescElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purposeOfEvent")) {
        res.getPurposeOfEvent().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.getAgent().add(parseAuditEventAuditEventAgentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSource(parseAuditEventAuditEventSourceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entity")) {
        res.getEntity().add(parseAuditEventAuditEventEntityComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(XmlPullParser xpp, AuditEvent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAuditEventAuditEventAgentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventAuditEventAgentComponentContent(int eventType, XmlPullParser xpp, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.getRole().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("userId")) {
        res.setUserId(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("altId")) {
        res.setAltIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestor")) {
        res.setRequestorElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("policy")) {
        res.getPolicy().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("media")) {
        res.setMedia(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("network")) {
        res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purposeOfUse")) {
        res.getPurposeOfUse().add(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(XmlPullParser xpp, AuditEvent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAuditEventAuditEventAgentNetworkComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventAuditEventAgentNetworkComponentContent(int eventType, XmlPullParser xpp, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.setAddressElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(XmlPullParser xpp, AuditEvent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAuditEventAuditEventSourceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventAuditEventSourceComponentContent(int eventType, XmlPullParser xpp, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
        res.setSiteElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCoding(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(XmlPullParser xpp, AuditEvent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAuditEventAuditEventEntityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventAuditEventEntityComponentContent(int eventType, XmlPullParser xpp, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lifecycle")) {
        res.setLifecycle(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
        res.getSecurityLabel().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("query")) {
        res.setQueryElement(parseBase64Binary(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(XmlPullParser xpp, AuditEvent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseAuditEventAuditEventEntityDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventAuditEventEntityDetailComponentContent(int eventType, XmlPullParser xpp, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseBase64Binary(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Basic parseBasic(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Basic res = new Basic();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBasicContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBasicContent(int eventType, XmlPullParser xpp, Basic res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Binary parseBinary(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Binary res = new Binary();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBinaryContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBinaryContent(int eventType, XmlPullParser xpp, Binary res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
        res.setContentTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityContext")) {
        res.setSecurityContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
        res.setContentElement(parseBase64Binary(xpp));
      } else if (!parseResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected BodySite parseBodySite(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    BodySite res = new BodySite();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBodySiteContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBodySiteContent(int eventType, XmlPullParser xpp, BodySite res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualifier")) {
        res.getQualifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("image")) {
        res.getImage().add(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Bundle parseBundle(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle res = new Bundle();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBundleContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleContent(int eventType, XmlPullParser xpp, Bundle res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
        res.setTotalElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parseBundleBundleLinkComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entry")) {
        res.getEntry().add(parseBundleBundleEntryComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("signature")) {
        res.setSignature(parseSignature(xpp));
      } else if (!parseResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(XmlPullParser xpp, Bundle owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBundleBundleLinkComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleBundleLinkComponentContent(int eventType, XmlPullParser xpp, Bundle owner, Bundle.BundleLinkComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relation")) {
        res.setRelationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(XmlPullParser xpp, Bundle owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBundleBundleEntryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleBundleEntryComponentContent(int eventType, XmlPullParser xpp, Bundle owner, Bundle.BundleEntryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parseBundleBundleLinkComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fullUrl")) {
        res.setFullUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseResourceContained(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("search")) {
        res.setSearch(parseBundleBundleEntrySearchComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseBundleBundleEntryRequestComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
        res.setResponse(parseBundleBundleEntryResponseComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(XmlPullParser xpp, Bundle owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBundleBundleEntrySearchComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleBundleEntrySearchComponentContent(int eventType, XmlPullParser xpp, Bundle owner, Bundle.BundleEntrySearchComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("score")) {
        res.setScoreElement(parseDecimal(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(XmlPullParser xpp, Bundle owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBundleBundleEntryRequestComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleBundleEntryRequestComponentContent(int eventType, XmlPullParser xpp, Bundle owner, Bundle.BundleEntryRequestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
        res.setMethodElement(parseEnumeration(xpp, Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifNoneMatch")) {
        res.setIfNoneMatchElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifModifiedSince")) {
        res.setIfModifiedSinceElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifMatch")) {
        res.setIfMatchElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifNoneExist")) {
        res.setIfNoneExistElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(XmlPullParser xpp, Bundle owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseBundleBundleEntryResponseComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleBundleEntryResponseComponentContent(int eventType, XmlPullParser xpp, Bundle owner, Bundle.BundleEntryResponseComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocationElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("etag")) {
        res.setEtagElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastModified")) {
        res.setLastModifiedElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseResourceContained(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement parseCapabilityStatement(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement res = new CapabilityStatement();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementContent(int eventType, XmlPullParser xpp, CapabilityStatement res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiates")) {
        res.getInstantiates().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("software")) {
        res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementation")) {
        res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirVersion")) {
        res.setFhirVersionElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("acceptUnknown")) {
        res.setAcceptUnknownElement(parseEnumeration(xpp, CapabilityStatement.UnknownContentCode.NULL, new CapabilityStatement.UnknownContentCodeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("format")) {
        res.getFormat().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patchFormat")) {
        res.getPatchFormat().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementationGuide")) {
        res.getImplementationGuide().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.getProfile().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rest")) {
        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("messaging")) {
        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("document")) {
        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementSoftwareComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementSoftwareComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("releaseDate")) {
        res.setReleaseDateElement(parseDateTime(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementImplementationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementImplementationComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementRestComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementRestComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("security")) {
        res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestOperationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compartment")) {
        res.getCompartment().add(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementRestSecurityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementRestSecurityComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cors")) {
        res.setCorsElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.getService().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("certificate")) {
        res.getCertificate().add(parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res = new CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("blob")) {
        res.setBlobElement(parseBase64Binary(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementRestResourceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementRestResourceComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versioning")) {
        res.setVersioningElement(parseEnumeration(xpp, CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("readHistory")) {
        res.setReadHistoryElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("updateCreate")) {
        res.setUpdateCreateElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalCreate")) {
        res.setConditionalCreateElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalRead")) {
        res.setConditionalReadElement(parseEnumeration(xpp, CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalUpdate")) {
        res.setConditionalUpdateElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalDelete")) {
        res.setConditionalDeleteElement(parseEnumeration(xpp, CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referencePolicy")) {
        res.getReferencePolicy().add(parseEnumeration(xpp, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchInclude")) {
        res.getSearchInclude().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchRevInclude")) {
        res.getSearchRevInclude().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementResourceInteractionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementResourceInteractionComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinitionElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementSystemInteractionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementSystemInteractionComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementRestOperationComponent parseCapabilityStatementCapabilityStatementRestOperationComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestOperationComponent res = new CapabilityStatement.CapabilityStatementRestOperationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementRestOperationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementRestOperationComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestOperationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinition(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementMessagingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementMessagingComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reliableCache")) {
        res.setReliableCacheElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportedMessage")) {
        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
        res.getEvent().add(parseCapabilityStatementCapabilityStatementMessagingEventComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementMessagingEndpointComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementMessagingEndpointComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocol")) {
        res.setProtocol(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.setAddressElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinition(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementMessagingEventComponent parseCapabilityStatementCapabilityStatementMessagingEventComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementMessagingEventComponent res = new CapabilityStatement.CapabilityStatementMessagingEventComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementMessagingEventComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementMessagingEventComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEventComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategoryElement(parseEnumeration(xpp, CapabilityStatement.MessageSignificanceCategory.NULL, new CapabilityStatement.MessageSignificanceCategoryEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focus")) {
        res.setFocusElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
        res.setResponse(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(XmlPullParser xpp, CapabilityStatement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCapabilityStatementCapabilityStatementDocumentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementCapabilityStatementDocumentComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CarePlan parseCarePlan(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CarePlan res = new CarePlan();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCarePlanContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCarePlanContent(int eventType, XmlPullParser xpp, CarePlan res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
        res.getReplaces().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
        res.setIntentElement(parseEnumeration(xpp, CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.getAuthor().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeam")) {
        res.getCareTeam().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addresses")) {
        res.getAddresses().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
        res.getSupportingInfo().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("goal")) {
        res.getGoal().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activity")) {
        res.getActivity().add(parseCarePlanCarePlanActivityComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(XmlPullParser xpp, CarePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCarePlanCarePlanActivityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCarePlanCarePlanActivityComponentContent(int eventType, XmlPullParser xpp, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcomeCodeableConcept")) {
        res.getOutcomeCodeableConcept().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcomeReference")) {
        res.getOutcomeReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("progress")) {
        res.getProgress().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.setDetail(parseCarePlanCarePlanActivityDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(XmlPullParser xpp, CarePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCarePlanCarePlanActivityDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCarePlanCarePlanActivityDetailComponentContent(int eventType, XmlPullParser xpp, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinition(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("goal")) {
        res.getGoal().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
        res.setStatusReasonElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prohibited")) {
        res.setProhibitedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "scheduled")) {
        res.setScheduled(parseType("scheduled", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.getPerformer().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "product")) {
        res.setProduct(parseType("product", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dailyAmount")) {
        res.setDailyAmount(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CareTeam parseCareTeam(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CareTeam res = new CareTeam();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCareTeamContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCareTeamContent(int eventType, XmlPullParser xpp, CareTeam res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("managingOrganization")) {
        res.getManagingOrganization().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(XmlPullParser xpp, CareTeam owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCareTeamCareTeamParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCareTeamCareTeamParticipantComponentContent(int eventType, XmlPullParser xpp, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("member")) {
        res.setMember(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ChargeItem parseChargeItem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItem res = new ChargeItem();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseChargeItemContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseChargeItemContent(int eventType, XmlPullParser xpp, ChargeItem res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parseChargeItemChargeItemParticipantComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performingOrganization")) {
        res.setPerformingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestingOrganization")) {
        res.setRequestingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodysite")) {
        res.getBodysite().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factorOverride")) {
        res.setFactorOverrideElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priceOverride")) {
        res.setPriceOverride(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("overrideReason")) {
        res.setOverrideReasonElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enterer")) {
        res.setEnterer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enteredDate")) {
        res.setEnteredDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.getReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.getService().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("account")) {
        res.getAccount().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
        res.getSupportingInformation().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ChargeItem.ChargeItemParticipantComponent parseChargeItemChargeItemParticipantComponent(XmlPullParser xpp, ChargeItem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItem.ChargeItemParticipantComponent res = new ChargeItem.ChargeItemParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseChargeItemChargeItemParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseChargeItemChargeItemParticipantComponentContent(int eventType, XmlPullParser xpp, ChargeItem owner, ChargeItem.ChargeItemParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim parseClaim(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim res = new Claim();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimContent(int eventType, XmlPullParser xpp, Claim res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subType")) {
        res.getSubType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUseElement(parseEnumeration(xpp, Claim.Use.NULL, new Claim.UseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("billablePeriod")) {
        res.setBillablePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enterer")) {
        res.setEnterer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
        res.setInsurer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriority(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fundsReserve")) {
        res.setFundsReserve(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("related")) {
        res.getRelated().add(parseClaimRelatedClaimComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prescription")) {
        res.setPrescription(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("originalPrescription")) {
        res.setOriginalPrescription(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payee")) {
        res.setPayee(parseClaimPayeeComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referral")) {
        res.setReferral(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("facility")) {
        res.setFacility(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeam")) {
        res.getCareTeam().add(parseClaimCareTeamComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("information")) {
        res.getInformation().add(parseClaimSpecialConditionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
        res.getDiagnosis().add(parseClaimDiagnosisComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
        res.getProcedure().add(parseClaimProcedureComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
        res.getInsurance().add(parseClaimInsuranceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accident")) {
        res.setAccident(parseClaimAccidentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("employmentImpacted")) {
        res.setEmploymentImpacted(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hospitalization")) {
        res.setHospitalization(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseClaimItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
        res.setTotal(parseMoney(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimRelatedClaimComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimRelatedClaimComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.RelatedClaimComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claim")) {
        res.setClaim(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.setRelationship(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseIdentifier(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.PayeeComponent parseClaimPayeeComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.PayeeComponent res = new Claim.PayeeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimPayeeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimPayeeComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.PayeeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceType")) {
        res.setResourceType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
        res.setParty(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.CareTeamComponent parseClaimCareTeamComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimCareTeamComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimCareTeamComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.CareTeamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responsible")) {
        res.setResponsibleElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualification")) {
        res.setQualification(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.SpecialConditionComponent parseClaimSpecialConditionComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.SpecialConditionComponent res = new Claim.SpecialConditionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimSpecialConditionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimSpecialConditionComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.SpecialConditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
        res.setTiming(parseType("timing", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimDiagnosisComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimDiagnosisComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.DiagnosisComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "diagnosis")) {
        res.setDiagnosis(parseType("diagnosis", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageCode")) {
        res.setPackageCode(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.ProcedureComponent parseClaimProcedureComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimProcedureComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimProcedureComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.ProcedureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "procedure")) {
        res.setProcedure(parseType("procedure", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.InsuranceComponent parseClaimInsuranceComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimInsuranceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimInsuranceComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.InsuranceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focal")) {
        res.setFocalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.setCoverage(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("businessArrangement")) {
        res.setBusinessArrangementElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthRef")) {
        res.getPreAuthRef().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claimResponse")) {
        res.setClaimResponse(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.AccidentComponent parseClaimAccidentComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.AccidentComponent res = new Claim.AccidentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimAccidentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimAccidentComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.AccidentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "location")) {
        res.setLocation(parseType("location", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.ItemComponent parseClaimItemComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.ItemComponent res = new Claim.ItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimItemComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.ItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeamLinkId")) {
        res.getCareTeamLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosisLinkId")) {
        res.getDiagnosisLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedureLinkId")) {
        res.getProcedureLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationLinkId")) {
        res.getInformationLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
        res.getProgramCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "serviced")) {
        res.setServiced(parseType("serviced", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "location")) {
        res.setLocation(parseType("location", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
        res.getUdi().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.setBodySite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subSite")) {
        res.getSubSite().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.getEncounter().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseClaimDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.DetailComponent parseClaimDetailComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.DetailComponent res = new Claim.DetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimDetailComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.DetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
        res.getProgramCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
        res.getUdi().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
        res.getSubDetail().add(parseClaimSubDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Claim.SubDetailComponent parseClaimSubDetailComponent(XmlPullParser xpp, Claim owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimSubDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimSubDetailComponentContent(int eventType, XmlPullParser xpp, Claim owner, Claim.SubDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
        res.getProgramCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
        res.getUdi().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse parseClaimResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse res = new ClaimResponse();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseContent(int eventType, XmlPullParser xpp, ClaimResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
        res.setInsurer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestProvider")) {
        res.setRequestProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestOrganization")) {
        res.setRequestOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
        res.setDispositionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payeeType")) {
        res.setPayeeType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseClaimResponseItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addItem")) {
        res.getAddItem().add(parseClaimResponseAddedItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
        res.getError().add(parseClaimResponseErrorComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalCost")) {
        res.setTotalCost(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unallocDeductable")) {
        res.setUnallocDeductable(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalBenefit")) {
        res.setTotalBenefit(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
        res.setPayment(parseClaimResponsePaymentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reserved")) {
        res.setReserved(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
        res.setForm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processNote")) {
        res.getProcessNote().add(parseClaimResponseNoteComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("communicationRequest")) {
        res.getCommunicationRequest().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
        res.getInsurance().add(parseClaimResponseInsuranceComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseItemComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.ItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceLinkId")) {
        res.setSequenceLinkIdElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseClaimResponseItemDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseAdjudicationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseAdjudicationComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseDecimal(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseItemDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseItemDetailComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceLinkId")) {
        res.setSequenceLinkIdElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
        res.getSubDetail().add(parseClaimResponseSubDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseSubDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseSubDetailComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceLinkId")) {
        res.setSequenceLinkIdElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseAddedItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseAddedItemComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceLinkId")) {
        res.getSequenceLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fee")) {
        res.setFee(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseAddedItemsDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseAddedItemsDetailComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.AddedItemsDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fee")) {
        res.setFee(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseErrorComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseErrorComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceLinkId")) {
        res.setSequenceLinkIdElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detailSequenceLinkId")) {
        res.setDetailSequenceLinkIdElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subdetailSequenceLinkId")) {
        res.setSubdetailSequenceLinkIdElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponsePaymentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponsePaymentComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjustment")) {
        res.setAdjustment(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjustmentReason")) {
        res.setAdjustmentReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseNoteComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseNoteComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.NoteComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
        res.setNumberElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguage(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(XmlPullParser xpp, ClaimResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClaimResponseInsuranceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseInsuranceComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focal")) {
        res.setFocalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.setCoverage(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("businessArrangement")) {
        res.setBusinessArrangementElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthRef")) {
        res.getPreAuthRef().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claimResponse")) {
        res.setClaimResponse(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClinicalImpression parseClinicalImpression(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ClinicalImpression res = new ClinicalImpression();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClinicalImpressionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClinicalImpressionContent(int eventType, XmlPullParser xpp, ClinicalImpression res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "effective")) {
        res.setEffective(parseType("effective", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assessor")) {
        res.setAssessor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("previous")) {
        res.setPrevious(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("problem")) {
        res.getProblem().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("investigation")) {
        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocol")) {
        res.getProtocol().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
        res.setSummaryElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("finding")) {
        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prognosisCodeableConcept")) {
        res.getPrognosisCodeableConcept().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prognosisReference")) {
        res.getPrognosisReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(XmlPullParser xpp, ClinicalImpression owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClinicalImpressionClinicalImpressionInvestigationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClinicalImpressionClinicalImpressionInvestigationComponentContent(int eventType, XmlPullParser xpp, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(XmlPullParser xpp, ClinicalImpression owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseClinicalImpressionClinicalImpressionFindingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClinicalImpressionClinicalImpressionFindingComponentContent(int eventType, XmlPullParser xpp, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
        res.setItem(parseType("item", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basis")) {
        res.setBasisElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CodeSystem parseCodeSystem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem res = new CodeSystem();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodeSystemContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemContent(int eventType, XmlPullParser xpp, CodeSystem res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("caseSensitive")) {
        res.setCaseSensitiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
        res.setValueSetElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hierarchyMeaning")) {
        res.setHierarchyMeaningElement(parseEnumeration(xpp, CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compositional")) {
        res.setCompositionalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versionNeeded")) {
        res.setVersionNeededElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
        res.setContentElement(parseEnumeration(xpp, CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("count")) {
        res.setCountElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("filter")) {
        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
        res.getProperty().add(parseCodeSystemPropertyComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(XmlPullParser xpp, CodeSystem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodeSystemCodeSystemFilterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemCodeSystemFilterComponentContent(int eventType, XmlPullParser xpp, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operator")) {
        res.getOperator().add(parseEnumeration(xpp, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(XmlPullParser xpp, CodeSystem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodeSystemPropertyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemPropertyComponentContent(int eventType, XmlPullParser xpp, CodeSystem owner, CodeSystem.PropertyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
        res.setUriElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(XmlPullParser xpp, CodeSystem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodeSystemConceptDefinitionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemConceptDefinitionComponentContent(int eventType, XmlPullParser xpp, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinitionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("designation")) {
        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
        res.getProperty().add(parseCodeSystemConceptPropertyComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(XmlPullParser xpp, CodeSystem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodeSystemConceptDefinitionDesignationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemConceptDefinitionDesignationComponentContent(int eventType, XmlPullParser xpp, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUse(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(XmlPullParser xpp, CodeSystem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCodeSystemConceptPropertyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemConceptPropertyComponentContent(int eventType, XmlPullParser xpp, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Communication parseCommunication(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Communication res = new Communication();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCommunicationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCommunicationContent(int eventType, XmlPullParser xpp, Communication res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notDone")) {
        res.setNotDoneElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notDoneReason")) {
        res.setNotDoneReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medium")) {
        res.getMedium().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
        res.getRecipient().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sent")) {
        res.setSentElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("received")) {
        res.setReceivedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sender")) {
        res.setSender(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payload")) {
        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(XmlPullParser xpp, Communication owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCommunicationCommunicationPayloadComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCommunicationCommunicationPayloadComponentContent(int eventType, XmlPullParser xpp, Communication owner, Communication.CommunicationPayloadComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "content")) {
        res.setContent(parseType("content", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CommunicationRequest parseCommunicationRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CommunicationRequest res = new CommunicationRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCommunicationRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCommunicationRequestContent(int eventType, XmlPullParser xpp, CommunicationRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
        res.getReplaces().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupIdentifier")) {
        res.setGroupIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medium")) {
        res.getMedium().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
        res.getRecipient().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payload")) {
        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sender")) {
        res.setSender(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
        res.setRequester(parseCommunicationRequestCommunicationRequestRequesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(XmlPullParser xpp, CommunicationRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCommunicationRequestCommunicationRequestPayloadComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCommunicationRequestCommunicationRequestPayloadComponentContent(int eventType, XmlPullParser xpp, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "content")) {
        res.setContent(parseType("content", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CommunicationRequest.CommunicationRequestRequesterComponent parseCommunicationRequestCommunicationRequestRequesterComponent(XmlPullParser xpp, CommunicationRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CommunicationRequest.CommunicationRequestRequesterComponent res = new CommunicationRequest.CommunicationRequestRequesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCommunicationRequestCommunicationRequestRequesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCommunicationRequestCommunicationRequestRequesterComponentContent(int eventType, XmlPullParser xpp, CommunicationRequest owner, CommunicationRequest.CommunicationRequestRequesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.setAgent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CompartmentDefinition parseCompartmentDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CompartmentDefinition res = new CompartmentDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCompartmentDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompartmentDefinitionContent(int eventType, XmlPullParser xpp, CompartmentDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("search")) {
        res.setSearchElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(XmlPullParser xpp, CompartmentDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCompartmentDefinitionCompartmentDefinitionResourceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompartmentDefinitionCompartmentDefinitionResourceComponentContent(int eventType, XmlPullParser xpp, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("param")) {
        res.getParam().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Composition parseComposition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition res = new Composition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCompositionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionContent(int eventType, XmlPullParser xpp, Composition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
        res.setClass_(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.setEncounter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.getAuthor().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("confidentiality")) {
        res.setConfidentialityElement(parseEnumeration(xpp, Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attester")) {
        res.getAttester().add(parseCompositionCompositionAttesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian")) {
        res.setCustodian(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatesTo")) {
        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
        res.getEvent().add(parseCompositionCompositionEventComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("section")) {
        res.getSection().add(parseCompositionSectionComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(XmlPullParser xpp, Composition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCompositionCompositionAttesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionCompositionAttesterComponentContent(int eventType, XmlPullParser xpp, Composition owner, Composition.CompositionAttesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.getMode().add(parseEnumeration(xpp, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
        res.setTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
        res.setParty(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(XmlPullParser xpp, Composition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCompositionCompositionRelatesToComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionCompositionRelatesToComponentContent(int eventType, XmlPullParser xpp, Composition owner, Composition.CompositionRelatesToComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "target")) {
        res.setTarget(parseType("target", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(XmlPullParser xpp, Composition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCompositionCompositionEventComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionCompositionEventComponentContent(int eventType, XmlPullParser xpp, Composition owner, Composition.CompositionEventComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Composition.SectionComponent parseCompositionSectionComponent(XmlPullParser xpp, Composition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition.SectionComponent res = new Composition.SectionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCompositionSectionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionSectionComponentContent(int eventType, XmlPullParser xpp, Composition owner, Composition.SectionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setText(parseNarrative(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderedBy")) {
        res.setOrderedBy(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entry")) {
        res.getEntry().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("emptyReason")) {
        res.setEmptyReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("section")) {
        res.getSection().add(parseCompositionSectionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ConceptMap parseConceptMap(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap res = new ConceptMap();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConceptMapContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConceptMapContent(int eventType, XmlPullParser xpp, ConceptMap res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "source")) {
        res.setSource(parseType("source", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "target")) {
        res.setTarget(parseType("target", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
        res.getGroup().add(parseConceptMapConceptMapGroupComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(XmlPullParser xpp, ConceptMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConceptMapConceptMapGroupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConceptMapConceptMapGroupComponentContent(int eventType, XmlPullParser xpp, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSourceElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceVersion")) {
        res.setSourceVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTargetElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetVersion")) {
        res.setTargetVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("element")) {
        res.getElement().add(parseConceptMapSourceElementComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unmapped")) {
        res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(XmlPullParser xpp, ConceptMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConceptMapSourceElementComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConceptMapSourceElementComponentContent(int eventType, XmlPullParser xpp, ConceptMap owner, ConceptMap.SourceElementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.getTarget().add(parseConceptMapTargetElementComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(XmlPullParser xpp, ConceptMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConceptMapTargetElementComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConceptMapTargetElementComponentContent(int eventType, XmlPullParser xpp, ConceptMap owner, ConceptMap.TargetElementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("equivalence")) {
        res.setEquivalenceElement(parseEnumeration(xpp, Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependsOn")) {
        res.getDependsOn().add(parseConceptMapOtherElementComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("product")) {
        res.getProduct().add(parseConceptMapOtherElementComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(XmlPullParser xpp, ConceptMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConceptMapOtherElementComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConceptMapOtherElementComponentContent(int eventType, XmlPullParser xpp, ConceptMap owner, ConceptMap.OtherElementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
        res.setPropertyElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(XmlPullParser xpp, ConceptMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConceptMapConceptMapGroupUnmappedComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConceptMapConceptMapGroupUnmappedComponentContent(int eventType, XmlPullParser xpp, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Condition parseCondition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Condition res = new Condition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConditionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionContent(int eventType, XmlPullParser xpp, Condition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("clinicalStatus")) {
        res.setClinicalStatusElement(parseEnumeration(xpp, Condition.ConditionClinicalStatus.NULL, new Condition.ConditionClinicalStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verificationStatus")) {
        res.setVerificationStatusElement(parseEnumeration(xpp, Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
        res.setSeverity(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.getBodySite().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "onset")) {
        res.setOnset(parseType("onset", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "abatement")) {
        res.setAbatement(parseType("abatement", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assertedDate")) {
        res.setAssertedDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("asserter")) {
        res.setAsserter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stage")) {
        res.setStage(parseConditionConditionStageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("evidence")) {
        res.getEvidence().add(parseConditionConditionEvidenceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(XmlPullParser xpp, Condition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConditionConditionStageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionConditionStageComponentContent(int eventType, XmlPullParser xpp, Condition owner, Condition.ConditionStageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
        res.setSummary(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assessment")) {
        res.getAssessment().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(XmlPullParser xpp, Condition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConditionConditionEvidenceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionConditionEvidenceComponentContent(int eventType, XmlPullParser xpp, Condition owner, Condition.ConditionEvidenceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Consent parseConsent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent res = new Consent();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConsentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentContent(int eventType, XmlPullParser xpp, Consent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateTime")) {
        res.setDateTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("consentingParty")) {
        res.getConsentingParty().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.getActor().add(parseConsentConsentActorComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.getOrganization().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "source")) {
        res.setSource(parseType("source", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("policy")) {
        res.getPolicy().add(parseConsentConsentPolicyComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("policyRule")) {
        res.setPolicyRuleElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
        res.getSecurityLabel().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.getPurpose().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataPeriod")) {
        res.setDataPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
        res.getData().add(parseConsentConsentDataComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("except")) {
        res.getExcept().add(parseConsentExceptComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Consent.ConsentActorComponent parseConsentConsentActorComponent(XmlPullParser xpp, Consent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ConsentActorComponent res = new Consent.ConsentActorComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConsentConsentActorComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentConsentActorComponentContent(int eventType, XmlPullParser xpp, Consent owner, Consent.ConsentActorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(XmlPullParser xpp, Consent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConsentConsentPolicyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentConsentPolicyComponentContent(int eventType, XmlPullParser xpp, Consent owner, Consent.ConsentPolicyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authority")) {
        res.setAuthorityElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
        res.setUriElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Consent.ConsentDataComponent parseConsentConsentDataComponent(XmlPullParser xpp, Consent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ConsentDataComponent res = new Consent.ConsentDataComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConsentConsentDataComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentConsentDataComponentContent(int eventType, XmlPullParser xpp, Consent owner, Consent.ConsentDataComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meaning")) {
        res.setMeaningElement(parseEnumeration(xpp, Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Consent.ExceptComponent parseConsentExceptComponent(XmlPullParser xpp, Consent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ExceptComponent res = new Consent.ExceptComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConsentExceptComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentExceptComponentContent(int eventType, XmlPullParser xpp, Consent owner, Consent.ExceptComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Consent.ConsentExceptType.NULL, new Consent.ConsentExceptTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.getActor().add(parseConsentExceptActorComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
        res.getSecurityLabel().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.getPurpose().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
        res.getClass_().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataPeriod")) {
        res.setDataPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
        res.getData().add(parseConsentExceptDataComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Consent.ExceptActorComponent parseConsentExceptActorComponent(XmlPullParser xpp, Consent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ExceptActorComponent res = new Consent.ExceptActorComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConsentExceptActorComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentExceptActorComponentContent(int eventType, XmlPullParser xpp, Consent owner, Consent.ExceptActorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Consent.ExceptDataComponent parseConsentExceptDataComponent(XmlPullParser xpp, Consent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ExceptDataComponent res = new Consent.ExceptDataComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseConsentExceptDataComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentExceptDataComponentContent(int eventType, XmlPullParser xpp, Consent owner, Consent.ExceptDataComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meaning")) {
        res.setMeaningElement(parseEnumeration(xpp, Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract parseContract(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract res = new Contract();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractContent(int eventType, XmlPullParser xpp, Contract res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issued")) {
        res.setIssuedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("applies")) {
        res.setApplies(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.getSubject().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authority")) {
        res.getAuthority().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("domain")) {
        res.getDomain().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subType")) {
        res.getSubType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actionReason")) {
        res.getActionReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decisionType")) {
        res.setDecisionType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentDerivative")) {
        res.setContentDerivative(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
        res.getSecurityLabel().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.getAgent().add(parseContractAgentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("signer")) {
        res.getSigner().add(parseContractSignatoryComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valuedItem")) {
        res.getValuedItem().add(parseContractValuedItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("term")) {
        res.getTerm().add(parseContractTermComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "binding")) {
        res.setBinding(parseType("binding", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("friendly")) {
        res.getFriendly().add(parseContractFriendlyLanguageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("legal")) {
        res.getLegal().add(parseContractLegalLanguageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.getRule().add(parseContractComputableLanguageComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.AgentComponent parseContractAgentComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.AgentComponent res = new Contract.AgentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractAgentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractAgentComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.AgentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.getRole().add(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.SignatoryComponent parseContractSignatoryComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractSignatoryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractSignatoryComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.SignatoryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
        res.setParty(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("signature")) {
        res.getSignature().add(parseSignature(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.ValuedItemComponent parseContractValuedItemComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractValuedItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractValuedItemComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.ValuedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "entity")) {
        res.setEntity(parseType("entity", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectiveTime")) {
        res.setEffectiveTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("points")) {
        res.setPointsElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.TermComponent parseContractTermComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.TermComponent res = new Contract.TermComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractTermComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractTermComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.TermComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issued")) {
        res.setIssuedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("applies")) {
        res.setApplies(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subType")) {
        res.setSubType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actionReason")) {
        res.getActionReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
        res.getSecurityLabel().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.getAgent().add(parseContractTermAgentComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valuedItem")) {
        res.getValuedItem().add(parseContractTermValuedItemComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
        res.getGroup().add(parseContractTermComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.TermAgentComponent parseContractTermAgentComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.TermAgentComponent res = new Contract.TermAgentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractTermAgentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractTermAgentComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.TermAgentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.getRole().add(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractTermValuedItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractTermValuedItemComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.TermValuedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "entity")) {
        res.setEntity(parseType("entity", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectiveTime")) {
        res.setEffectiveTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("points")) {
        res.setPointsElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractFriendlyLanguageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractFriendlyLanguageComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.FriendlyLanguageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "content")) {
        res.setContent(parseType("content", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractLegalLanguageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractLegalLanguageComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.LegalLanguageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "content")) {
        res.setContent(parseType("content", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(XmlPullParser xpp, Contract owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseContractComputableLanguageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractComputableLanguageComponentContent(int eventType, XmlPullParser xpp, Contract owner, Contract.ComputableLanguageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "content")) {
        res.setContent(parseType("content", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Coverage parseCoverage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Coverage res = new Coverage();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCoverageContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageContent(int eventType, XmlPullParser xpp, Coverage res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("policyHolder")) {
        res.setPolicyHolder(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subscriber")) {
        res.setSubscriber(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subscriberId")) {
        res.setSubscriberIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("beneficiary")) {
        res.setBeneficiary(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.setRelationship(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payor")) {
        res.getPayor().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("grouping")) {
        res.setGrouping(parseCoverageGroupComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependent")) {
        res.setDependentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("order")) {
        res.setOrderElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("network")) {
        res.setNetworkElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contract")) {
        res.getContract().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Coverage.GroupComponent parseCoverageGroupComponent(XmlPullParser xpp, Coverage owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Coverage.GroupComponent res = new Coverage.GroupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseCoverageGroupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageGroupComponentContent(int eventType, XmlPullParser xpp, Coverage owner, Coverage.GroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
        res.setGroupElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupDisplay")) {
        res.setGroupDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subGroup")) {
        res.setSubGroupElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subGroupDisplay")) {
        res.setSubGroupDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("plan")) {
        res.setPlanElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("planDisplay")) {
        res.setPlanDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subPlan")) {
        res.setSubPlanElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subPlanDisplay")) {
        res.setSubPlanDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
        res.setClass_Element(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classDisplay")) {
        res.setClassDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subClass")) {
        res.setSubClassElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subClassDisplay")) {
        res.setSubClassDisplayElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DataElement parseDataElement(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DataElement res = new DataElement();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDataElementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataElementContent(int eventType, XmlPullParser xpp, DataElement res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stringency")) {
        res.setStringencyElement(parseEnumeration(xpp, DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mapping")) {
        res.getMapping().add(parseDataElementDataElementMappingComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("element")) {
        res.getElement().add(parseElementDefinition(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(XmlPullParser xpp, DataElement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDataElementDataElementMappingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataElementDataElementMappingComponentContent(int eventType, XmlPullParser xpp, DataElement owner, DataElement.DataElementMappingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identity")) {
        res.setIdentityElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
        res.setUriElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DetectedIssue parseDetectedIssue(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DetectedIssue res = new DetectedIssue();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDetectedIssueContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDetectedIssueContent(int eventType, XmlPullParser xpp, DetectedIssue res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
        res.setSeverityElement(parseEnumeration(xpp, DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implicated")) {
        res.getImplicated().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.setDetailElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReferenceElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mitigation")) {
        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(XmlPullParser xpp, DetectedIssue owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDetectedIssueDetectedIssueMitigationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDetectedIssueDetectedIssueMitigationComponentContent(int eventType, XmlPullParser xpp, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.setAction(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Device parseDevice(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Device res = new Device();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceContent(int eventType, XmlPullParser xpp, Device res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
        res.setUdi(parseDeviceDeviceUdiComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lotNumber")) {
        res.setLotNumberElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
        res.setManufacturerElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufactureDate")) {
        res.setManufactureDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expirationDate")) {
        res.setExpirationDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("model")) {
        res.setModelElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("owner")) {
        res.setOwner(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("safety")) {
        res.getSafety().add(parseCodeableConcept(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Device.DeviceUdiComponent parseDeviceDeviceUdiComponent(XmlPullParser xpp, Device owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Device.DeviceUdiComponent res = new Device.DeviceUdiComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceDeviceUdiComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDeviceUdiComponentContent(int eventType, XmlPullParser xpp, Device owner, Device.DeviceUdiComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("deviceIdentifier")) {
        res.setDeviceIdentifierElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.setJurisdictionElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("carrierHRF")) {
        res.setCarrierHRFElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("carrierAIDC")) {
        res.setCarrierAIDCElement(parseBase64Binary(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issuer")) {
        res.setIssuerElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entryType")) {
        res.setEntryTypeElement(parseEnumeration(xpp, Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DeviceComponent parseDeviceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceComponent res = new DeviceComponent();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceComponentContent(int eventType, XmlPullParser xpp, DeviceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastSystemChange")) {
        res.setLastSystemChangeElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
        res.setParent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operationalStatus")) {
        res.getOperationalStatus().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameterGroup")) {
        res.setParameterGroup(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measurementPrinciple")) {
        res.setMeasurementPrincipleElement(parseEnumeration(xpp, DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productionSpecification")) {
        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("languageCode")) {
        res.setLanguageCode(parseCodeableConcept(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(XmlPullParser xpp, DeviceComponent owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceComponentDeviceComponentProductionSpecificationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceComponentDeviceComponentProductionSpecificationComponentContent(int eventType, XmlPullParser xpp, DeviceComponent owner, DeviceComponent.DeviceComponentProductionSpecificationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specType")) {
        res.setSpecType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("componentId")) {
        res.setComponentId(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productionSpec")) {
        res.setProductionSpecElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DeviceMetric parseDeviceMetric(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceMetric res = new DeviceMetric();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceMetricContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceMetricContent(int eventType, XmlPullParser xpp, DeviceMetric res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unit")) {
        res.setUnit(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
        res.setParent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operationalStatus")) {
        res.setOperationalStatusElement(parseEnumeration(xpp, DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("color")) {
        res.setColorElement(parseEnumeration(xpp, DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategoryElement(parseEnumeration(xpp, DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measurementPeriod")) {
        res.setMeasurementPeriod(parseTiming(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("calibration")) {
        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(XmlPullParser xpp, DeviceMetric owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceMetricDeviceMetricCalibrationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceMetricDeviceMetricCalibrationComponentContent(int eventType, XmlPullParser xpp, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("state")) {
        res.setStateElement(parseEnumeration(xpp, DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
        res.setTimeElement(parseInstant(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DeviceRequest parseDeviceRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceRequest res = new DeviceRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceRequestContent(int eventType, XmlPullParser xpp, DeviceRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priorRequest")) {
        res.getPriorRequest().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupIdentifier")) {
        res.setGroupIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
        res.setIntent(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "code")) {
        res.setCode(parseType("code", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
        res.setRequester(parseDeviceRequestDeviceRequestRequesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performerType")) {
        res.setPerformerType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.setPerformer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
        res.getSupportingInfo().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relevantHistory")) {
        res.getRelevantHistory().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DeviceRequest.DeviceRequestRequesterComponent parseDeviceRequestDeviceRequestRequesterComponent(XmlPullParser xpp, DeviceRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceRequest.DeviceRequestRequesterComponent res = new DeviceRequest.DeviceRequestRequesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceRequestDeviceRequestRequesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceRequestDeviceRequestRequesterComponentContent(int eventType, XmlPullParser xpp, DeviceRequest owner, DeviceRequest.DeviceRequestRequesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.setAgent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DeviceUseStatement parseDeviceUseStatement(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceUseStatement res = new DeviceUseStatement();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDeviceUseStatementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceUseStatementContent(int eventType, XmlPullParser xpp, DeviceUseStatement res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("whenUsed")) {
        res.setWhenUsed(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
        res.setTiming(parseType("timing", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recordedOn")) {
        res.setRecordedOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
        res.setDevice(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indication")) {
        res.getIndication().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.setBodySite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DiagnosticReport parseDiagnosticReport(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DiagnosticReport res = new DiagnosticReport();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDiagnosticReportContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDiagnosticReportContent(int eventType, XmlPullParser xpp, DiagnosticReport res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "effective")) {
        res.setEffective(parseType("effective", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issued")) {
        res.setIssuedElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.getPerformer().add(parseDiagnosticReportDiagnosticReportPerformerComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specimen")) {
        res.getSpecimen().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("result")) {
        res.getResult().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("imagingStudy")) {
        res.getImagingStudy().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("image")) {
        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conclusion")) {
        res.setConclusionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("codedDiagnosis")) {
        res.getCodedDiagnosis().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("presentedForm")) {
        res.getPresentedForm().add(parseAttachment(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DiagnosticReport.DiagnosticReportPerformerComponent parseDiagnosticReportDiagnosticReportPerformerComponent(XmlPullParser xpp, DiagnosticReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DiagnosticReport.DiagnosticReportPerformerComponent res = new DiagnosticReport.DiagnosticReportPerformerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDiagnosticReportDiagnosticReportPerformerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDiagnosticReportDiagnosticReportPerformerComponentContent(int eventType, XmlPullParser xpp, DiagnosticReport owner, DiagnosticReport.DiagnosticReportPerformerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(XmlPullParser xpp, DiagnosticReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDiagnosticReportDiagnosticReportImageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDiagnosticReportDiagnosticReportImageComponentContent(int eventType, XmlPullParser xpp, DiagnosticReport owner, DiagnosticReport.DiagnosticReportImageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.setLink(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentManifest parseDocumentManifest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentManifest res = new DocumentManifest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentManifestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentManifestContent(int eventType, XmlPullParser xpp, DocumentManifest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("masterIdentifier")) {
        res.setMasterIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.getAuthor().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
        res.getRecipient().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSourceElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("related")) {
        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(XmlPullParser xpp, DocumentManifest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentManifestDocumentManifestContentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentManifestDocumentManifestContentComponentContent(int eventType, XmlPullParser xpp, DocumentManifest owner, DocumentManifest.DocumentManifestContentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "p")) {
        res.setP(parseType("p", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(XmlPullParser xpp, DocumentManifest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentManifestDocumentManifestRelatedComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentManifestDocumentManifestRelatedComponentContent(int eventType, XmlPullParser xpp, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ref")) {
        res.setRef(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentReference parseDocumentReference(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentReference res = new DocumentReference();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentReferenceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentReferenceContent(int eventType, XmlPullParser xpp, DocumentReference res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("masterIdentifier")) {
        res.setMasterIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("docStatus")) {
        res.setDocStatusElement(parseEnumeration(xpp, DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
        res.setClass_(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indexed")) {
        res.setIndexedElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.getAuthor().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authenticator")) {
        res.setAuthenticator(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian")) {
        res.setCustodian(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatesTo")) {
        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
        res.getSecurityLabel().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(XmlPullParser xpp, DocumentReference owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentReferenceDocumentReferenceRelatesToComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentReferenceDocumentReferenceRelatesToComponentContent(int eventType, XmlPullParser xpp, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTarget(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(XmlPullParser xpp, DocumentReference owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentReferenceDocumentReferenceContentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentReferenceDocumentReferenceContentComponentContent(int eventType, XmlPullParser xpp, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attachment")) {
        res.setAttachment(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("format")) {
        res.setFormat(parseCoding(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(XmlPullParser xpp, DocumentReference owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentReferenceDocumentReferenceContextComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentReferenceDocumentReferenceContextComponentContent(int eventType, XmlPullParser xpp, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.setEncounter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
        res.getEvent().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("facilityType")) {
        res.setFacilityType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("practiceSetting")) {
        res.setPracticeSetting(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourcePatientInfo")) {
        res.setSourcePatientInfo(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("related")) {
        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(XmlPullParser xpp, DocumentReference owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseDocumentReferenceDocumentReferenceContextRelatedComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentReferenceDocumentReferenceContextRelatedComponentContent(int eventType, XmlPullParser xpp, DocumentReference owner, DocumentReference.DocumentReferenceContextRelatedComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ref")) {
        res.setRef(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EligibilityRequest parseEligibilityRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EligibilityRequest res = new EligibilityRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEligibilityRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEligibilityRequestContent(int eventType, XmlPullParser xpp, EligibilityRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, EligibilityRequest.EligibilityRequestStatus.NULL, new EligibilityRequest.EligibilityRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriority(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "serviced")) {
        res.setServiced(parseType("serviced", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enterer")) {
        res.setEnterer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
        res.setInsurer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("facility")) {
        res.setFacility(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.setCoverage(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("businessArrangement")) {
        res.setBusinessArrangementElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("benefitCategory")) {
        res.setBenefitCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("benefitSubCategory")) {
        res.setBenefitSubCategory(parseCodeableConcept(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EligibilityResponse parseEligibilityResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EligibilityResponse res = new EligibilityResponse();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEligibilityResponseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEligibilityResponseContent(int eventType, XmlPullParser xpp, EligibilityResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, EligibilityResponse.EligibilityResponseStatus.NULL, new EligibilityResponse.EligibilityResponseStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestProvider")) {
        res.setRequestProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestOrganization")) {
        res.setRequestOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
        res.setDispositionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
        res.setInsurer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inforce")) {
        res.setInforceElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
        res.getInsurance().add(parseEligibilityResponseInsuranceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
        res.setForm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
        res.getError().add(parseEligibilityResponseErrorsComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EligibilityResponse.InsuranceComponent parseEligibilityResponseInsuranceComponent(XmlPullParser xpp, EligibilityResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EligibilityResponse.InsuranceComponent res = new EligibilityResponse.InsuranceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEligibilityResponseInsuranceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEligibilityResponseInsuranceComponentContent(int eventType, XmlPullParser xpp, EligibilityResponse owner, EligibilityResponse.InsuranceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.setCoverage(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contract")) {
        res.setContract(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("benefitBalance")) {
        res.getBenefitBalance().add(parseEligibilityResponseBenefitsComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EligibilityResponse.BenefitsComponent parseEligibilityResponseBenefitsComponent(XmlPullParser xpp, EligibilityResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EligibilityResponse.BenefitsComponent res = new EligibilityResponse.BenefitsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEligibilityResponseBenefitsComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEligibilityResponseBenefitsComponentContent(int eventType, XmlPullParser xpp, EligibilityResponse owner, EligibilityResponse.BenefitsComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subCategory")) {
        res.setSubCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excluded")) {
        res.setExcludedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("network")) {
        res.setNetwork(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unit")) {
        res.setUnit(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("term")) {
        res.setTerm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("financial")) {
        res.getFinancial().add(parseEligibilityResponseBenefitComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EligibilityResponse.BenefitComponent parseEligibilityResponseBenefitComponent(XmlPullParser xpp, EligibilityResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EligibilityResponse.BenefitComponent res = new EligibilityResponse.BenefitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEligibilityResponseBenefitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEligibilityResponseBenefitComponentContent(int eventType, XmlPullParser xpp, EligibilityResponse owner, EligibilityResponse.BenefitComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "allowed")) {
        res.setAllowed(parseType("allowed", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "used")) {
        res.setUsed(parseType("used", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EligibilityResponse.ErrorsComponent parseEligibilityResponseErrorsComponent(XmlPullParser xpp, EligibilityResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EligibilityResponse.ErrorsComponent res = new EligibilityResponse.ErrorsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEligibilityResponseErrorsComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEligibilityResponseErrorsComponentContent(int eventType, XmlPullParser xpp, EligibilityResponse owner, EligibilityResponse.ErrorsComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Encounter parseEncounter(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter res = new Encounter();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEncounterContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterContent(int eventType, XmlPullParser xpp, Encounter res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusHistory")) {
        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
        res.setClass_(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classHistory")) {
        res.getClassHistory().add(parseEncounterClassHistoryComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriority(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("episodeOfCare")) {
        res.getEpisodeOfCare().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("incomingReferral")) {
        res.getIncomingReferral().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parseEncounterEncounterParticipantComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appointment")) {
        res.setAppointment(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("length")) {
        res.setLength(parseDuration(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.getReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
        res.getDiagnosis().add(parseEncounterDiagnosisComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("account")) {
        res.getAccount().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hospitalization")) {
        res.setHospitalization(parseEncounterEncounterHospitalizationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.getLocation().add(parseEncounterEncounterLocationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceProvider")) {
        res.setServiceProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.setPartOf(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(XmlPullParser xpp, Encounter owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEncounterStatusHistoryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterStatusHistoryComponentContent(int eventType, XmlPullParser xpp, Encounter owner, Encounter.StatusHistoryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(XmlPullParser xpp, Encounter owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEncounterClassHistoryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterClassHistoryComponentContent(int eventType, XmlPullParser xpp, Encounter owner, Encounter.ClassHistoryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
        res.setClass_(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(XmlPullParser xpp, Encounter owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEncounterEncounterParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterEncounterParticipantComponentContent(int eventType, XmlPullParser xpp, Encounter owner, Encounter.EncounterParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("individual")) {
        res.setIndividual(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(XmlPullParser xpp, Encounter owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEncounterDiagnosisComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterDiagnosisComponentContent(int eventType, XmlPullParser xpp, Encounter owner, Encounter.DiagnosisComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.setCondition(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rank")) {
        res.setRankElement(parsePositiveInt(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(XmlPullParser xpp, Encounter owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEncounterEncounterHospitalizationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterEncounterHospitalizationComponentContent(int eventType, XmlPullParser xpp, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAdmissionIdentifier")) {
        res.setPreAdmissionIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("origin")) {
        res.setOrigin(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("admitSource")) {
        res.setAdmitSource(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reAdmission")) {
        res.setReAdmission(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dietPreference")) {
        res.getDietPreference().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialCourtesy")) {
        res.getSpecialCourtesy().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialArrangement")) {
        res.getSpecialArrangement().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
        res.setDestination(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dischargeDisposition")) {
        res.setDischargeDisposition(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(XmlPullParser xpp, Encounter owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEncounterEncounterLocationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterEncounterLocationComponentContent(int eventType, XmlPullParser xpp, Encounter owner, Encounter.EncounterLocationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Endpoint parseEndpoint(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Endpoint res = new Endpoint();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEndpointContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEndpointContent(int eventType, XmlPullParser xpp, Endpoint res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("connectionType")) {
        res.setConnectionType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("managingOrganization")) {
        res.setManagingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payloadType")) {
        res.getPayloadType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payloadMimeType")) {
        res.getPayloadMimeType().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.setAddressElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("header")) {
        res.getHeader().add(parseString(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EnrollmentRequest parseEnrollmentRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EnrollmentRequest res = new EnrollmentRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEnrollmentRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEnrollmentRequestContent(int eventType, XmlPullParser xpp, EnrollmentRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
        res.setInsurer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.setCoverage(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EnrollmentResponse parseEnrollmentResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EnrollmentResponse res = new EnrollmentResponse();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEnrollmentResponseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEnrollmentResponseContent(int eventType, XmlPullParser xpp, EnrollmentResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
        res.setDispositionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestProvider")) {
        res.setRequestProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestOrganization")) {
        res.setRequestOrganization(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EpisodeOfCare parseEpisodeOfCare(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EpisodeOfCare res = new EpisodeOfCare();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEpisodeOfCareContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEpisodeOfCareContent(int eventType, XmlPullParser xpp, EpisodeOfCare res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusHistory")) {
        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("managingOrganization")) {
        res.setManagingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referralRequest")) {
        res.getReferralRequest().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careManager")) {
        res.setCareManager(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("team")) {
        res.getTeam().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("account")) {
        res.getAccount().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(XmlPullParser xpp, EpisodeOfCare owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentContent(int eventType, XmlPullParser xpp, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(XmlPullParser xpp, EpisodeOfCare owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseEpisodeOfCareDiagnosisComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEpisodeOfCareDiagnosisComponentContent(int eventType, XmlPullParser xpp, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.setCondition(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rank")) {
        res.setRankElement(parsePositiveInt(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile parseExpansionProfile(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile res = new ExpansionProfile();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileContent(int eventType, XmlPullParser xpp, ExpansionProfile res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fixedVersion")) {
        res.getFixedVersion().add(parseExpansionProfileExpansionProfileFixedVersionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludedSystem")) {
        res.setExcludedSystem(parseExpansionProfileExpansionProfileExcludedSystemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("includeDesignations")) {
        res.setIncludeDesignationsElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("designation")) {
        res.setDesignation(parseExpansionProfileExpansionProfileDesignationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("includeDefinition")) {
        res.setIncludeDefinitionElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activeOnly")) {
        res.setActiveOnlyElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludeNested")) {
        res.setExcludeNestedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludeNotForUI")) {
        res.setExcludeNotForUIElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludePostCoordinated")) {
        res.setExcludePostCoordinatedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("displayLanguage")) {
        res.setDisplayLanguageElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("limitedExpansion")) {
        res.setLimitedExpansionElement(parseBoolean(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile.ExpansionProfileFixedVersionComponent parseExpansionProfileExpansionProfileFixedVersionComponent(XmlPullParser xpp, ExpansionProfile owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile.ExpansionProfileFixedVersionComponent res = new ExpansionProfile.ExpansionProfileFixedVersionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileExpansionProfileFixedVersionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileExpansionProfileFixedVersionComponentContent(int eventType, XmlPullParser xpp, ExpansionProfile owner, ExpansionProfile.ExpansionProfileFixedVersionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, ExpansionProfile.SystemVersionProcessingMode.NULL, new ExpansionProfile.SystemVersionProcessingModeEnumFactory()));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile.ExpansionProfileExcludedSystemComponent parseExpansionProfileExpansionProfileExcludedSystemComponent(XmlPullParser xpp, ExpansionProfile owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile.ExpansionProfileExcludedSystemComponent res = new ExpansionProfile.ExpansionProfileExcludedSystemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileExpansionProfileExcludedSystemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileExpansionProfileExcludedSystemComponentContent(int eventType, XmlPullParser xpp, ExpansionProfile owner, ExpansionProfile.ExpansionProfileExcludedSystemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile.ExpansionProfileDesignationComponent parseExpansionProfileExpansionProfileDesignationComponent(XmlPullParser xpp, ExpansionProfile owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile.ExpansionProfileDesignationComponent res = new ExpansionProfile.ExpansionProfileDesignationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileExpansionProfileDesignationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileExpansionProfileDesignationComponentContent(int eventType, XmlPullParser xpp, ExpansionProfile owner, ExpansionProfile.ExpansionProfileDesignationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("include")) {
        res.setInclude(parseExpansionProfileDesignationIncludeComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
        res.setExclude(parseExpansionProfileDesignationExcludeComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile.DesignationIncludeComponent parseExpansionProfileDesignationIncludeComponent(XmlPullParser xpp, ExpansionProfile owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile.DesignationIncludeComponent res = new ExpansionProfile.DesignationIncludeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileDesignationIncludeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileDesignationIncludeComponentContent(int eventType, XmlPullParser xpp, ExpansionProfile owner, ExpansionProfile.DesignationIncludeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("designation")) {
        res.getDesignation().add(parseExpansionProfileDesignationIncludeDesignationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile.DesignationIncludeDesignationComponent parseExpansionProfileDesignationIncludeDesignationComponent(XmlPullParser xpp, ExpansionProfile owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile.DesignationIncludeDesignationComponent res = new ExpansionProfile.DesignationIncludeDesignationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileDesignationIncludeDesignationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileDesignationIncludeDesignationComponentContent(int eventType, XmlPullParser xpp, ExpansionProfile owner, ExpansionProfile.DesignationIncludeDesignationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUse(parseCoding(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile.DesignationExcludeComponent parseExpansionProfileDesignationExcludeComponent(XmlPullParser xpp, ExpansionProfile owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile.DesignationExcludeComponent res = new ExpansionProfile.DesignationExcludeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileDesignationExcludeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileDesignationExcludeComponentContent(int eventType, XmlPullParser xpp, ExpansionProfile owner, ExpansionProfile.DesignationExcludeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("designation")) {
        res.getDesignation().add(parseExpansionProfileDesignationExcludeDesignationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExpansionProfile.DesignationExcludeDesignationComponent parseExpansionProfileDesignationExcludeDesignationComponent(XmlPullParser xpp, ExpansionProfile owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExpansionProfile.DesignationExcludeDesignationComponent res = new ExpansionProfile.DesignationExcludeDesignationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExpansionProfileDesignationExcludeDesignationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpansionProfileDesignationExcludeDesignationComponentContent(int eventType, XmlPullParser xpp, ExpansionProfile owner, ExpansionProfile.DesignationExcludeDesignationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUse(parseCoding(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit parseExplanationOfBenefit(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit res = new ExplanationOfBenefit();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subType")) {
        res.getSubType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("billablePeriod")) {
        res.setBillablePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enterer")) {
        res.setEnterer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
        res.setInsurer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referral")) {
        res.setReferral(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("facility")) {
        res.setFacility(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claim")) {
        res.setClaim(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claimResponse")) {
        res.setClaimResponse(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
        res.setDispositionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("related")) {
        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prescription")) {
        res.setPrescription(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("originalPrescription")) {
        res.setOriginalPrescription(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payee")) {
        res.setPayee(parseExplanationOfBenefitPayeeComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("information")) {
        res.getInformation().add(parseExplanationOfBenefitSupportingInformationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeam")) {
        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precedence")) {
        res.setPrecedenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
        res.setInsurance(parseExplanationOfBenefitInsuranceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accident")) {
        res.setAccident(parseExplanationOfBenefitAccidentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("employmentImpacted")) {
        res.setEmploymentImpacted(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hospitalization")) {
        res.setHospitalization(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseExplanationOfBenefitItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addItem")) {
        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalCost")) {
        res.setTotalCost(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unallocDeductable")) {
        res.setUnallocDeductable(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalBenefit")) {
        res.setTotalBenefit(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
        res.setPayment(parseExplanationOfBenefitPaymentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
        res.setForm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processNote")) {
        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("benefitBalance")) {
        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitRelatedClaimComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitRelatedClaimComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claim")) {
        res.setClaim(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.setRelationship(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReference(parseIdentifier(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitPayeeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitPayeeComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceType")) {
        res.setResourceType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
        res.setParty(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitSupportingInformationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitSupportingInformationComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
        res.setTiming(parseType("timing", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCoding(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitCareTeamComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitCareTeamComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responsible")) {
        res.setResponsibleElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualification")) {
        res.setQualification(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitDiagnosisComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitDiagnosisComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "diagnosis")) {
        res.setDiagnosis(parseType("diagnosis", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageCode")) {
        res.setPackageCode(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitProcedureComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitProcedureComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "procedure")) {
        res.setProcedure(parseType("procedure", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitInsuranceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitInsuranceComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
        res.setCoverage(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthRef")) {
        res.getPreAuthRef().add(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitAccidentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitAccidentComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "location")) {
        res.setLocation(parseType("location", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitItemComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeamLinkId")) {
        res.getCareTeamLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosisLinkId")) {
        res.getDiagnosisLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedureLinkId")) {
        res.getProcedureLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationLinkId")) {
        res.getInformationLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
        res.getProgramCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "serviced")) {
        res.setServiced(parseType("serviced", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "location")) {
        res.setLocation(parseType("location", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
        res.getUdi().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.setBodySite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subSite")) {
        res.getSubSite().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.getEncounter().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseExplanationOfBenefitDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitAdjudicationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitAdjudicationComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseDecimal(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitDetailComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
        res.getProgramCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
        res.getUdi().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitSubDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitSubDetailComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
        res.setSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
        res.getProgramCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
        res.setUnitPrice(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
        res.setFactorElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
        res.setNet(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
        res.getUdi().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitAddedItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitAddedItemComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceLinkId")) {
        res.getSequenceLinkId().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fee")) {
        res.setFee(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parseExplanationOfBenefitAddedItemsDetailComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.AddedItemsDetailComponent parseExplanationOfBenefitAddedItemsDetailComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.AddedItemsDetailComponent res = new ExplanationOfBenefit.AddedItemsDetailComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitAddedItemsDetailComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitAddedItemsDetailComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemsDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
        res.setRevenue(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
        res.setService(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fee")) {
        res.setFee(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
        res.getNoteNumber().add(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitPaymentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitPaymentComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjustment")) {
        res.setAdjustment(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjustmentReason")) {
        res.setAdjustmentReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitNoteComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitNoteComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
        res.setNumberElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguage(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitBenefitBalanceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitBenefitBalanceComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subCategory")) {
        res.setSubCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excluded")) {
        res.setExcludedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("network")) {
        res.setNetwork(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unit")) {
        res.setUnit(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("term")) {
        res.setTerm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("financial")) {
        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(XmlPullParser xpp, ExplanationOfBenefit owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseExplanationOfBenefitBenefitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitBenefitComponentContent(int eventType, XmlPullParser xpp, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "allowed")) {
        res.setAllowed(parseType("allowed", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "used")) {
        res.setUsed(parseType("used", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected FamilyMemberHistory parseFamilyMemberHistory(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    FamilyMemberHistory res = new FamilyMemberHistory();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseFamilyMemberHistoryContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseFamilyMemberHistoryContent(int eventType, XmlPullParser xpp, FamilyMemberHistory res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notDone")) {
        res.setNotDoneElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notDoneReason")) {
        res.setNotDoneReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.setRelationship(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
        res.setGenderElement(parseEnumeration(xpp, Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "born")) {
        res.setBorn(parseType("born", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "age")) {
        res.setAge(parseType("age", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("estimatedAge")) {
        res.setEstimatedAgeElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "deceased")) {
        res.setDeceased(parseType("deceased", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(XmlPullParser xpp, FamilyMemberHistory owner) throws XmlPullParserException, IOException, FHIRFormatError {
    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentContent(int eventType, XmlPullParser xpp, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "onset")) {
        res.setOnset(parseType("onset", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Flag parseFlag(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Flag res = new Flag();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseFlagContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseFlagContent(int eventType, XmlPullParser xpp, Flag res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.setEncounter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Goal parseGoal(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Goal res = new Goal();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGoalContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGoalContent(int eventType, XmlPullParser xpp, Goal res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriority(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescription(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "start")) {
        res.setStart(parseType("start", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTarget(parseGoalGoalTargetComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusDate")) {
        res.setStatusDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
        res.setStatusReasonElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expressedBy")) {
        res.setExpressedBy(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addresses")) {
        res.getAddresses().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcomeCode")) {
        res.getOutcomeCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcomeReference")) {
        res.getOutcomeReference().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(XmlPullParser xpp, Goal owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGoalGoalTargetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGoalGoalTargetComponentContent(int eventType, XmlPullParser xpp, Goal owner, Goal.GoalTargetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measure")) {
        res.setMeasure(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "detail")) {
        res.setDetail(parseType("detail", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "due")) {
        res.setDue(parseType("due", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected GraphDefinition parseGraphDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    GraphDefinition res = new GraphDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGraphDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGraphDefinitionContent(int eventType, XmlPullParser xpp, GraphDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStartElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfileElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(XmlPullParser xpp, GraphDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGraphDefinitionGraphDefinitionLinkComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGraphDefinitionGraphDefinitionLinkComponentContent(int eventType, XmlPullParser xpp, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sliceName")) {
        res.setSliceNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
        res.setMinElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
        res.setMaxElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(XmlPullParser xpp, GraphDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGraphDefinitionGraphDefinitionLinkTargetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGraphDefinitionGraphDefinitionLinkTargetComponentContent(int eventType, XmlPullParser xpp, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfileElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compartment")) {
        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(XmlPullParser xpp, GraphDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentContent(int eventType, XmlPullParser xpp, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.setRuleElement(parseEnumeration(xpp, GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Group parseGroup(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Group res = new Group();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGroupContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGroupContent(int eventType, XmlPullParser xpp, Group res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actual")) {
        res.setActualElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantityElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("characteristic")) {
        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("member")) {
        res.getMember().add(parseGroupGroupMemberComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(XmlPullParser xpp, Group owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGroupGroupCharacteristicComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGroupGroupCharacteristicComponentContent(int eventType, XmlPullParser xpp, Group owner, Group.GroupCharacteristicComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
        res.setExcludeElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(XmlPullParser xpp, Group owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGroupGroupMemberComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGroupGroupMemberComponentContent(int eventType, XmlPullParser xpp, Group owner, Group.GroupMemberComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entity")) {
        res.setEntity(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inactive")) {
        res.setInactiveElement(parseBoolean(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected GuidanceResponse parseGuidanceResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    GuidanceResponse res = new GuidanceResponse();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseGuidanceResponseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGuidanceResponseContent(int eventType, XmlPullParser xpp, GuidanceResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestId")) {
        res.setRequestIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("module")) {
        res.setModule(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("occurrenceDateTime")) {
        res.setOccurrenceDateTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.setPerformer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reason")) {
        res.setReason(parseType("reason", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("evaluationMessage")) {
        res.getEvaluationMessage().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outputParameters")) {
        res.setOutputParameters(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("result")) {
        res.setResult(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataRequirement")) {
        res.getDataRequirement().add(parseDataRequirement(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected HealthcareService parseHealthcareService(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    HealthcareService res = new HealthcareService();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseHealthcareServiceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHealthcareServiceContent(int eventType, XmlPullParser xpp, HealthcareService res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("providedBy")) {
        res.setProvidedBy(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
        res.getSpecialty().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.getLocation().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extraDetails")) {
        res.setExtraDetailsElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("photo")) {
        res.setPhoto(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverageArea")) {
        res.getCoverageArea().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceProvisionCode")) {
        res.getServiceProvisionCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eligibility")) {
        res.setEligibility(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eligibilityNote")) {
        res.setEligibilityNoteElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programName")) {
        res.getProgramName().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("characteristic")) {
        res.getCharacteristic().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referralMethod")) {
        res.getReferralMethod().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appointmentRequired")) {
        res.setAppointmentRequiredElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableTime")) {
        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notAvailable")) {
        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availabilityExceptions")) {
        res.setAvailabilityExceptionsElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(XmlPullParser xpp, HealthcareService owner) throws XmlPullParserException, IOException, FHIRFormatError {
    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseHealthcareServiceHealthcareServiceAvailableTimeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHealthcareServiceHealthcareServiceAvailableTimeComponentContent(int eventType, XmlPullParser xpp, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysOfWeek")) {
        res.getDaysOfWeek().add(parseEnumeration(xpp, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allDay")) {
        res.setAllDayElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableStartTime")) {
        res.setAvailableStartTimeElement(parseTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableEndTime")) {
        res.setAvailableEndTimeElement(parseTime(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(XmlPullParser xpp, HealthcareService owner) throws XmlPullParserException, IOException, FHIRFormatError {
    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseHealthcareServiceHealthcareServiceNotAvailableComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHealthcareServiceHealthcareServiceNotAvailableComponentContent(int eventType, XmlPullParser xpp, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("during")) {
        res.setDuring(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImagingManifest parseImagingManifest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingManifest res = new ImagingManifest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImagingManifestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingManifestContent(int eventType, XmlPullParser xpp, ImagingManifest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoringTime")) {
        res.setAuthoringTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("study")) {
        res.getStudy().add(parseImagingManifestStudyComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImagingManifest.StudyComponent parseImagingManifestStudyComponent(XmlPullParser xpp, ImagingManifest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingManifest.StudyComponent res = new ImagingManifest.StudyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImagingManifestStudyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingManifestStudyComponentContent(int eventType, XmlPullParser xpp, ImagingManifest owner, ImagingManifest.StudyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
        res.setUidElement(parseOid(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("imagingStudy")) {
        res.setImagingStudy(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("series")) {
        res.getSeries().add(parseImagingManifestSeriesComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImagingManifest.SeriesComponent parseImagingManifestSeriesComponent(XmlPullParser xpp, ImagingManifest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingManifest.SeriesComponent res = new ImagingManifest.SeriesComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImagingManifestSeriesComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingManifestSeriesComponentContent(int eventType, XmlPullParser xpp, ImagingManifest owner, ImagingManifest.SeriesComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
        res.setUidElement(parseOid(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
        res.getInstance().add(parseImagingManifestInstanceComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImagingManifest.InstanceComponent parseImagingManifestInstanceComponent(XmlPullParser xpp, ImagingManifest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingManifest.InstanceComponent res = new ImagingManifest.InstanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImagingManifestInstanceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingManifestInstanceComponentContent(int eventType, XmlPullParser xpp, ImagingManifest owner, ImagingManifest.InstanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sopClass")) {
        res.setSopClassElement(parseOid(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
        res.setUidElement(parseOid(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImagingStudy parseImagingStudy(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingStudy res = new ImagingStudy();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImagingStudyContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingStudyContent(int eventType, XmlPullParser xpp, ImagingStudy res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
        res.setUidElement(parseOid(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accession")) {
        res.setAccession(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availability")) {
        res.setAvailabilityElement(parseEnumeration(xpp, ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modalityList")) {
        res.getModalityList().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("started")) {
        res.setStartedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referrer")) {
        res.setReferrer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interpreter")) {
        res.getInterpreter().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfSeries")) {
        res.setNumberOfSeriesElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfInstances")) {
        res.setNumberOfInstancesElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedureReference")) {
        res.getProcedureReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedureCode")) {
        res.getProcedureCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("series")) {
        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(XmlPullParser xpp, ImagingStudy owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImagingStudyImagingStudySeriesComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingStudyImagingStudySeriesComponentContent(int eventType, XmlPullParser xpp, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
        res.setUidElement(parseOid(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
        res.setNumberElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modality")) {
        res.setModality(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfInstances")) {
        res.setNumberOfInstancesElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availability")) {
        res.setAvailabilityElement(parseEnumeration(xpp, ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.setBodySite(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("laterality")) {
        res.setLaterality(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("started")) {
        res.setStartedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.getPerformer().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(XmlPullParser xpp, ImagingStudy owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImagingStudyImagingStudySeriesInstanceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingStudyImagingStudySeriesInstanceComponentContent(int eventType, XmlPullParser xpp, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
        res.setUidElement(parseOid(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
        res.setNumberElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sopClass")) {
        res.setSopClassElement(parseOid(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Immunization parseImmunization(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization res = new Immunization();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationContent(int eventType, XmlPullParser xpp, Immunization res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notGiven")) {
        res.setNotGivenElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("vaccineCode")) {
        res.setVaccineCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.setEncounter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("primarySource")) {
        res.setPrimarySourceElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reportOrigin")) {
        res.setReportOrigin(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
        res.setManufacturer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lotNumber")) {
        res.setLotNumberElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expirationDate")) {
        res.setExpirationDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
        res.setSite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("route")) {
        res.setRoute(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseQuantity")) {
        res.setDoseQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("practitioner")) {
        res.getPractitioner().add(parseImmunizationImmunizationPractitionerComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("explanation")) {
        res.setExplanation(parseImmunizationImmunizationExplanationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reaction")) {
        res.getReaction().add(parseImmunizationImmunizationReactionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("vaccinationProtocol")) {
        res.getVaccinationProtocol().add(parseImmunizationImmunizationVaccinationProtocolComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Immunization.ImmunizationPractitionerComponent parseImmunizationImmunizationPractitionerComponent(XmlPullParser xpp, Immunization owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization.ImmunizationPractitionerComponent res = new Immunization.ImmunizationPractitionerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationImmunizationPractitionerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationImmunizationPractitionerComponentContent(int eventType, XmlPullParser xpp, Immunization owner, Immunization.ImmunizationPractitionerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Immunization.ImmunizationExplanationComponent parseImmunizationImmunizationExplanationComponent(XmlPullParser xpp, Immunization owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization.ImmunizationExplanationComponent res = new Immunization.ImmunizationExplanationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationImmunizationExplanationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationImmunizationExplanationComponentContent(int eventType, XmlPullParser xpp, Immunization owner, Immunization.ImmunizationExplanationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.getReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonNotGiven")) {
        res.getReasonNotGiven().add(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(XmlPullParser xpp, Immunization owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationImmunizationReactionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationImmunizationReactionComponentContent(int eventType, XmlPullParser xpp, Immunization owner, Immunization.ImmunizationReactionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.setDetail(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reported")) {
        res.setReportedElement(parseBoolean(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Immunization.ImmunizationVaccinationProtocolComponent parseImmunizationImmunizationVaccinationProtocolComponent(XmlPullParser xpp, Immunization owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization.ImmunizationVaccinationProtocolComponent res = new Immunization.ImmunizationVaccinationProtocolComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationImmunizationVaccinationProtocolComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationImmunizationVaccinationProtocolComponentContent(int eventType, XmlPullParser xpp, Immunization owner, Immunization.ImmunizationVaccinationProtocolComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseSequence")) {
        res.setDoseSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authority")) {
        res.setAuthority(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("series")) {
        res.setSeriesElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("seriesDoses")) {
        res.setSeriesDosesElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetDisease")) {
        res.getTargetDisease().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseStatus")) {
        res.setDoseStatus(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseStatusReason")) {
        res.setDoseStatusReason(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImmunizationRecommendation parseImmunizationRecommendation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImmunizationRecommendation res = new ImmunizationRecommendation();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationRecommendationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationRecommendationContent(int eventType, XmlPullParser xpp, ImmunizationRecommendation res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recommendation")) {
        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(XmlPullParser xpp, ImmunizationRecommendation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentContent(int eventType, XmlPullParser xpp, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("vaccineCode")) {
        res.setVaccineCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetDisease")) {
        res.setTargetDisease(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseNumber")) {
        res.setDoseNumberElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("forecastStatus")) {
        res.setForecastStatus(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateCriterion")) {
        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocol")) {
        res.setProtocol(parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingImmunization")) {
        res.getSupportingImmunization().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingPatientInformation")) {
        res.getSupportingPatientInformation().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(XmlPullParser xpp, ImmunizationRecommendation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentContent(int eventType, XmlPullParser xpp, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseDateTime(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(XmlPullParser xpp, ImmunizationRecommendation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentContent(int eventType, XmlPullParser xpp, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseSequence")) {
        res.setDoseSequenceElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authority")) {
        res.setAuthority(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("series")) {
        res.setSeriesElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImplementationGuide parseImplementationGuide(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide res = new ImplementationGuide();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImplementationGuideContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideContent(int eventType, XmlPullParser xpp, ImplementationGuide res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirVersion")) {
        res.setFhirVersionElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependency")) {
        res.getDependency().add(parseImplementationGuideImplementationGuideDependencyComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("package")) {
        res.getPackage().add(parseImplementationGuideImplementationGuidePackageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("global")) {
        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("binary")) {
        res.getBinary().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("page")) {
        res.setPage(parseImplementationGuideImplementationGuidePageComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImplementationGuide.ImplementationGuideDependencyComponent parseImplementationGuideImplementationGuideDependencyComponent(XmlPullParser xpp, ImplementationGuide owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideDependencyComponent res = new ImplementationGuide.ImplementationGuideDependencyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImplementationGuideImplementationGuideDependencyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideImplementationGuideDependencyComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependencyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, ImplementationGuide.GuideDependencyType.NULL, new ImplementationGuide.GuideDependencyTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
        res.setUriElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImplementationGuide.ImplementationGuidePackageComponent parseImplementationGuideImplementationGuidePackageComponent(XmlPullParser xpp, ImplementationGuide owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuidePackageComponent res = new ImplementationGuide.ImplementationGuidePackageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImplementationGuideImplementationGuidePackageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideImplementationGuidePackageComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.getResource().add(parseImplementationGuideImplementationGuidePackageResourceComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImplementationGuide.ImplementationGuidePackageResourceComponent parseImplementationGuideImplementationGuidePackageResourceComponent(XmlPullParser xpp, ImplementationGuide owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuidePackageResourceComponent res = new ImplementationGuide.ImplementationGuidePackageResourceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImplementationGuideImplementationGuidePackageResourceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideImplementationGuidePackageResourceComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageResourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("example")) {
        res.setExampleElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("acronym")) {
        res.setAcronymElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "source")) {
        res.setSource(parseType("source", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exampleFor")) {
        res.setExampleFor(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(XmlPullParser xpp, ImplementationGuide owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImplementationGuideImplementationGuideGlobalComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideImplementationGuideGlobalComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ImplementationGuide.ImplementationGuidePageComponent parseImplementationGuideImplementationGuidePageComponent(XmlPullParser xpp, ImplementationGuide owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuidePageComponent res = new ImplementationGuide.ImplementationGuidePageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseImplementationGuideImplementationGuidePageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideImplementationGuidePageComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSourceElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, ImplementationGuide.GuidePageKind.NULL, new ImplementationGuide.GuidePageKindEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("package")) {
        res.getPackage().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("format")) {
        res.setFormatElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("page")) {
        res.getPage().add(parseImplementationGuideImplementationGuidePageComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Library parseLibrary(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Library res = new Library();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseLibraryContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseLibraryContent(int eventType, XmlPullParser xpp, Library res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
        res.setUsageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
        res.setApprovalDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
        res.setLastReviewDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
        res.setEffectivePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
        res.getContributor().add(parseContributor(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
        res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
        res.getParameter().add(parseParameterDefinition(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataRequirement")) {
        res.getDataRequirement().add(parseDataRequirement(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
        res.getContent().add(parseAttachment(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Linkage parseLinkage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Linkage res = new Linkage();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseLinkageContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseLinkageContent(int eventType, XmlPullParser xpp, Linkage res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseLinkageLinkageItemComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(XmlPullParser xpp, Linkage owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseLinkageLinkageItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseLinkageLinkageItemComponentContent(int eventType, XmlPullParser xpp, Linkage owner, Linkage.LinkageItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ListResource parseListResource(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ListResource res = new ListResource();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseListResourceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseListResourceContent(int eventType, XmlPullParser xpp, ListResource res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.setEncounter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderedBy")) {
        res.setOrderedBy(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entry")) {
        res.getEntry().add(parseListResourceListEntryComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("emptyReason")) {
        res.setEmptyReason(parseCodeableConcept(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(XmlPullParser xpp, ListResource owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseListResourceListEntryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseListResourceListEntryComponentContent(int eventType, XmlPullParser xpp, ListResource owner, ListResource.ListEntryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("flag")) {
        res.setFlag(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("deleted")) {
        res.setDeletedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.setItem(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Location parseLocation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Location res = new Location();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseLocationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseLocationContent(int eventType, XmlPullParser xpp, Location res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operationalStatus")) {
        res.setOperationalStatus(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alias")) {
        res.getAlias().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.setAddress(parseAddress(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("physicalType")) {
        res.setPhysicalType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("position")) {
        res.setPosition(parseLocationLocationPositionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("managingOrganization")) {
        res.setManagingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.setPartOf(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(XmlPullParser xpp, Location owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseLocationLocationPositionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseLocationLocationPositionComponentContent(int eventType, XmlPullParser xpp, Location owner, Location.LocationPositionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("longitude")) {
        res.setLongitudeElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("latitude")) {
        res.setLatitudeElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("altitude")) {
        res.setAltitudeElement(parseDecimal(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Measure parseMeasure(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure res = new Measure();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureContent(int eventType, XmlPullParser xpp, Measure res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
        res.setUsageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
        res.setApprovalDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
        res.setLastReviewDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
        res.setEffectivePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
        res.getContributor().add(parseContributor(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
        res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("library")) {
        res.getLibrary().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disclaimer")) {
        res.setDisclaimerElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scoring")) {
        res.setScoring(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compositeScoring")) {
        res.setCompositeScoring(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("riskAdjustment")) {
        res.setRiskAdjustmentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rateAggregation")) {
        res.setRateAggregationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rationale")) {
        res.setRationaleElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("clinicalRecommendationStatement")) {
        res.setClinicalRecommendationStatementElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("improvementNotation")) {
        res.setImprovementNotationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("guidance")) {
        res.setGuidanceElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("set")) {
        res.setSetElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
        res.getGroup().add(parseMeasureMeasureGroupComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplementalData")) {
        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(XmlPullParser xpp, Measure owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureMeasureGroupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureMeasureGroupComponentContent(int eventType, XmlPullParser xpp, Measure owner, Measure.MeasureGroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stratifier")) {
        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(XmlPullParser xpp, Measure owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureMeasureGroupPopulationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureMeasureGroupPopulationComponentContent(int eventType, XmlPullParser xpp, Measure owner, Measure.MeasureGroupPopulationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criteria")) {
        res.setCriteriaElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(XmlPullParser xpp, Measure owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureMeasureGroupStratifierComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureMeasureGroupStratifierComponentContent(int eventType, XmlPullParser xpp, Measure owner, Measure.MeasureGroupStratifierComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criteria")) {
        res.setCriteriaElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(XmlPullParser xpp, Measure owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureMeasureSupplementalDataComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureMeasureSupplementalDataComponentContent(int eventType, XmlPullParser xpp, Measure owner, Measure.MeasureSupplementalDataComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
        res.getUsage().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criteria")) {
        res.setCriteriaElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MeasureReport parseMeasureReport(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport res = new MeasureReport();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureReportContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportContent(int eventType, XmlPullParser xpp, MeasureReport res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measure")) {
        res.setMeasure(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reportingOrganization")) {
        res.setReportingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("evaluatedResources")) {
        res.setEvaluatedResources(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(XmlPullParser xpp, MeasureReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureReportMeasureReportGroupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportMeasureReportGroupComponentContent(int eventType, XmlPullParser xpp, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measureScore")) {
        res.setMeasureScoreElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stratifier")) {
        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(XmlPullParser xpp, MeasureReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureReportMeasureReportGroupPopulationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportMeasureReportGroupPopulationComponentContent(int eventType, XmlPullParser xpp, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("count")) {
        res.setCountElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patients")) {
        res.setPatients(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(XmlPullParser xpp, MeasureReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureReportMeasureReportGroupStratifierComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportMeasureReportGroupStratifierComponentContent(int eventType, XmlPullParser xpp, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stratum")) {
        res.getStratum().add(parseMeasureReportStratifierGroupComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(XmlPullParser xpp, MeasureReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureReportStratifierGroupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportStratifierGroupComponentContent(int eventType, XmlPullParser xpp, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measureScore")) {
        res.setMeasureScoreElement(parseDecimal(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(XmlPullParser xpp, MeasureReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMeasureReportStratifierGroupPopulationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportStratifierGroupPopulationComponentContent(int eventType, XmlPullParser xpp, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("count")) {
        res.setCountElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patients")) {
        res.setPatients(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Media parseMedia(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Media res = new Media();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMediaContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMediaContent(int eventType, XmlPullParser xpp, Media res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Media.DigitalMediaType.NULL, new Media.DigitalMediaTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtype")) {
        res.setSubtype(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("view")) {
        res.setView(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operator")) {
        res.setOperator(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.setBodySite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
        res.setDevice(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("height")) {
        res.setHeightElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("width")) {
        res.setWidthElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frames")) {
        res.setFramesElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
        res.setDurationElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
        res.setContent(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Medication parseMedication(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Medication res = new Medication();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationContent(int eventType, XmlPullParser xpp, Medication res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isBrand")) {
        res.setIsBrandElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isOverTheCounter")) {
        res.setIsOverTheCounterElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
        res.setManufacturer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
        res.setForm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
        res.getIngredient().add(parseMedicationMedicationIngredientComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("package")) {
        res.setPackage(parseMedicationMedicationPackageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("image")) {
        res.getImage().add(parseAttachment(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(XmlPullParser xpp, Medication owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationMedicationIngredientComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationMedicationIngredientComponentContent(int eventType, XmlPullParser xpp, Medication owner, Medication.MedicationIngredientComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
        res.setItem(parseType("item", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isActive")) {
        res.setIsActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseRatio(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Medication.MedicationPackageComponent parseMedicationMedicationPackageComponent(XmlPullParser xpp, Medication owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Medication.MedicationPackageComponent res = new Medication.MedicationPackageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationMedicationPackageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationMedicationPackageComponentContent(int eventType, XmlPullParser xpp, Medication owner, Medication.MedicationPackageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("container")) {
        res.setContainer(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
        res.getContent().add(parseMedicationMedicationPackageContentComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("batch")) {
        res.getBatch().add(parseMedicationMedicationPackageBatchComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Medication.MedicationPackageContentComponent parseMedicationMedicationPackageContentComponent(XmlPullParser xpp, Medication owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Medication.MedicationPackageContentComponent res = new Medication.MedicationPackageContentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationMedicationPackageContentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationMedicationPackageContentComponentContent(int eventType, XmlPullParser xpp, Medication owner, Medication.MedicationPackageContentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
        res.setItem(parseType("item", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseSimpleQuantity(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Medication.MedicationPackageBatchComponent parseMedicationMedicationPackageBatchComponent(XmlPullParser xpp, Medication owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Medication.MedicationPackageBatchComponent res = new Medication.MedicationPackageBatchComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationMedicationPackageBatchComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationMedicationPackageBatchComponentContent(int eventType, XmlPullParser xpp, Medication owner, Medication.MedicationPackageBatchComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lotNumber")) {
        res.setLotNumberElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expirationDate")) {
        res.setExpirationDateElement(parseDateTime(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationAdministration parseMedicationAdministration(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationAdministration res = new MedicationAdministration();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationAdministrationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationAdministrationContent(int eventType, XmlPullParser xpp, MedicationAdministration res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "medication")) {
        res.setMedication(parseType("medication", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
        res.getSupportingInformation().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "effective")) {
        res.setEffective(parseType("effective", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notGiven")) {
        res.setNotGivenElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonNotGiven")) {
        res.getReasonNotGiven().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prescription")) {
        res.setPrescription(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
        res.getDevice().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosage")) {
        res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventHistory")) {
        res.getEventHistory().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(XmlPullParser xpp, MedicationAdministration owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationAdministrationMedicationAdministrationPerformerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationAdministrationMedicationAdministrationPerformerComponentContent(int eventType, XmlPullParser xpp, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(XmlPullParser xpp, MedicationAdministration owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationAdministrationMedicationAdministrationDosageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationAdministrationMedicationAdministrationDosageComponentContent(int eventType, XmlPullParser xpp, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
        res.setSite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("route")) {
        res.setRoute(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
        res.setMethod(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dose")) {
        res.setDose(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "rate")) {
        res.setRate(parseType("rate", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationDispense parseMedicationDispense(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationDispense res = new MedicationDispense();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationDispenseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationDispenseContent(int eventType, XmlPullParser xpp, MedicationDispense res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "medication")) {
        res.setMedication(parseType("medication", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
        res.getSupportingInformation().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorizingPrescription")) {
        res.getAuthorizingPrescription().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysSupply")) {
        res.setDaysSupply(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("whenPrepared")) {
        res.setWhenPreparedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("whenHandedOver")) {
        res.setWhenHandedOverElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
        res.setDestination(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("receiver")) {
        res.getReceiver().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosageInstruction")) {
        res.getDosageInstruction().add(parseDosage(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substitution")) {
        res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detectedIssue")) {
        res.getDetectedIssue().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notDone")) {
        res.setNotDoneElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "notDoneReason")) {
        res.setNotDoneReason(parseType("notDoneReason", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventHistory")) {
        res.getEventHistory().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(XmlPullParser xpp, MedicationDispense owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationDispenseMedicationDispensePerformerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationDispenseMedicationDispensePerformerComponentContent(int eventType, XmlPullParser xpp, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(XmlPullParser xpp, MedicationDispense owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationDispenseMedicationDispenseSubstitutionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationDispenseMedicationDispenseSubstitutionComponentContent(int eventType, XmlPullParser xpp, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("wasSubstituted")) {
        res.setWasSubstitutedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.getReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responsibleParty")) {
        res.getResponsibleParty().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationRequest parseMedicationRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationRequest res = new MedicationRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationRequestContent(int eventType, XmlPullParser xpp, MedicationRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupIdentifier")) {
        res.setGroupIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
        res.setIntentElement(parseEnumeration(xpp, MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "medication")) {
        res.setMedication(parseType("medication", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
        res.getSupportingInformation().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
        res.setRequester(parseMedicationRequestMedicationRequestRequesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorder")) {
        res.setRecorder(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosageInstruction")) {
        res.getDosageInstruction().add(parseDosage(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dispenseRequest")) {
        res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substitution")) {
        res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priorPrescription")) {
        res.setPriorPrescription(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detectedIssue")) {
        res.getDetectedIssue().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventHistory")) {
        res.getEventHistory().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationRequest.MedicationRequestRequesterComponent parseMedicationRequestMedicationRequestRequesterComponent(XmlPullParser xpp, MedicationRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationRequest.MedicationRequestRequesterComponent res = new MedicationRequest.MedicationRequestRequesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationRequestMedicationRequestRequesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationRequestMedicationRequestRequesterComponentContent(int eventType, XmlPullParser xpp, MedicationRequest owner, MedicationRequest.MedicationRequestRequesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.setAgent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(XmlPullParser xpp, MedicationRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationRequestMedicationRequestDispenseRequestComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationRequestMedicationRequestDispenseRequestComponentContent(int eventType, XmlPullParser xpp, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validityPeriod")) {
        res.setValidityPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfRepeatsAllowed")) {
        res.setNumberOfRepeatsAllowedElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expectedSupplyDuration")) {
        res.setExpectedSupplyDuration(parseDuration(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.setPerformer(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(XmlPullParser xpp, MedicationRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationRequestMedicationRequestSubstitutionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationRequestMedicationRequestSubstitutionComponentContent(int eventType, XmlPullParser xpp, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allowed")) {
        res.setAllowedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MedicationStatement parseMedicationStatement(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationStatement res = new MedicationStatement();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMedicationStatementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationStatementContent(int eventType, XmlPullParser xpp, MedicationStatement res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "medication")) {
        res.setMedication(parseType("medication", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "effective")) {
        res.setEffective(parseType("effective", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateAsserted")) {
        res.setDateAssertedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationSource")) {
        res.setInformationSource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivedFrom")) {
        res.getDerivedFrom().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("taken")) {
        res.setTakenElement(parseEnumeration(xpp, MedicationStatement.MedicationStatementTaken.NULL, new MedicationStatement.MedicationStatementTakenEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonNotTaken")) {
        res.getReasonNotTaken().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosage")) {
        res.getDosage().add(parseDosage(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MessageDefinition parseMessageDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageDefinition res = new MessageDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMessageDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageDefinitionContent(int eventType, XmlPullParser xpp, MessageDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
        res.setBase(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
        res.getParent().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
        res.getReplaces().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
        res.setEvent(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategoryElement(parseEnumeration(xpp, MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focus")) {
        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responseRequired")) {
        res.setResponseRequiredElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allowedResponse")) {
        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(XmlPullParser xpp, MessageDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMessageDefinitionMessageDefinitionFocusComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageDefinitionMessageDefinitionFocusComponentContent(int eventType, XmlPullParser xpp, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
        res.setMinElement(parseUnsignedInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
        res.setMaxElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(XmlPullParser xpp, MessageDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMessageDefinitionMessageDefinitionAllowedResponseComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageDefinitionMessageDefinitionAllowedResponseComponentContent(int eventType, XmlPullParser xpp, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("message")) {
        res.setMessage(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("situation")) {
        res.setSituationElement(parseMarkdown(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MessageHeader parseMessageHeader(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageHeader res = new MessageHeader();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMessageHeaderContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageHeaderContent(int eventType, XmlPullParser xpp, MessageHeader res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
        res.setEvent(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("receiver")) {
        res.setReceiver(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sender")) {
        res.setSender(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timestamp")) {
        res.setTimestampElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enterer")) {
        res.setEnterer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSource(parseMessageHeaderMessageSourceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responsible")) {
        res.setResponsible(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
        res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focus")) {
        res.getFocus().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(XmlPullParser xpp, MessageHeader owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMessageHeaderMessageDestinationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageHeaderMessageDestinationComponentContent(int eventType, XmlPullParser xpp, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTarget(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.setEndpointElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(XmlPullParser xpp, MessageHeader owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMessageHeaderMessageSourceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageHeaderMessageSourceComponentContent(int eventType, XmlPullParser xpp, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("software")) {
        res.setSoftwareElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.setContact(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.setEndpointElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(XmlPullParser xpp, MessageHeader owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseMessageHeaderMessageHeaderResponseComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageHeaderMessageHeaderResponseComponentContent(int eventType, XmlPullParser xpp, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifierElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
        res.setDetails(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NamingSystem parseNamingSystem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NamingSystem res = new NamingSystem();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNamingSystemContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNamingSystemContent(int eventType, XmlPullParser xpp, NamingSystem res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responsible")) {
        res.setResponsibleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
        res.setUsageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uniqueId")) {
        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replacedBy")) {
        res.setReplacedBy(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(XmlPullParser xpp, NamingSystem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNamingSystemNamingSystemUniqueIdComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNamingSystemNamingSystemUniqueIdComponentContent(int eventType, XmlPullParser xpp, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preferred")) {
        res.setPreferredElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NutritionOrder parseNutritionOrder(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder res = new NutritionOrder();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNutritionOrderContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderContent(int eventType, XmlPullParser xpp, NutritionOrder res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.setEncounter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateTime")) {
        res.setDateTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderer")) {
        res.setOrderer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allergyIntolerance")) {
        res.getAllergyIntolerance().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("foodPreferenceModifier")) {
        res.getFoodPreferenceModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludeFoodModifier")) {
        res.getExcludeFoodModifier().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("oralDiet")) {
        res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplement")) {
        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enteralFormula")) {
        res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(XmlPullParser xpp, NutritionOrder owner) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNutritionOrderNutritionOrderOralDietComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderNutritionOrderOralDietComponentContent(int eventType, XmlPullParser xpp, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
        res.getSchedule().add(parseTiming(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nutrient")) {
        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("texture")) {
        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fluidConsistencyType")) {
        res.getFluidConsistencyType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instruction")) {
        res.setInstructionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(XmlPullParser xpp, NutritionOrder owner) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNutritionOrderNutritionOrderOralDietNutrientComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderNutritionOrderOralDietNutrientComponentContent(int eventType, XmlPullParser xpp, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.setModifier(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseSimpleQuantity(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(XmlPullParser xpp, NutritionOrder owner) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNutritionOrderNutritionOrderOralDietTextureComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderNutritionOrderOralDietTextureComponentContent(int eventType, XmlPullParser xpp, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.setModifier(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("foodType")) {
        res.setFoodType(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(XmlPullParser xpp, NutritionOrder owner) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNutritionOrderNutritionOrderSupplementComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderNutritionOrderSupplementComponentContent(int eventType, XmlPullParser xpp, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productName")) {
        res.setProductNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
        res.getSchedule().add(parseTiming(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instruction")) {
        res.setInstructionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(XmlPullParser xpp, NutritionOrder owner) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNutritionOrderNutritionOrderEnteralFormulaComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderNutritionOrderEnteralFormulaComponentContent(int eventType, XmlPullParser xpp, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("baseFormulaType")) {
        res.setBaseFormulaType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("baseFormulaProductName")) {
        res.setBaseFormulaProductNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additiveType")) {
        res.setAdditiveType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additiveProductName")) {
        res.setAdditiveProductNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("caloricDensity")) {
        res.setCaloricDensity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("routeofAdministration")) {
        res.setRouteofAdministration(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("administration")) {
        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxVolumeToDeliver")) {
        res.setMaxVolumeToDeliver(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("administrationInstruction")) {
        res.setAdministrationInstructionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(XmlPullParser xpp, NutritionOrder owner) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentContent(int eventType, XmlPullParser xpp, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
        res.setSchedule(parseTiming(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "rate")) {
        res.setRate(parseType("rate", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Observation parseObservation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Observation res = new Observation();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseObservationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationContent(int eventType, XmlPullParser xpp, Observation res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "effective")) {
        res.setEffective(parseType("effective", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issued")) {
        res.setIssuedElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.getPerformer().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataAbsentReason")) {
        res.setDataAbsentReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interpretation")) {
        res.setInterpretation(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.setBodySite(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
        res.setMethod(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specimen")) {
        res.setSpecimen(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
        res.setDevice(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceRange")) {
        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("related")) {
        res.getRelated().add(parseObservationObservationRelatedComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("component")) {
        res.getComponent().add(parseObservationObservationComponentComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(XmlPullParser xpp, Observation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseObservationObservationReferenceRangeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationObservationReferenceRangeComponentContent(int eventType, XmlPullParser xpp, Observation owner, Observation.ObservationReferenceRangeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("low")) {
        res.setLow(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("high")) {
        res.setHigh(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appliesTo")) {
        res.getAppliesTo().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("age")) {
        res.setAge(parseRange(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Observation.ObservationRelatedComponent parseObservationObservationRelatedComponent(XmlPullParser xpp, Observation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Observation.ObservationRelatedComponent res = new Observation.ObservationRelatedComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseObservationObservationRelatedComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationObservationRelatedComponentContent(int eventType, XmlPullParser xpp, Observation owner, Observation.ObservationRelatedComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Observation.ObservationRelationshipType.NULL, new Observation.ObservationRelationshipTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTarget(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(XmlPullParser xpp, Observation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseObservationObservationComponentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationObservationComponentComponentContent(int eventType, XmlPullParser xpp, Observation owner, Observation.ObservationComponentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataAbsentReason")) {
        res.setDataAbsentReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interpretation")) {
        res.setInterpretation(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceRange")) {
        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected OperationDefinition parseOperationDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationDefinition res = new OperationDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOperationDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationDefinitionContent(int eventType, XmlPullParser xpp, OperationDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("idempotent")) {
        res.setIdempotentElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
        res.setBase(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.getResource().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
        res.setInstanceElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("overload")) {
        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(XmlPullParser xpp, OperationDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOperationDefinitionOperationDefinitionParameterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationDefinitionOperationDefinitionParameterComponentContent(int eventType, XmlPullParser xpp, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUseElement(parseEnumeration(xpp, OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
        res.setMinElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
        res.setMaxElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchType")) {
        res.setSearchTypeElement(parseEnumeration(xpp, Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("binding")) {
        res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("part")) {
        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(XmlPullParser xpp, OperationDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOperationDefinitionOperationDefinitionParameterBindingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationDefinitionOperationDefinitionParameterBindingComponentContent(int eventType, XmlPullParser xpp, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strength")) {
        res.setStrengthElement(parseEnumeration(xpp, Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "valueSet")) {
        res.setValueSet(parseType("valueSet", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(XmlPullParser xpp, OperationDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOperationDefinitionOperationDefinitionOverloadComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationDefinitionOperationDefinitionOverloadComponentContent(int eventType, XmlPullParser xpp, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameterName")) {
        res.getParameterName().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected OperationOutcome parseOperationOutcome(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationOutcome res = new OperationOutcome();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOperationOutcomeContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationOutcomeContent(int eventType, XmlPullParser xpp, OperationOutcome res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issue")) {
        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(XmlPullParser xpp, OperationOutcome owner) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOperationOutcomeOperationOutcomeIssueComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationOutcomeOperationOutcomeIssueComponentContent(int eventType, XmlPullParser xpp, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
        res.setSeverityElement(parseEnumeration(xpp, OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseEnumeration(xpp, OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
        res.setDetails(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnostics")) {
        res.setDiagnosticsElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.getLocation().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.getExpression().add(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Organization parseOrganization(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Organization res = new Organization();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOrganizationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOrganizationContent(int eventType, XmlPullParser xpp, Organization res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.getType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alias")) {
        res.getAlias().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.getAddress().add(parseAddress(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.setPartOf(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseOrganizationOrganizationContactComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(XmlPullParser xpp, Organization owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseOrganizationOrganizationContactComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOrganizationOrganizationContactComponentContent(int eventType, XmlPullParser xpp, Organization owner, Organization.OrganizationContactComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurpose(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setName(parseHumanName(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.setAddress(parseAddress(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Patient parsePatient(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient res = new Patient();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePatientContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePatientContent(int eventType, XmlPullParser xpp, Patient res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.getName().add(parseHumanName(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
        res.setGenderElement(parseEnumeration(xpp, Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("birthDate")) {
        res.setBirthDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "deceased")) {
        res.setDeceased(parseType("deceased", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.getAddress().add(parseAddress(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maritalStatus")) {
        res.setMaritalStatus(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "multipleBirth")) {
        res.setMultipleBirth(parseType("multipleBirth", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("photo")) {
        res.getPhoto().add(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parsePatientContactComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("animal")) {
        res.setAnimal(parsePatientAnimalComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("communication")) {
        res.getCommunication().add(parsePatientPatientCommunicationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("generalPractitioner")) {
        res.getGeneralPractitioner().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("managingOrganization")) {
        res.setManagingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parsePatientPatientLinkComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Patient.ContactComponent parsePatientContactComponent(XmlPullParser xpp, Patient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient.ContactComponent res = new Patient.ContactComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePatientContactComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePatientContactComponentContent(int eventType, XmlPullParser xpp, Patient owner, Patient.ContactComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.getRelationship().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setName(parseHumanName(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.setAddress(parseAddress(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
        res.setGenderElement(parseEnumeration(xpp, Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Patient.AnimalComponent parsePatientAnimalComponent(XmlPullParser xpp, Patient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient.AnimalComponent res = new Patient.AnimalComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePatientAnimalComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePatientAnimalComponentContent(int eventType, XmlPullParser xpp, Patient owner, Patient.AnimalComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("species")) {
        res.setSpecies(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("breed")) {
        res.setBreed(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("genderStatus")) {
        res.setGenderStatus(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(XmlPullParser xpp, Patient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePatientPatientCommunicationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePatientPatientCommunicationComponentContent(int eventType, XmlPullParser xpp, Patient owner, Patient.PatientCommunicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguage(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preferred")) {
        res.setPreferredElement(parseBoolean(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(XmlPullParser xpp, Patient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePatientPatientLinkComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePatientPatientLinkComponentContent(int eventType, XmlPullParser xpp, Patient owner, Patient.PatientLinkComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other")) {
        res.setOther(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PaymentNotice parsePaymentNotice(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PaymentNotice res = new PaymentNotice();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePaymentNoticeContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePaymentNoticeContent(int eventType, XmlPullParser xpp, PaymentNotice res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
        res.setResponse(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusDate")) {
        res.setStatusDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTarget(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paymentStatus")) {
        res.setPaymentStatus(parseCodeableConcept(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PaymentReconciliation parsePaymentReconciliation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PaymentReconciliation res = new PaymentReconciliation();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePaymentReconciliationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePaymentReconciliationContent(int eventType, XmlPullParser xpp, PaymentReconciliation res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
        res.setDispositionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestProvider")) {
        res.setRequestProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestOrganization")) {
        res.setRequestOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.getDetail().add(parsePaymentReconciliationDetailsComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
        res.setForm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
        res.setTotal(parseMoney(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processNote")) {
        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(XmlPullParser xpp, PaymentReconciliation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePaymentReconciliationDetailsComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePaymentReconciliationDetailsComponentContent(int eventType, XmlPullParser xpp, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
        res.setResponse(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("submitter")) {
        res.setSubmitter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payee")) {
        res.setPayee(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
        res.setAmount(parseMoney(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(XmlPullParser xpp, PaymentReconciliation owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePaymentReconciliationNotesComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePaymentReconciliationNotesComponentContent(int eventType, XmlPullParser xpp, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Person parsePerson(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Person res = new Person();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePersonContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePersonContent(int eventType, XmlPullParser xpp, Person res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.getName().add(parseHumanName(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
        res.setGenderElement(parseEnumeration(xpp, Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("birthDate")) {
        res.setBirthDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.getAddress().add(parseAddress(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("photo")) {
        res.setPhoto(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("managingOrganization")) {
        res.setManagingOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parsePersonPersonLinkComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(XmlPullParser xpp, Person owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePersonPersonLinkComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePersonPersonLinkComponentContent(int eventType, XmlPullParser xpp, Person owner, Person.PersonLinkComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTarget(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assurance")) {
        res.setAssuranceElement(parseEnumeration(xpp, Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition parsePlanDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition res = new PlanDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionContent(int eventType, XmlPullParser xpp, PlanDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
        res.setUsageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
        res.setApprovalDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
        res.setLastReviewDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
        res.setEffectivePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
        res.getContributor().add(parseContributor(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
        res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("library")) {
        res.getLibrary().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("goal")) {
        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(XmlPullParser xpp, PlanDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionPlanDefinitionGoalComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionPlanDefinitionGoalComponentContent(int eventType, XmlPullParser xpp, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescription(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriority(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStart(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addresses")) {
        res.getAddresses().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.getDocumentation().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(XmlPullParser xpp, PlanDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionPlanDefinitionGoalTargetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionPlanDefinitionGoalTargetComponentContent(int eventType, XmlPullParser xpp, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measure")) {
        res.setMeasure(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "detail")) {
        res.setDetail(parseType("detail", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("due")) {
        res.setDue(parseDuration(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(XmlPullParser xpp, PlanDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionPlanDefinitionActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionPlanDefinitionActionComponentContent(int eventType, XmlPullParser xpp, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
        res.setLabelElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("textEquivalent")) {
        res.setTextEquivalentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.getReason().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.getDocumentation().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("goalId")) {
        res.getGoalId().add(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("triggerDefinition")) {
        res.getTriggerDefinition().add(parseTriggerDefinition(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("input")) {
        res.getInput().add(parseDataRequirement(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("output")) {
        res.getOutput().add(parseDataRequirement(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedAction")) {
        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
        res.setTiming(parseType("timing", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupingBehavior")) {
        res.setGroupingBehaviorElement(parseEnumeration(xpp, PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("selectionBehavior")) {
        res.setSelectionBehaviorElement(parseEnumeration(xpp, PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requiredBehavior")) {
        res.setRequiredBehaviorElement(parseEnumeration(xpp, PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precheckBehavior")) {
        res.setPrecheckBehaviorElement(parseEnumeration(xpp, PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cardinalityBehavior")) {
        res.setCardinalityBehaviorElement(parseEnumeration(xpp, PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinition(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("transform")) {
        res.setTransform(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dynamicValue")) {
        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(XmlPullParser xpp, PlanDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionPlanDefinitionActionConditionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionPlanDefinitionActionConditionComponentContent(int eventType, XmlPullParser xpp, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(XmlPullParser xpp, PlanDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionPlanDefinitionActionRelatedActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionPlanDefinitionActionRelatedActionComponentContent(int eventType, XmlPullParser xpp, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actionId")) {
        res.setActionIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.setRelationshipElement(parseEnumeration(xpp, PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "offset")) {
        res.setOffset(parseType("offset", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(XmlPullParser xpp, PlanDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionPlanDefinitionActionParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionPlanDefinitionActionParticipantComponentContent(int eventType, XmlPullParser xpp, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(XmlPullParser xpp, PlanDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePlanDefinitionPlanDefinitionActionDynamicValueComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionPlanDefinitionActionDynamicValueComponentContent(int eventType, XmlPullParser xpp, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Practitioner parsePractitioner(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Practitioner res = new Practitioner();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePractitionerContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerContent(int eventType, XmlPullParser xpp, Practitioner res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.getName().add(parseHumanName(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.getAddress().add(parseAddress(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
        res.setGenderElement(parseEnumeration(xpp, Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("birthDate")) {
        res.setBirthDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("photo")) {
        res.getPhoto().add(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualification")) {
        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("communication")) {
        res.getCommunication().add(parseCodeableConcept(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(XmlPullParser xpp, Practitioner owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePractitionerPractitionerQualificationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerPractitionerQualificationComponentContent(int eventType, XmlPullParser xpp, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issuer")) {
        res.setIssuer(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PractitionerRole parsePractitionerRole(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PractitionerRole res = new PractitionerRole();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePractitionerRoleContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerRoleContent(int eventType, XmlPullParser xpp, PractitionerRole res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("practitioner")) {
        res.setPractitioner(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
        res.getSpecialty().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.getLocation().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("healthcareService")) {
        res.getHealthcareService().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableTime")) {
        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notAvailable")) {
        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availabilityExceptions")) {
        res.setAvailabilityExceptionsElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.getEndpoint().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(XmlPullParser xpp, PractitionerRole owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePractitionerRolePractitionerRoleAvailableTimeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerRolePractitionerRoleAvailableTimeComponentContent(int eventType, XmlPullParser xpp, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysOfWeek")) {
        res.getDaysOfWeek().add(parseEnumeration(xpp, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allDay")) {
        res.setAllDayElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableStartTime")) {
        res.setAvailableStartTimeElement(parseTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableEndTime")) {
        res.setAvailableEndTimeElement(parseTime(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(XmlPullParser xpp, PractitionerRole owner) throws XmlPullParserException, IOException, FHIRFormatError {
    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parsePractitionerRolePractitionerRoleNotAvailableComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerRolePractitionerRoleNotAvailableComponentContent(int eventType, XmlPullParser xpp, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("during")) {
        res.setDuring(parsePeriod(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Procedure parseProcedure(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Procedure res = new Procedure();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcedureContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcedureContent(int eventType, XmlPullParser xpp, Procedure res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notDone")) {
        res.setNotDoneElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notDoneReason")) {
        res.setNotDoneReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "performed")) {
        res.setPerformed(parseType("performed", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.getPerformer().add(parseProcedureProcedurePerformerComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.getBodySite().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("report")) {
        res.getReport().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("complication")) {
        res.getComplication().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("complicationDetail")) {
        res.getComplicationDetail().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("followUp")) {
        res.getFollowUp().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focalDevice")) {
        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usedReference")) {
        res.getUsedReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usedCode")) {
        res.getUsedCode().add(parseCodeableConcept(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(XmlPullParser xpp, Procedure owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcedureProcedurePerformerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcedureProcedurePerformerComponentContent(int eventType, XmlPullParser xpp, Procedure owner, Procedure.ProcedurePerformerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRole(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.setActor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(XmlPullParser xpp, Procedure owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcedureProcedureFocalDeviceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcedureProcedureFocalDeviceComponentContent(int eventType, XmlPullParser xpp, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.setAction(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manipulated")) {
        res.setManipulated(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ProcedureRequest parseProcedureRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ProcedureRequest res = new ProcedureRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcedureRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcedureRequestContent(int eventType, XmlPullParser xpp, ProcedureRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
        res.getReplaces().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requisition")) {
        res.setRequisition(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ProcedureRequest.ProcedureRequestStatus.NULL, new ProcedureRequest.ProcedureRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
        res.setIntentElement(parseEnumeration(xpp, ProcedureRequest.ProcedureRequestIntent.NULL, new ProcedureRequest.ProcedureRequestIntentEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, ProcedureRequest.ProcedureRequestPriority.NULL, new ProcedureRequest.ProcedureRequestPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
        res.setDoNotPerformElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "asNeeded")) {
        res.setAsNeeded(parseType("asNeeded", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
        res.setRequester(parseProcedureRequestProcedureRequestRequesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performerType")) {
        res.setPerformerType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.setPerformer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
        res.getSupportingInfo().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specimen")) {
        res.getSpecimen().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.getBodySite().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relevantHistory")) {
        res.getRelevantHistory().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ProcedureRequest.ProcedureRequestRequesterComponent parseProcedureRequestProcedureRequestRequesterComponent(XmlPullParser xpp, ProcedureRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ProcedureRequest.ProcedureRequestRequesterComponent res = new ProcedureRequest.ProcedureRequestRequesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcedureRequestProcedureRequestRequesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcedureRequestProcedureRequestRequesterComponentContent(int eventType, XmlPullParser xpp, ProcedureRequest owner, ProcedureRequest.ProcedureRequestRequesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.setAgent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ProcessRequest parseProcessRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ProcessRequest res = new ProcessRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcessRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcessRequestContent(int eventType, XmlPullParser xpp, ProcessRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ProcessRequest.ProcessRequestStatus.NULL, new ProcessRequest.ProcessRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.setActionElement(parseEnumeration(xpp, ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.setTarget(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
        res.setProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
        res.setResponse(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nullify")) {
        res.setNullifyElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
        res.setReferenceElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseProcessRequestItemsComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("include")) {
        res.getInclude().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
        res.getExclude().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(XmlPullParser xpp, ProcessRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcessRequestItemsComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcessRequestItemsComponentContent(int eventType, XmlPullParser xpp, ProcessRequest owner, ProcessRequest.ItemsComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceLinkId")) {
        res.setSequenceLinkIdElement(parseInteger(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ProcessResponse parseProcessResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ProcessResponse res = new ProcessResponse();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcessResponseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcessResponseContent(int eventType, XmlPullParser xpp, ProcessResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ProcessResponse.ProcessResponseStatus.NULL, new ProcessResponse.ProcessResponseStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
        res.setCreatedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
        res.setOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.setRequest(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
        res.setDispositionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestProvider")) {
        res.setRequestProvider(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestOrganization")) {
        res.setRequestOrganization(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
        res.setForm(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processNote")) {
        res.getProcessNote().add(parseProcessResponseProcessResponseProcessNoteComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
        res.getError().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("communicationRequest")) {
        res.getCommunicationRequest().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ProcessResponse.ProcessResponseProcessNoteComponent parseProcessResponseProcessResponseProcessNoteComponent(XmlPullParser xpp, ProcessResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ProcessResponse.ProcessResponseProcessNoteComponent res = new ProcessResponse.ProcessResponseProcessNoteComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProcessResponseProcessResponseProcessNoteComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcessResponseProcessResponseProcessNoteComponentContent(int eventType, XmlPullParser xpp, ProcessResponse owner, ProcessResponse.ProcessResponseProcessNoteComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Provenance parseProvenance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Provenance res = new Provenance();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProvenanceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProvenanceContent(int eventType, XmlPullParser xpp, Provenance res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.getTarget().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorded")) {
        res.setRecordedElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("policy")) {
        res.getPolicy().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
        res.setLocation(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.getReason().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activity")) {
        res.setActivity(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.getAgent().add(parseProvenanceProvenanceAgentComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entity")) {
        res.getEntity().add(parseProvenanceProvenanceEntityComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("signature")) {
        res.getSignature().add(parseSignature(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(XmlPullParser xpp, Provenance owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProvenanceProvenanceAgentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProvenanceProvenanceAgentComponentContent(int eventType, XmlPullParser xpp, Provenance owner, Provenance.ProvenanceAgentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.getRole().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "who")) {
        res.setWho(parseType("who", xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "onBehalfOf")) {
        res.setOnBehalfOf(parseType("onBehalfOf", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedAgentType")) {
        res.setRelatedAgentType(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(XmlPullParser xpp, Provenance owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseProvenanceProvenanceEntityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProvenanceProvenanceEntityComponentContent(int eventType, XmlPullParser xpp, Provenance owner, Provenance.ProvenanceEntityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
        res.setRoleElement(parseEnumeration(xpp, Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "what")) {
        res.setWhat(parseType("what", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.getAgent().add(parseProvenanceProvenanceAgentComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Questionnaire parseQuestionnaire(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Questionnaire res = new Questionnaire();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuestionnaireContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireContent(int eventType, XmlPullParser xpp, Questionnaire res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
        res.setApprovalDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
        res.setLastReviewDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
        res.setEffectivePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subjectType")) {
        res.getSubjectType().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(XmlPullParser xpp, Questionnaire owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuestionnaireQuestionnaireItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireQuestionnaireItemComponentContent(int eventType, XmlPullParser xpp, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("linkId")) {
        res.setLinkIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinitionElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prefix")) {
        res.setPrefixElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enableWhen")) {
        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("required")) {
        res.setRequiredElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeats")) {
        res.setRepeatsElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("readOnly")) {
        res.setReadOnlyElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxLength")) {
        res.setMaxLengthElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("options")) {
        res.setOptions(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("option")) {
        res.getOption().add(parseQuestionnaireQuestionnaireItemOptionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "initial")) {
        res.setInitial(parseType("initial", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(XmlPullParser xpp, Questionnaire owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuestionnaireQuestionnaireItemEnableWhenComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireQuestionnaireItemEnableWhenComponentContent(int eventType, XmlPullParser xpp, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("question")) {
        res.setQuestionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasAnswer")) {
        res.setHasAnswerElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "answer")) {
        res.setAnswer(parseType("answer", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Questionnaire.QuestionnaireItemOptionComponent parseQuestionnaireQuestionnaireItemOptionComponent(XmlPullParser xpp, Questionnaire owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Questionnaire.QuestionnaireItemOptionComponent res = new Questionnaire.QuestionnaireItemOptionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuestionnaireQuestionnaireItemOptionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireQuestionnaireItemOptionComponentContent(int eventType, XmlPullParser xpp, Questionnaire owner, Questionnaire.QuestionnaireItemOptionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected QuestionnaireResponse parseQuestionnaireResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    QuestionnaireResponse res = new QuestionnaireResponse();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuestionnaireResponseContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireResponseContent(int eventType, XmlPullParser xpp, QuestionnaireResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
        res.getParent().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("questionnaire")) {
        res.setQuestionnaire(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authored")) {
        res.setAuthoredElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.setSource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(XmlPullParser xpp, QuestionnaireResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuestionnaireResponseQuestionnaireResponseItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireResponseQuestionnaireResponseItemComponentContent(int eventType, XmlPullParser xpp, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("linkId")) {
        res.setLinkIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinitionElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
        res.setTextElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("answer")) {
        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(XmlPullParser xpp, QuestionnaireResponse owner) throws XmlPullParserException, IOException, FHIRFormatError {
    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentContent(int eventType, XmlPullParser xpp, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ReferralRequest parseReferralRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ReferralRequest res = new ReferralRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseReferralRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseReferralRequestContent(int eventType, XmlPullParser xpp, ReferralRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
        res.getReplaces().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupIdentifier")) {
        res.setGroupIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ReferralRequest.ReferralRequestStatus.NULL, new ReferralRequest.ReferralRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
        res.setIntentElement(parseEnumeration(xpp, ReferralRequest.ReferralCategory.NULL, new ReferralRequest.ReferralCategoryEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, ReferralRequest.ReferralPriority.NULL, new ReferralRequest.ReferralPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceRequested")) {
        res.getServiceRequested().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
        res.setRequester(parseReferralRequestReferralRequestRequesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
        res.setSpecialty(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
        res.getRecipient().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
        res.getReasonCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
        res.getReasonReference().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
        res.getSupportingInfo().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relevantHistory")) {
        res.getRelevantHistory().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ReferralRequest.ReferralRequestRequesterComponent parseReferralRequestReferralRequestRequesterComponent(XmlPullParser xpp, ReferralRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ReferralRequest.ReferralRequestRequesterComponent res = new ReferralRequest.ReferralRequestRequesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseReferralRequestReferralRequestRequesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseReferralRequestReferralRequestRequesterComponentContent(int eventType, XmlPullParser xpp, ReferralRequest owner, ReferralRequest.ReferralRequestRequesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.setAgent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RelatedPerson parseRelatedPerson(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RelatedPerson res = new RelatedPerson();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRelatedPersonContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRelatedPersonContent(int eventType, XmlPullParser xpp, RelatedPerson res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.setRelationship(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.getName().add(parseHumanName(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
        res.getTelecom().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
        res.setGenderElement(parseEnumeration(xpp, Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("birthDate")) {
        res.setBirthDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
        res.getAddress().add(parseAddress(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("photo")) {
        res.getPhoto().add(parseAttachment(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RequestGroup parseRequestGroup(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RequestGroup res = new RequestGroup();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRequestGroupContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRequestGroupContent(int eventType, XmlPullParser xpp, RequestGroup res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.getDefinition().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
        res.getReplaces().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupIdentifier")) {
        res.setGroupIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
        res.setIntentElement(parseEnumeration(xpp, RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
        res.setAuthor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reason")) {
        res.setReason(parseType("reason", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseRequestGroupRequestGroupActionComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(XmlPullParser xpp, RequestGroup owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRequestGroupRequestGroupActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRequestGroupRequestGroupActionComponentContent(int eventType, XmlPullParser xpp, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
        res.setLabelElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("textEquivalent")) {
        res.setTextEquivalentElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.getCode().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.getDocumentation().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedAction")) {
        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
        res.setTiming(parseType("timing", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupingBehavior")) {
        res.setGroupingBehaviorElement(parseEnumeration(xpp, RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("selectionBehavior")) {
        res.setSelectionBehaviorElement(parseEnumeration(xpp, RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requiredBehavior")) {
        res.setRequiredBehaviorElement(parseEnumeration(xpp, RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precheckBehavior")) {
        res.setPrecheckBehaviorElement(parseEnumeration(xpp, RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cardinalityBehavior")) {
        res.setCardinalityBehaviorElement(parseEnumeration(xpp, RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseRequestGroupRequestGroupActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(XmlPullParser xpp, RequestGroup owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRequestGroupRequestGroupActionConditionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRequestGroupRequestGroupActionConditionComponentContent(int eventType, XmlPullParser xpp, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(XmlPullParser xpp, RequestGroup owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRequestGroupRequestGroupActionRelatedActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRequestGroupRequestGroupActionRelatedActionComponentContent(int eventType, XmlPullParser xpp, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actionId")) {
        res.setActionIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
        res.setRelationshipElement(parseEnumeration(xpp, RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "offset")) {
        res.setOffset(parseType("offset", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ResearchStudy parseResearchStudy(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchStudy res = new ResearchStudy();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseResearchStudyContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseResearchStudyContent(int eventType, XmlPullParser xpp, ResearchStudy res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocol")) {
        res.getProtocol().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focus")) {
        res.getFocus().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
        res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("keyword")) {
        res.getKeyword().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enrollment")) {
        res.getEnrollment().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sponsor")) {
        res.setSponsor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("principalInvestigator")) {
        res.setPrincipalInvestigator(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
        res.getSite().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonStopped")) {
        res.setReasonStopped(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("arm")) {
        res.getArm().add(parseResearchStudyResearchStudyArmComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(XmlPullParser xpp, ResearchStudy owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseResearchStudyResearchStudyArmComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseResearchStudyResearchStudyArmComponentContent(int eventType, XmlPullParser xpp, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ResearchSubject parseResearchSubject(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchSubject res = new ResearchSubject();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseResearchSubjectContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseResearchSubjectContent(int eventType, XmlPullParser xpp, ResearchSubject res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("study")) {
        res.setStudy(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("individual")) {
        res.setIndividual(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assignedArm")) {
        res.setAssignedArmElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actualArm")) {
        res.setActualArmElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("consent")) {
        res.setConsent(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RiskAssessment parseRiskAssessment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskAssessment res = new RiskAssessment();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRiskAssessmentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskAssessmentContent(int eventType, XmlPullParser xpp, RiskAssessment res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.setBasedOn(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
        res.setParent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
        res.setMethod(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.setCondition(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.setPerformer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reason")) {
        res.setReason(parseType("reason", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basis")) {
        res.getBasis().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prediction")) {
        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mitigation")) {
        res.setMitigationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(XmlPullParser xpp, RiskAssessment owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseRiskAssessmentRiskAssessmentPredictionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskAssessmentRiskAssessmentPredictionComponentContent(int eventType, XmlPullParser xpp, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
        res.setOutcome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "probability")) {
        res.setProbability(parseType("probability", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualitativeRisk")) {
        res.setQualitativeRisk(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relativeRisk")) {
        res.setRelativeRiskElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "when")) {
        res.setWhen(parseType("when", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rationale")) {
        res.setRationaleElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Schedule parseSchedule(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Schedule res = new Schedule();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseScheduleContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseScheduleContent(int eventType, XmlPullParser xpp, Schedule res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
        res.setActiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceCategory")) {
        res.setServiceCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceType")) {
        res.getServiceType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
        res.getSpecialty().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
        res.getActor().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("planningHorizon")) {
        res.setPlanningHorizon(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SearchParameter parseSearchParameter(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SearchParameter res = new SearchParameter();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSearchParameterContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSearchParameterContent(int eventType, XmlPullParser xpp, SearchParameter res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
        res.getBase().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivedFrom")) {
        res.setDerivedFromElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("xpath")) {
        res.setXpathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("xpathUsage")) {
        res.setXpathUsageElement(parseEnumeration(xpp, SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.getTarget().add(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comparator")) {
        res.getComparator().add(parseEnumeration(xpp, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
        res.getModifier().add(parseEnumeration(xpp, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("chain")) {
        res.getChain().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("component")) {
        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(XmlPullParser xpp, SearchParameter owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSearchParameterSearchParameterComponentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSearchParameterSearchParameterComponentComponentContent(int eventType, XmlPullParser xpp, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
        res.setDefinition(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Sequence parseSequence(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Sequence res = new Sequence();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSequenceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSequenceContent(int eventType, XmlPullParser xpp, Sequence res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Sequence.SequenceType.NULL, new Sequence.SequenceTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coordinateSystem")) {
        res.setCoordinateSystemElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specimen")) {
        res.setSpecimen(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
        res.setDevice(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
        res.setPerformer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceSeq")) {
        res.setReferenceSeq(parseSequenceSequenceReferenceSeqComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variant")) {
        res.getVariant().add(parseSequenceSequenceVariantComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observedSeq")) {
        res.setObservedSeqElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quality")) {
        res.getQuality().add(parseSequenceSequenceQualityComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("readCoverage")) {
        res.setReadCoverageElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repository")) {
        res.getRepository().add(parseSequenceSequenceRepositoryComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pointer")) {
        res.getPointer().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Sequence.SequenceReferenceSeqComponent parseSequenceSequenceReferenceSeqComponent(XmlPullParser xpp, Sequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Sequence.SequenceReferenceSeqComponent res = new Sequence.SequenceReferenceSeqComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSequenceSequenceReferenceSeqComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSequenceSequenceReferenceSeqComponentContent(int eventType, XmlPullParser xpp, Sequence owner, Sequence.SequenceReferenceSeqComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("chromosome")) {
        res.setChromosome(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("genomeBuild")) {
        res.setGenomeBuildElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceSeqId")) {
        res.setReferenceSeqId(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceSeqPointer")) {
        res.setReferenceSeqPointer(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceSeqString")) {
        res.setReferenceSeqStringElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strand")) {
        res.setStrandElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("windowStart")) {
        res.setWindowStartElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("windowEnd")) {
        res.setWindowEndElement(parseInteger(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Sequence.SequenceVariantComponent parseSequenceSequenceVariantComponent(XmlPullParser xpp, Sequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Sequence.SequenceVariantComponent res = new Sequence.SequenceVariantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSequenceSequenceVariantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSequenceSequenceVariantComponentContent(int eventType, XmlPullParser xpp, Sequence owner, Sequence.SequenceVariantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStartElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
        res.setEndElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observedAllele")) {
        res.setObservedAlleleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceAllele")) {
        res.setReferenceAlleleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cigar")) {
        res.setCigarElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variantPointer")) {
        res.setVariantPointer(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Sequence.SequenceQualityComponent parseSequenceSequenceQualityComponent(XmlPullParser xpp, Sequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Sequence.SequenceQualityComponent res = new Sequence.SequenceQualityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSequenceSequenceQualityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSequenceSequenceQualityComponentContent(int eventType, XmlPullParser xpp, Sequence owner, Sequence.SequenceQualityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Sequence.QualityType.NULL, new Sequence.QualityTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("standardSequence")) {
        res.setStandardSequence(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStartElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
        res.setEndElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("score")) {
        res.setScore(parseQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
        res.setMethod(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("truthTP")) {
        res.setTruthTPElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("queryTP")) {
        res.setQueryTPElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("truthFN")) {
        res.setTruthFNElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("queryFP")) {
        res.setQueryFPElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gtFP")) {
        res.setGtFPElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precision")) {
        res.setPrecisionElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recall")) {
        res.setRecallElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fScore")) {
        res.setFScoreElement(parseDecimal(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Sequence.SequenceRepositoryComponent parseSequenceSequenceRepositoryComponent(XmlPullParser xpp, Sequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Sequence.SequenceRepositoryComponent res = new Sequence.SequenceRepositoryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSequenceSequenceRepositoryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSequenceSequenceRepositoryComponentContent(int eventType, XmlPullParser xpp, Sequence owner, Sequence.SequenceRepositoryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Sequence.RepositoryType.NULL, new Sequence.RepositoryTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("datasetId")) {
        res.setDatasetIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variantsetId")) {
        res.setVariantsetIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("readsetId")) {
        res.setReadsetIdElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ServiceDefinition parseServiceDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ServiceDefinition res = new ServiceDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseServiceDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseServiceDefinitionContent(int eventType, XmlPullParser xpp, ServiceDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
        res.setUsageElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
        res.setApprovalDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
        res.setLastReviewDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
        res.setEffectivePeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
        res.getTopic().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
        res.getContributor().add(parseContributor(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
        res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("trigger")) {
        res.getTrigger().add(parseTriggerDefinition(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataRequirement")) {
        res.getDataRequirement().add(parseDataRequirement(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operationDefinition")) {
        res.setOperationDefinition(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Slot parseSlot(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Slot res = new Slot();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSlotContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSlotContent(int eventType, XmlPullParser xpp, Slot res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceCategory")) {
        res.setServiceCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceType")) {
        res.getServiceType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
        res.getSpecialty().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appointmentType")) {
        res.setAppointmentType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
        res.setSchedule(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
        res.setStartElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
        res.setEndElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("overbooked")) {
        res.setOverbookedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Specimen parseSpecimen(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Specimen res = new Specimen();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSpecimenContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenContent(int eventType, XmlPullParser xpp, Specimen res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accessionIdentifier")) {
        res.setAccessionIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
        res.setSubject(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("receivedTime")) {
        res.setReceivedTimeElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
        res.getParent().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
        res.getRequest().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collection")) {
        res.setCollection(parseSpecimenSpecimenCollectionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processing")) {
        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("container")) {
        res.getContainer().add(parseSpecimenSpecimenContainerComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(XmlPullParser xpp, Specimen owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSpecimenSpecimenCollectionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenSpecimenCollectionComponentContent(int eventType, XmlPullParser xpp, Specimen owner, Specimen.SpecimenCollectionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collector")) {
        res.setCollector(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "collected")) {
        res.setCollected(parseType("collected", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
        res.setMethod(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
        res.setBodySite(parseCodeableConcept(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(XmlPullParser xpp, Specimen owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSpecimenSpecimenProcessingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenSpecimenProcessingComponentContent(int eventType, XmlPullParser xpp, Specimen owner, Specimen.SpecimenProcessingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
        res.setProcedure(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additive")) {
        res.getAdditive().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "time")) {
        res.setTime(parseType("time", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(XmlPullParser xpp, Specimen owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSpecimenSpecimenContainerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenSpecimenContainerComponentContent(int eventType, XmlPullParser xpp, Specimen owner, Specimen.SpecimenContainerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("capacity")) {
        res.setCapacity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specimenQuantity")) {
        res.setSpecimenQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "additive")) {
        res.setAdditive(parseType("additive", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureDefinition parseStructureDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition res = new StructureDefinition();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionContent(int eventType, XmlPullParser xpp, StructureDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("keyword")) {
        res.getKeyword().add(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirVersion")) {
        res.setFhirVersionElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mapping")) {
        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
        res.setKindElement(parseEnumeration(xpp, StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abstract")) {
        res.setAbstractElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contextType")) {
        res.setContextTypeElement(parseEnumeration(xpp, StructureDefinition.ExtensionContext.NULL, new StructureDefinition.ExtensionContextEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.getContext().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contextInvariant")) {
        res.getContextInvariant().add(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("baseDefinition")) {
        res.setBaseDefinitionElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivation")) {
        res.setDerivationElement(parseEnumeration(xpp, StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("snapshot")) {
        res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("differential")) {
        res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(XmlPullParser xpp, StructureDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureDefinitionStructureDefinitionMappingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionStructureDefinitionMappingComponentContent(int eventType, XmlPullParser xpp, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identity")) {
        res.setIdentityElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
        res.setUriElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
        res.setCommentElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(XmlPullParser xpp, StructureDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureDefinitionStructureDefinitionSnapshotComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionStructureDefinitionSnapshotComponentContent(int eventType, XmlPullParser xpp, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("element")) {
        res.getElement().add(parseElementDefinition(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(XmlPullParser xpp, StructureDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureDefinitionStructureDefinitionDifferentialComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionStructureDefinitionDifferentialComponentContent(int eventType, XmlPullParser xpp, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("element")) {
        res.getElement().add(parseElementDefinition(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap parseStructureMap(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap res = new StructureMap();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapContent(int eventType, XmlPullParser xpp, StructureMap res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("structure")) {
        res.getStructure().add(parseStructureMapStructureMapStructureComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("import")) {
        res.getImport().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
        res.getGroup().add(parseStructureMapStructureMapGroupComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapStructureComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapStructureComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alias")) {
        res.setAliasElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapGroupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapGroupComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extends")) {
        res.setExtendsElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("typeMode")) {
        res.setTypeModeElement(parseEnumeration(xpp, StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("input")) {
        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapGroupInputComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapGroupInputComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
        res.setModeElement(parseEnumeration(xpp, StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapGroupRuleComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapGroupRuleComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependent")) {
        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
        res.setDocumentationElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapGroupRuleSourceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapGroupRuleSourceComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContextElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
        res.setMinElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
        res.setMaxElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "defaultValue")) {
        res.setDefaultValue(parseType("defaultValue", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("element")) {
        res.setElementElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("listMode")) {
        res.setListModeElement(parseEnumeration(xpp, StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variable")) {
        res.setVariableElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
        res.setConditionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("check")) {
        res.setCheckElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapGroupRuleTargetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapGroupRuleTargetComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContextElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contextType")) {
        res.setContextTypeElement(parseEnumeration(xpp, StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("element")) {
        res.setElementElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variable")) {
        res.setVariableElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("listMode")) {
        res.getListMode().add(parseEnumeration(xpp, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("listRuleId")) {
        res.setListRuleIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("transform")) {
        res.setTransformElement(parseEnumeration(xpp, StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapGroupRuleTargetParameterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapGroupRuleTargetParameterComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(XmlPullParser xpp, StructureMap owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseStructureMapStructureMapGroupRuleDependentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapStructureMapGroupRuleDependentComponentContent(int eventType, XmlPullParser xpp, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variable")) {
        res.getVariable().add(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Subscription parseSubscription(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Subscription res = new Subscription();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSubscriptionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubscriptionContent(int eventType, XmlPullParser xpp, Subscription res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactPoint(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
        res.setEndElement(parseInstant(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReasonElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criteria")) {
        res.setCriteriaElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
        res.setErrorElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("channel")) {
        res.setChannel(parseSubscriptionSubscriptionChannelComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tag")) {
        res.getTag().add(parseCoding(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(XmlPullParser xpp, Subscription owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSubscriptionSubscriptionChannelComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubscriptionSubscriptionChannelComponentContent(int eventType, XmlPullParser xpp, Subscription owner, Subscription.SubscriptionChannelComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
        res.setEndpointElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payload")) {
        res.setPayloadElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("header")) {
        res.getHeader().add(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Substance parseSubstance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Substance res = new Substance();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSubstanceContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceContent(int eventType, XmlPullParser xpp, Substance res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.getCategory().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(XmlPullParser xpp, Substance owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSubstanceSubstanceInstanceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSubstanceInstanceComponentContent(int eventType, XmlPullParser xpp, Substance owner, Substance.SubstanceInstanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expiry")) {
        res.setExpiryElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(XmlPullParser xpp, Substance owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSubstanceSubstanceIngredientComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSubstanceIngredientComponentContent(int eventType, XmlPullParser xpp, Substance owner, Substance.SubstanceIngredientComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseRatio(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "substance")) {
        res.setSubstance(parseType("substance", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SupplyDelivery parseSupplyDelivery(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyDelivery res = new SupplyDelivery();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSupplyDeliveryContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyDeliveryContent(int eventType, XmlPullParser xpp, SupplyDelivery res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suppliedItem")) {
        res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplier")) {
        res.setSupplier(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
        res.setDestination(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("receiver")) {
        res.getReceiver().add(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(XmlPullParser xpp, SupplyDelivery owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSupplyDeliverySupplyDeliverySuppliedItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyDeliverySupplyDeliverySuppliedItemComponentContent(int eventType, XmlPullParser xpp, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
        res.setItem(parseType("item", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SupplyRequest parseSupplyRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyRequest res = new SupplyRequest();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSupplyRequestContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyRequestContent(int eventType, XmlPullParser xpp, SupplyRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
        res.setCategory(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderedItem")) {
        res.setOrderedItem(parseSupplyRequestSupplyRequestOrderedItemComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
        res.setOccurrence(parseType("occurrence", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
        res.setRequester(parseSupplyRequestSupplyRequestRequesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplier")) {
        res.getSupplier().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reason")) {
        res.setReason(parseType("reason", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("deliverFrom")) {
        res.setDeliverFrom(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("deliverTo")) {
        res.setDeliverTo(parseReference(xpp));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SupplyRequest.SupplyRequestOrderedItemComponent parseSupplyRequestSupplyRequestOrderedItemComponent(XmlPullParser xpp, SupplyRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyRequest.SupplyRequestOrderedItemComponent res = new SupplyRequest.SupplyRequestOrderedItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSupplyRequestSupplyRequestOrderedItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyRequestSupplyRequestOrderedItemComponentContent(int eventType, XmlPullParser xpp, SupplyRequest owner, SupplyRequest.SupplyRequestOrderedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
        res.setQuantity(parseQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
        res.setItem(parseType("item", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected SupplyRequest.SupplyRequestRequesterComponent parseSupplyRequestSupplyRequestRequesterComponent(XmlPullParser xpp, SupplyRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyRequest.SupplyRequestRequesterComponent res = new SupplyRequest.SupplyRequestRequesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseSupplyRequestSupplyRequestRequesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyRequestSupplyRequestRequesterComponentContent(int eventType, XmlPullParser xpp, SupplyRequest owner, SupplyRequest.SupplyRequestRequesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.setAgent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Task parseTask(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Task res = new Task();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTaskContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTaskContent(int eventType, XmlPullParser xpp, Task res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "definition")) {
        res.setDefinition(parseType("definition", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
        res.getBasedOn().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupIdentifier")) {
        res.setGroupIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
        res.getPartOf().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
        res.setStatusReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("businessStatus")) {
        res.setBusinessStatus(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
        res.setIntentElement(parseEnumeration(xpp, Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
        res.setPriorityElement(parseEnumeration(xpp, Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCode(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focus")) {
        res.setFocus(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("for")) {
        res.setFor(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
        res.setContext(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("executionPeriod")) {
        res.setExecutionPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
        res.setAuthoredOnElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastModified")) {
        res.setLastModifiedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
        res.setRequester(parseTaskTaskRequesterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performerType")) {
        res.getPerformerType().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("owner")) {
        res.setOwner(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
        res.setReason(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relevantHistory")) {
        res.getRelevantHistory().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("restriction")) {
        res.setRestriction(parseTaskTaskRestrictionComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("input")) {
        res.getInput().add(parseTaskParameterComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("output")) {
        res.getOutput().add(parseTaskTaskOutputComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Task.TaskRequesterComponent parseTaskTaskRequesterComponent(XmlPullParser xpp, Task owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Task.TaskRequesterComponent res = new Task.TaskRequesterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTaskTaskRequesterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTaskTaskRequesterComponentContent(int eventType, XmlPullParser xpp, Task owner, Task.TaskRequesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
        res.setAgent(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
        res.setOnBehalfOf(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(XmlPullParser xpp, Task owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTaskTaskRestrictionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTaskTaskRestrictionComponentContent(int eventType, XmlPullParser xpp, Task owner, Task.TaskRestrictionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repetitions")) {
        res.setRepetitionsElement(parsePositiveInt(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
        res.setPeriod(parsePeriod(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
        res.getRecipient().add(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Task.ParameterComponent parseTaskParameterComponent(XmlPullParser xpp, Task owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Task.ParameterComponent res = new Task.ParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTaskParameterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTaskParameterComponentContent(int eventType, XmlPullParser xpp, Task owner, Task.ParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(XmlPullParser xpp, Task owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTaskTaskOutputComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTaskTaskOutputComponentContent(int eventType, XmlPullParser xpp, Task owner, Task.TaskOutputComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport parseTestReport(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport res = new TestReport();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportContent(int eventType, XmlPullParser xpp, TestReport res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("testScript")) {
        res.setTestScript(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("result")) {
        res.setResultElement(parseEnumeration(xpp, TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("score")) {
        res.setScoreElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tester")) {
        res.setTesterElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issued")) {
        res.setIssuedElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
        res.getParticipant().add(parseTestReportTestReportParticipantComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("setup")) {
        res.setSetup(parseTestReportTestReportSetupComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("test")) {
        res.getTest().add(parseTestReportTestReportTestComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("teardown")) {
        res.setTeardown(parseTestReportTestReportTeardownComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportTestReportParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportTestReportParticipantComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.TestReportParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setTypeElement(parseEnumeration(xpp, TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
        res.setUriElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportTestReportSetupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportTestReportSetupComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.TestReportSetupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseTestReportSetupActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportSetupActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportSetupActionComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.SetupActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
        res.setOperation(parseTestReportSetupActionOperationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
        res.setAssert(parseTestReportSetupActionAssertComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportSetupActionOperationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportSetupActionOperationComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.SetupActionOperationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("result")) {
        res.setResultElement(parseEnumeration(xpp, TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("message")) {
        res.setMessageElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.setDetailElement(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportSetupActionAssertComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportSetupActionAssertComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.SetupActionAssertComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("result")) {
        res.setResultElement(parseEnumeration(xpp, TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("message")) {
        res.setMessageElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
        res.setDetailElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportTestReportTestComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportTestReportTestComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.TestReportTestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseTestReportTestActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.TestActionComponent parseTestReportTestActionComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportTestActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportTestActionComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.TestActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
        res.setOperation(parseTestReportSetupActionOperationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
        res.setAssert(parseTestReportSetupActionAssertComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportTestReportTeardownComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportTestReportTeardownComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.TestReportTeardownComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseTestReportTeardownActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(XmlPullParser xpp, TestReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestReportTeardownActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportTeardownActionComponentContent(int eventType, XmlPullParser xpp, TestReport owner, TestReport.TeardownActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
        res.setOperation(parseTestReportSetupActionOperationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript parseTestScript(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript res = new TestScript();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptContent(int eventType, XmlPullParser xpp, TestScript res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifier(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("origin")) {
        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("metadata")) {
        res.setMetadata(parseTestScriptTestScriptMetadataComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fixture")) {
        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.getProfile().add(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variable")) {
        res.getVariable().add(parseTestScriptTestScriptVariableComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.getRule().add(parseTestScriptTestScriptRuleComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ruleset")) {
        res.getRuleset().add(parseTestScriptTestScriptRulesetComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("setup")) {
        res.setSetup(parseTestScriptTestScriptSetupComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("test")) {
        res.getTest().add(parseTestScriptTestScriptTestComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("teardown")) {
        res.setTeardown(parseTestScriptTestScriptTeardownComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptOriginComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptOriginComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptOriginComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("index")) {
        res.setIndexElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseCoding(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptDestinationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptDestinationComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptDestinationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("index")) {
        res.setIndexElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
        res.setProfile(parseCoding(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptMetadataComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptMetadataComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptMetadataComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("capability")) {
        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptMetadataLinkComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptMetadataLinkComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptMetadataCapabilityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptMetadataCapabilityComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("required")) {
        res.setRequiredElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validated")) {
        res.setValidatedElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("origin")) {
        res.getOrigin().add(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
        res.setDestinationElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
        res.getLink().add(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("capabilities")) {
        res.setCapabilities(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptFixtureComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptFixtureComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptFixtureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("autocreate")) {
        res.setAutocreateElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("autodelete")) {
        res.setAutodeleteElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseReference(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptVariableComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptVariableComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptVariableComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("defaultValue")) {
        res.setDefaultValueElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("headerField")) {
        res.setHeaderFieldElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hint")) {
        res.setHintElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceId")) {
        res.setSourceIdElement(parseId(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptRuleComponent parseTestScriptTestScriptRuleComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptRuleComponent res = new TestScript.TestScriptRuleComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptRuleComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptRuleComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptRuleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("param")) {
        res.getParam().add(parseTestScriptRuleParamComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.RuleParamComponent parseTestScriptRuleParamComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.RuleParamComponent res = new TestScript.RuleParamComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptRuleParamComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptRuleParamComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.RuleParamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptRulesetComponent parseTestScriptTestScriptRulesetComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptRulesetComponent res = new TestScript.TestScriptRulesetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptRulesetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptRulesetComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptRulesetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResource(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.getRule().add(parseTestScriptRulesetRuleComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.RulesetRuleComponent parseTestScriptRulesetRuleComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.RulesetRuleComponent res = new TestScript.RulesetRuleComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptRulesetRuleComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptRulesetRuleComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.RulesetRuleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ruleId")) {
        res.setRuleIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("param")) {
        res.getParam().add(parseTestScriptRulesetRuleParamComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.RulesetRuleParamComponent parseTestScriptRulesetRuleParamComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.RulesetRuleParamComponent res = new TestScript.RulesetRuleParamComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptRulesetRuleParamComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptRulesetRuleParamComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.RulesetRuleParamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptSetupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptSetupComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptSetupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseTestScriptSetupActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptSetupActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptSetupActionComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.SetupActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
        res.setOperation(parseTestScriptSetupActionOperationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
        res.setAssert(parseTestScriptSetupActionAssertComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptSetupActionOperationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptSetupActionOperationComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.SetupActionOperationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
        res.setType(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResourceElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
        res.setLabelElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accept")) {
        res.setAcceptElement(parseEnumeration(xpp, TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
        res.setContentTypeElement(parseEnumeration(xpp, TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
        res.setDestinationElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encodeRequestUrl")) {
        res.setEncodeRequestUrlElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("origin")) {
        res.setOriginElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("params")) {
        res.setParamsElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestHeader")) {
        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestId")) {
        res.setRequestIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responseId")) {
        res.setResponseIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceId")) {
        res.setSourceIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetId")) {
        res.setTargetIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptSetupActionOperationRequestHeaderComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptSetupActionOperationRequestHeaderComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("field")) {
        res.setFieldElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptSetupActionAssertComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptSetupActionAssertComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.SetupActionAssertComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
        res.setLabelElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("direction")) {
        res.setDirectionElement(parseEnumeration(xpp, TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compareToSourceId")) {
        res.setCompareToSourceIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compareToSourceExpression")) {
        res.setCompareToSourceExpressionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compareToSourcePath")) {
        res.setCompareToSourcePathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
        res.setContentTypeElement(parseEnumeration(xpp, TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
        res.setExpressionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("headerField")) {
        res.setHeaderFieldElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("minimumId")) {
        res.setMinimumIdElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("navigationLinks")) {
        res.setNavigationLinksElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operator")) {
        res.setOperatorElement(parseEnumeration(xpp, TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
        res.setPathElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestMethod")) {
        res.setRequestMethodElement(parseEnumeration(xpp, TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestURL")) {
        res.setRequestURLElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
        res.setResourceElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
        res.setResponseElement(parseEnumeration(xpp, TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responseCode")) {
        res.setResponseCodeElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.setRule(parseTestScriptActionAssertRuleComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ruleset")) {
        res.setRuleset(parseTestScriptActionAssertRulesetComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceId")) {
        res.setSourceIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validateProfileId")) {
        res.setValidateProfileIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("warningOnly")) {
        res.setWarningOnlyElement(parseBoolean(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.ActionAssertRuleComponent parseTestScriptActionAssertRuleComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.ActionAssertRuleComponent res = new TestScript.ActionAssertRuleComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptActionAssertRuleComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptActionAssertRuleComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.ActionAssertRuleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ruleId")) {
        res.setRuleIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("param")) {
        res.getParam().add(parseTestScriptActionAssertRuleParamComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.ActionAssertRuleParamComponent parseTestScriptActionAssertRuleParamComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.ActionAssertRuleParamComponent res = new TestScript.ActionAssertRuleParamComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptActionAssertRuleParamComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptActionAssertRuleParamComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.ActionAssertRuleParamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.ActionAssertRulesetComponent parseTestScriptActionAssertRulesetComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.ActionAssertRulesetComponent res = new TestScript.ActionAssertRulesetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptActionAssertRulesetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptActionAssertRulesetComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.ActionAssertRulesetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rulesetId")) {
        res.setRulesetIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
        res.getRule().add(parseTestScriptActionAssertRulesetRuleComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.ActionAssertRulesetRuleComponent parseTestScriptActionAssertRulesetRuleComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.ActionAssertRulesetRuleComponent res = new TestScript.ActionAssertRulesetRuleComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptActionAssertRulesetRuleComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptActionAssertRulesetRuleComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.ActionAssertRulesetRuleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ruleId")) {
        res.setRuleIdElement(parseId(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("param")) {
        res.getParam().add(parseTestScriptActionAssertRulesetRuleParamComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.ActionAssertRulesetRuleParamComponent parseTestScriptActionAssertRulesetRuleParamComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.ActionAssertRulesetRuleParamComponent res = new TestScript.ActionAssertRulesetRuleParamComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptActionAssertRulesetRuleParamComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptActionAssertRulesetRuleParamComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.ActionAssertRulesetRuleParamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptTestComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptTestComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptTestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseTestScriptTestActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestActionComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
        res.setOperation(parseTestScriptSetupActionOperationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
        res.setAssert(parseTestScriptSetupActionAssertComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTestScriptTeardownComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestScriptTeardownComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TestScriptTeardownComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
        res.getAction().add(parseTestScriptTeardownActionComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(XmlPullParser xpp, TestScript owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseTestScriptTeardownActionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTeardownActionComponentContent(int eventType, XmlPullParser xpp, TestScript owner, TestScript.TeardownActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
        res.setOperation(parseTestScriptSetupActionOperationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet parseValueSet(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet res = new ValueSet();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetContent(int eventType, XmlPullParser xpp, ValueSet res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
        res.setUrlElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
        res.setTitleElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
        res.setExperimentalElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
        res.setDateElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
        res.setPublisherElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
        res.getContact().add(parseContactDetail(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
        res.setDescriptionElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
        res.getUseContext().add(parseUsageContext(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
        res.getJurisdiction().add(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("immutable")) {
        res.setImmutableElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
        res.setPurposeElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
        res.setCopyrightElement(parseMarkdown(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extensible")) {
        res.setExtensibleElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compose")) {
        res.setCompose(parseValueSetValueSetComposeComponent(xpp, res));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expansion")) {
        res.setExpansion(parseValueSetValueSetExpansionComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetValueSetComposeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetValueSetComposeComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lockedDate")) {
        res.setLockedDateElement(parseDate(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inactive")) {
        res.setInactiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("include")) {
        res.getInclude().add(parseValueSetConceptSetComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
        res.getExclude().add(parseValueSetConceptSetComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetConceptSetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetConceptSetComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ConceptSetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
        res.getConcept().add(parseValueSetConceptReferenceComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("filter")) {
        res.getFilter().add(parseValueSetConceptSetFilterComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
        res.getValueSet().add(parseUri(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetConceptReferenceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetConceptReferenceComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("designation")) {
        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetConceptReferenceDesignationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetConceptReferenceDesignationComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
        res.setLanguageElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
        res.setUse(parseCoding(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseString(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetConceptSetFilterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetConceptSetFilterComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
        res.setPropertyElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("op")) {
        res.setOpElement(parseEnumeration(xpp, ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
        res.setValueElement(parseCode(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetValueSetExpansionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetValueSetExpansionComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.setIdentifierElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timestamp")) {
        res.setTimestampElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
        res.setTotalElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("offset")) {
        res.setOffsetElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contains")) {
        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetValueSetExpansionParameterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetValueSetExpansionParameterComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
        res.setNameElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
        res.setValue(parseType("value", xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(XmlPullParser xpp, ValueSet owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseValueSetValueSetExpansionContainsComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetValueSetExpansionContainsComponentContent(int eventType, XmlPullParser xpp, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
        res.setSystemElement(parseUri(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abstract")) {
        res.setAbstractElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inactive")) {
        res.setInactiveElement(parseBoolean(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
        res.setVersionElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
        res.setCodeElement(parseCode(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
        res.setDisplayElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("designation")) {
        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(xpp, owner));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contains")) {
        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(xpp, owner));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected VisionPrescription parseVisionPrescription(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    VisionPrescription res = new VisionPrescription();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseVisionPrescriptionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVisionPrescriptionContent(int eventType, XmlPullParser xpp, VisionPrescription res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
        res.getIdentifier().add(parseIdentifier(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
        res.setStatusElement(parseEnumeration(xpp, VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
        res.setPatient(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
        res.setEncounter(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateWritten")) {
        res.setDateWrittenElement(parseDateTime(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prescriber")) {
        res.setPrescriber(parseReference(xpp));
      } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reason")) {
        res.setReason(parseType("reason", xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dispense")) {
        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(xpp, res));
      } else if (!parseDomainResourceContent(eventType, xpp, res))
        return false;
    return true;
  }

  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(XmlPullParser xpp, VisionPrescription owner) throws XmlPullParserException, IOException, FHIRFormatError {
    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
  if (!parseVisionPrescriptionVisionPrescriptionDispenseComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVisionPrescriptionVisionPrescriptionDispenseComponentContent(int eventType, XmlPullParser xpp, VisionPrescription owner, VisionPrescription.VisionPrescriptionDispenseComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
      if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("product")) {
        res.setProduct(parseCodeableConcept(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eye")) {
        res.setEyeElement(parseEnumeration(xpp, VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sphere")) {
        res.setSphereElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cylinder")) {
        res.setCylinderElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("axis")) {
        res.setAxisElement(parseInteger(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prism")) {
        res.setPrismElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
        res.setBaseElement(parseEnumeration(xpp, VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("add")) {
        res.setAddElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("power")) {
        res.setPowerElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("backCurve")) {
        res.setBackCurveElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diameter")) {
        res.setDiameterElement(parseDecimal(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
        res.setDuration(parseSimpleQuantity(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("color")) {
        res.setColorElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("brand")) {
        res.setBrandElement(parseString(xpp));
      } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
        res.getNote().add(parseAnnotation(xpp));
      } else if (!parseBackboneContent(eventType, xpp, res))
        return false;
    return true;
  }

  @Override
  protected Resource parseResource(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    if (xpp.getName().equals("Parameters"))
      return parseParameters(xpp);
    else if (xpp.getName().equals("Account"))
      return parseAccount(xpp);
    else if (xpp.getName().equals("ActivityDefinition"))
      return parseActivityDefinition(xpp);
    else if (xpp.getName().equals("AdverseEvent"))
      return parseAdverseEvent(xpp);
    else if (xpp.getName().equals("AllergyIntolerance"))
      return parseAllergyIntolerance(xpp);
    else if (xpp.getName().equals("Appointment"))
      return parseAppointment(xpp);
    else if (xpp.getName().equals("AppointmentResponse"))
      return parseAppointmentResponse(xpp);
    else if (xpp.getName().equals("AuditEvent"))
      return parseAuditEvent(xpp);
    else if (xpp.getName().equals("Basic"))
      return parseBasic(xpp);
    else if (xpp.getName().equals("Binary"))
      return parseBinary(xpp);
    else if (xpp.getName().equals("BodySite"))
      return parseBodySite(xpp);
    else if (xpp.getName().equals("Bundle"))
      return parseBundle(xpp);
    else if (xpp.getName().equals("CapabilityStatement"))
      return parseCapabilityStatement(xpp);
    else if (xpp.getName().equals("CarePlan"))
      return parseCarePlan(xpp);
    else if (xpp.getName().equals("CareTeam"))
      return parseCareTeam(xpp);
    else if (xpp.getName().equals("ChargeItem"))
      return parseChargeItem(xpp);
    else if (xpp.getName().equals("Claim"))
      return parseClaim(xpp);
    else if (xpp.getName().equals("ClaimResponse"))
      return parseClaimResponse(xpp);
    else if (xpp.getName().equals("ClinicalImpression"))
      return parseClinicalImpression(xpp);
    else if (xpp.getName().equals("CodeSystem"))
      return parseCodeSystem(xpp);
    else if (xpp.getName().equals("Communication"))
      return parseCommunication(xpp);
    else if (xpp.getName().equals("CommunicationRequest"))
      return parseCommunicationRequest(xpp);
    else if (xpp.getName().equals("CompartmentDefinition"))
      return parseCompartmentDefinition(xpp);
    else if (xpp.getName().equals("Composition"))
      return parseComposition(xpp);
    else if (xpp.getName().equals("ConceptMap"))
      return parseConceptMap(xpp);
    else if (xpp.getName().equals("Condition"))
      return parseCondition(xpp);
    else if (xpp.getName().equals("Consent"))
      return parseConsent(xpp);
    else if (xpp.getName().equals("Contract"))
      return parseContract(xpp);
    else if (xpp.getName().equals("Coverage"))
      return parseCoverage(xpp);
    else if (xpp.getName().equals("DataElement"))
      return parseDataElement(xpp);
    else if (xpp.getName().equals("DetectedIssue"))
      return parseDetectedIssue(xpp);
    else if (xpp.getName().equals("Device"))
      return parseDevice(xpp);
    else if (xpp.getName().equals("DeviceComponent"))
      return parseDeviceComponent(xpp);
    else if (xpp.getName().equals("DeviceMetric"))
      return parseDeviceMetric(xpp);
    else if (xpp.getName().equals("DeviceRequest"))
      return parseDeviceRequest(xpp);
    else if (xpp.getName().equals("DeviceUseStatement"))
      return parseDeviceUseStatement(xpp);
    else if (xpp.getName().equals("DiagnosticReport"))
      return parseDiagnosticReport(xpp);
    else if (xpp.getName().equals("DocumentManifest"))
      return parseDocumentManifest(xpp);
    else if (xpp.getName().equals("DocumentReference"))
      return parseDocumentReference(xpp);
    else if (xpp.getName().equals("EligibilityRequest"))
      return parseEligibilityRequest(xpp);
    else if (xpp.getName().equals("EligibilityResponse"))
      return parseEligibilityResponse(xpp);
    else if (xpp.getName().equals("Encounter"))
      return parseEncounter(xpp);
    else if (xpp.getName().equals("Endpoint"))
      return parseEndpoint(xpp);
    else if (xpp.getName().equals("EnrollmentRequest"))
      return parseEnrollmentRequest(xpp);
    else if (xpp.getName().equals("EnrollmentResponse"))
      return parseEnrollmentResponse(xpp);
    else if (xpp.getName().equals("EpisodeOfCare"))
      return parseEpisodeOfCare(xpp);
    else if (xpp.getName().equals("ExpansionProfile"))
      return parseExpansionProfile(xpp);
    else if (xpp.getName().equals("ExplanationOfBenefit"))
      return parseExplanationOfBenefit(xpp);
    else if (xpp.getName().equals("FamilyMemberHistory"))
      return parseFamilyMemberHistory(xpp);
    else if (xpp.getName().equals("Flag"))
      return parseFlag(xpp);
    else if (xpp.getName().equals("Goal"))
      return parseGoal(xpp);
    else if (xpp.getName().equals("GraphDefinition"))
      return parseGraphDefinition(xpp);
    else if (xpp.getName().equals("Group"))
      return parseGroup(xpp);
    else if (xpp.getName().equals("GuidanceResponse"))
      return parseGuidanceResponse(xpp);
    else if (xpp.getName().equals("HealthcareService"))
      return parseHealthcareService(xpp);
    else if (xpp.getName().equals("ImagingManifest"))
      return parseImagingManifest(xpp);
    else if (xpp.getName().equals("ImagingStudy"))
      return parseImagingStudy(xpp);
    else if (xpp.getName().equals("Immunization"))
      return parseImmunization(xpp);
    else if (xpp.getName().equals("ImmunizationRecommendation"))
      return parseImmunizationRecommendation(xpp);
    else if (xpp.getName().equals("ImplementationGuide"))
      return parseImplementationGuide(xpp);
    else if (xpp.getName().equals("Library"))
      return parseLibrary(xpp);
    else if (xpp.getName().equals("Linkage"))
      return parseLinkage(xpp);
    else if (xpp.getName().equals("List"))
      return parseListResource(xpp);
    else if (xpp.getName().equals("Location"))
      return parseLocation(xpp);
    else if (xpp.getName().equals("Measure"))
      return parseMeasure(xpp);
    else if (xpp.getName().equals("MeasureReport"))
      return parseMeasureReport(xpp);
    else if (xpp.getName().equals("Media"))
      return parseMedia(xpp);
    else if (xpp.getName().equals("Medication"))
      return parseMedication(xpp);
    else if (xpp.getName().equals("MedicationAdministration"))
      return parseMedicationAdministration(xpp);
    else if (xpp.getName().equals("MedicationDispense"))
      return parseMedicationDispense(xpp);
    else if (xpp.getName().equals("MedicationRequest"))
      return parseMedicationRequest(xpp);
    else if (xpp.getName().equals("MedicationStatement"))
      return parseMedicationStatement(xpp);
    else if (xpp.getName().equals("MessageDefinition"))
      return parseMessageDefinition(xpp);
    else if (xpp.getName().equals("MessageHeader"))
      return parseMessageHeader(xpp);
    else if (xpp.getName().equals("NamingSystem"))
      return parseNamingSystem(xpp);
    else if (xpp.getName().equals("NutritionOrder"))
      return parseNutritionOrder(xpp);
    else if (xpp.getName().equals("Observation"))
      return parseObservation(xpp);
    else if (xpp.getName().equals("OperationDefinition"))
      return parseOperationDefinition(xpp);
    else if (xpp.getName().equals("OperationOutcome"))
      return parseOperationOutcome(xpp);
    else if (xpp.getName().equals("Organization"))
      return parseOrganization(xpp);
    else if (xpp.getName().equals("Patient"))
      return parsePatient(xpp);
    else if (xpp.getName().equals("PaymentNotice"))
      return parsePaymentNotice(xpp);
    else if (xpp.getName().equals("PaymentReconciliation"))
      return parsePaymentReconciliation(xpp);
    else if (xpp.getName().equals("Person"))
      return parsePerson(xpp);
    else if (xpp.getName().equals("PlanDefinition"))
      return parsePlanDefinition(xpp);
    else if (xpp.getName().equals("Practitioner"))
      return parsePractitioner(xpp);
    else if (xpp.getName().equals("PractitionerRole"))
      return parsePractitionerRole(xpp);
    else if (xpp.getName().equals("Procedure"))
      return parseProcedure(xpp);
    else if (xpp.getName().equals("ProcedureRequest"))
      return parseProcedureRequest(xpp);
    else if (xpp.getName().equals("ProcessRequest"))
      return parseProcessRequest(xpp);
    else if (xpp.getName().equals("ProcessResponse"))
      return parseProcessResponse(xpp);
    else if (xpp.getName().equals("Provenance"))
      return parseProvenance(xpp);
    else if (xpp.getName().equals("Questionnaire"))
      return parseQuestionnaire(xpp);
    else if (xpp.getName().equals("QuestionnaireResponse"))
      return parseQuestionnaireResponse(xpp);
    else if (xpp.getName().equals("ReferralRequest"))
      return parseReferralRequest(xpp);
    else if (xpp.getName().equals("RelatedPerson"))
      return parseRelatedPerson(xpp);
    else if (xpp.getName().equals("RequestGroup"))
      return parseRequestGroup(xpp);
    else if (xpp.getName().equals("ResearchStudy"))
      return parseResearchStudy(xpp);
    else if (xpp.getName().equals("ResearchSubject"))
      return parseResearchSubject(xpp);
    else if (xpp.getName().equals("RiskAssessment"))
      return parseRiskAssessment(xpp);
    else if (xpp.getName().equals("Schedule"))
      return parseSchedule(xpp);
    else if (xpp.getName().equals("SearchParameter"))
      return parseSearchParameter(xpp);
    else if (xpp.getName().equals("Sequence"))
      return parseSequence(xpp);
    else if (xpp.getName().equals("ServiceDefinition"))
      return parseServiceDefinition(xpp);
    else if (xpp.getName().equals("Slot"))
      return parseSlot(xpp);
    else if (xpp.getName().equals("Specimen"))
      return parseSpecimen(xpp);
    else if (xpp.getName().equals("StructureDefinition"))
      return parseStructureDefinition(xpp);
    else if (xpp.getName().equals("StructureMap"))
      return parseStructureMap(xpp);
    else if (xpp.getName().equals("Subscription"))
      return parseSubscription(xpp);
    else if (xpp.getName().equals("Substance"))
      return parseSubstance(xpp);
    else if (xpp.getName().equals("SupplyDelivery"))
      return parseSupplyDelivery(xpp);
    else if (xpp.getName().equals("SupplyRequest"))
      return parseSupplyRequest(xpp);
    else if (xpp.getName().equals("Task"))
      return parseTask(xpp);
    else if (xpp.getName().equals("TestReport"))
      return parseTestReport(xpp);
    else if (xpp.getName().equals("TestScript"))
      return parseTestScript(xpp);
    else if (xpp.getName().equals("ValueSet"))
      return parseValueSet(xpp);
    else if (xpp.getName().equals("VisionPrescription"))
      return parseVisionPrescription(xpp);
    else if (xpp.getName().equals("Binary"))
      return parseBinary(xpp);
    throw new FHIRFormatError("Unknown resource type "+xpp.getName()+"");
  }

  protected Type parseType(String prefix, XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    if (xpp.getName().equals(prefix+"date"))
      return parseDate(xpp);
    else if (xpp.getName().equals(prefix+"dateTime"))
      return parseDateTime(xpp);
    else if (xpp.getName().equals(prefix+"code"))
      return parseCode(xpp);
    else if (xpp.getName().equals(prefix+"string"))
      return parseString(xpp);
    else if (xpp.getName().equals(prefix+"integer"))
      return parseInteger(xpp);
    else if (xpp.getName().equals(prefix+"oid"))
      return parseOid(xpp);
    else if (xpp.getName().equals(prefix+"uri"))
      return parseUri(xpp);
    else if (xpp.getName().equals(prefix+"uuid"))
      return parseUuid(xpp);
    else if (xpp.getName().equals(prefix+"instant"))
      return parseInstant(xpp);
    else if (xpp.getName().equals(prefix+"boolean"))
      return parseBoolean(xpp);
    else if (xpp.getName().equals(prefix+"base64Binary"))
      return parseBase64Binary(xpp);
    else if (xpp.getName().equals(prefix+"unsignedInt"))
      return parseUnsignedInt(xpp);
    else if (xpp.getName().equals(prefix+"markdown"))
      return parseMarkdown(xpp);
    else if (xpp.getName().equals(prefix+"time"))
      return parseTime(xpp);
    else if (xpp.getName().equals(prefix+"id"))
      return parseId(xpp);
    else if (xpp.getName().equals(prefix+"positiveInt"))
      return parsePositiveInt(xpp);
    else if (xpp.getName().equals(prefix+"decimal"))
      return parseDecimal(xpp);
    else if (xpp.getName().equals(prefix+"Extension"))
      return parseExtension(xpp);
    else if (xpp.getName().equals(prefix+"Narrative"))
      return parseNarrative(xpp);
    else if (xpp.getName().equals(prefix+"Reference"))
      return parseReference(xpp);
    else if (xpp.getName().equals(prefix+"Quantity"))
      return parseQuantity(xpp);
    else if (xpp.getName().equals(prefix+"Period"))
      return parsePeriod(xpp);
    else if (xpp.getName().equals(prefix+"Attachment"))
      return parseAttachment(xpp);
    else if (xpp.getName().equals(prefix+"Duration"))
      return parseDuration(xpp);
    else if (xpp.getName().equals(prefix+"Count"))
      return parseCount(xpp);
    else if (xpp.getName().equals(prefix+"Range"))
      return parseRange(xpp);
    else if (xpp.getName().equals(prefix+"Annotation"))
      return parseAnnotation(xpp);
    else if (xpp.getName().equals(prefix+"Money"))
      return parseMoney(xpp);
    else if (xpp.getName().equals(prefix+"Identifier"))
      return parseIdentifier(xpp);
    else if (xpp.getName().equals(prefix+"Coding"))
      return parseCoding(xpp);
    else if (xpp.getName().equals(prefix+"Signature"))
      return parseSignature(xpp);
    else if (xpp.getName().equals(prefix+"SampledData"))
      return parseSampledData(xpp);
    else if (xpp.getName().equals(prefix+"Ratio"))
      return parseRatio(xpp);
    else if (xpp.getName().equals(prefix+"Distance"))
      return parseDistance(xpp);
    else if (xpp.getName().equals(prefix+"Age"))
      return parseAge(xpp);
    else if (xpp.getName().equals(prefix+"CodeableConcept"))
      return parseCodeableConcept(xpp);
    else if (xpp.getName().equals(prefix+"SimpleQuantity"))
      return parseSimpleQuantity(xpp);
    else if (xpp.getName().equals(prefix+"Meta"))
      return parseMeta(xpp);
    else if (xpp.getName().equals(prefix+"Address"))
      return parseAddress(xpp);
    else if (xpp.getName().equals(prefix+"TriggerDefinition"))
      return parseTriggerDefinition(xpp);
    else if (xpp.getName().equals(prefix+"Contributor"))
      return parseContributor(xpp);
    else if (xpp.getName().equals(prefix+"DataRequirement"))
      return parseDataRequirement(xpp);
    else if (xpp.getName().equals(prefix+"Dosage"))
      return parseDosage(xpp);
    else if (xpp.getName().equals(prefix+"RelatedArtifact"))
      return parseRelatedArtifact(xpp);
    else if (xpp.getName().equals(prefix+"ContactDetail"))
      return parseContactDetail(xpp);
    else if (xpp.getName().equals(prefix+"HumanName"))
      return parseHumanName(xpp);
    else if (xpp.getName().equals(prefix+"ContactPoint"))
      return parseContactPoint(xpp);
    else if (xpp.getName().equals(prefix+"UsageContext"))
      return parseUsageContext(xpp);
    else if (xpp.getName().equals(prefix+"Timing"))
      return parseTiming(xpp);
    else if (xpp.getName().equals(prefix+"ElementDefinition"))
      return parseElementDefinition(xpp);
    else if (xpp.getName().equals(prefix+"ParameterDefinition"))
      return parseParameterDefinition(xpp);
    else if (xpp.getName().equals(prefix+"Date"))
      return parseDate(xpp);
    else if (xpp.getName().equals(prefix+"DateTime"))
      return parseDateTime(xpp);
    else if (xpp.getName().equals(prefix+"Code"))
      return parseCode(xpp);
    else if (xpp.getName().equals(prefix+"String"))
      return parseString(xpp);
    else if (xpp.getName().equals(prefix+"Integer"))
      return parseInteger(xpp);
    else if (xpp.getName().equals(prefix+"Oid"))
      return parseOid(xpp);
    else if (xpp.getName().equals(prefix+"Uri"))
      return parseUri(xpp);
    else if (xpp.getName().equals(prefix+"Uuid"))
      return parseUuid(xpp);
    else if (xpp.getName().equals(prefix+"Instant"))
      return parseInstant(xpp);
    else if (xpp.getName().equals(prefix+"Boolean"))
      return parseBoolean(xpp);
    else if (xpp.getName().equals(prefix+"Base64Binary"))
      return parseBase64Binary(xpp);
    else if (xpp.getName().equals(prefix+"UnsignedInt"))
      return parseUnsignedInt(xpp);
    else if (xpp.getName().equals(prefix+"Markdown"))
      return parseMarkdown(xpp);
    else if (xpp.getName().equals(prefix+"Time"))
      return parseTime(xpp);
    else if (xpp.getName().equals(prefix+"Id"))
      return parseId(xpp);
    else if (xpp.getName().equals(prefix+"PositiveInt"))
      return parsePositiveInt(xpp);
    else if (xpp.getName().equals(prefix+"Decimal"))
      return parseDecimal(xpp);
    throw new FHIRFormatError("Unknown type "+xpp.getName());
  }

  protected Type parseType(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
    if (type.equals("date"))
      return parseDate(xpp);
    else if (type.equals("dateTime"))
      return parseDateTime(xpp);
    else if (type.equals("code"))
      return parseCode(xpp);
    else if (type.equals("string"))
      return parseString(xpp);
    else if (type.equals("integer"))
      return parseInteger(xpp);
    else if (type.equals("oid"))
      return parseOid(xpp);
    else if (type.equals("uri"))
      return parseUri(xpp);
    else if (type.equals("uuid"))
      return parseUuid(xpp);
    else if (type.equals("instant"))
      return parseInstant(xpp);
    else if (type.equals("boolean"))
      return parseBoolean(xpp);
    else if (type.equals("base64Binary"))
      return parseBase64Binary(xpp);
    else if (type.equals("unsignedInt"))
      return parseUnsignedInt(xpp);
    else if (type.equals("markdown"))
      return parseMarkdown(xpp);
    else if (type.equals("time"))
      return parseTime(xpp);
    else if (type.equals("id"))
      return parseId(xpp);
    else if (type.equals("positiveInt"))
      return parsePositiveInt(xpp);
    else if (type.equals("decimal"))
      return parseDecimal(xpp);
    else if (type.equals("Extension"))
      return parseExtension(xpp);
    else if (type.equals("Narrative"))
      return parseNarrative(xpp);
    else if (type.equals("Reference"))
      return parseReference(xpp);
    else if (type.equals("Quantity"))
      return parseQuantity(xpp);
    else if (type.equals("Period"))
      return parsePeriod(xpp);
    else if (type.equals("Attachment"))
      return parseAttachment(xpp);
    else if (type.equals("Duration"))
      return parseDuration(xpp);
    else if (type.equals("Count"))
      return parseCount(xpp);
    else if (type.equals("Range"))
      return parseRange(xpp);
    else if (type.equals("Annotation"))
      return parseAnnotation(xpp);
    else if (type.equals("Money"))
      return parseMoney(xpp);
    else if (type.equals("Identifier"))
      return parseIdentifier(xpp);
    else if (type.equals("Coding"))
      return parseCoding(xpp);
    else if (type.equals("Signature"))
      return parseSignature(xpp);
    else if (type.equals("SampledData"))
      return parseSampledData(xpp);
    else if (type.equals("Ratio"))
      return parseRatio(xpp);
    else if (type.equals("Distance"))
      return parseDistance(xpp);
    else if (type.equals("Age"))
      return parseAge(xpp);
    else if (type.equals("CodeableConcept"))
      return parseCodeableConcept(xpp);
    else if (type.equals("SimpleQuantity"))
      return parseSimpleQuantity(xpp);
    else if (type.equals("Meta"))
      return parseMeta(xpp);
    else if (type.equals("Address"))
      return parseAddress(xpp);
    else if (type.equals("TriggerDefinition"))
      return parseTriggerDefinition(xpp);
    else if (type.equals("Contributor"))
      return parseContributor(xpp);
    else if (type.equals("DataRequirement"))
      return parseDataRequirement(xpp);
    else if (type.equals("Dosage"))
      return parseDosage(xpp);
    else if (type.equals("RelatedArtifact"))
      return parseRelatedArtifact(xpp);
    else if (type.equals("ContactDetail"))
      return parseContactDetail(xpp);
    else if (type.equals("HumanName"))
      return parseHumanName(xpp);
    else if (type.equals("ContactPoint"))
      return parseContactPoint(xpp);
    else if (type.equals("UsageContext"))
      return parseUsageContext(xpp);
    else if (type.equals("Timing"))
      return parseTiming(xpp);
    else if (type.equals("ElementDefinition"))
      return parseElementDefinition(xpp);
    else if (type.equals("ParameterDefinition"))
      return parseParameterDefinition(xpp);
    throw new FHIRFormatError("Unknown type "+type);
  }

  public Base parseFragment(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
    if (type.equals("Extension"))
      return parseExtension(xpp);
    else if (type.equals("Narrative"))
      return parseNarrative(xpp);
    else if (type.equals("Reference"))
      return parseReference(xpp);
    else if (type.equals("Quantity"))
      return parseQuantity(xpp);
    else if (type.equals("Period"))
      return parsePeriod(xpp);
    else if (type.equals("Attachment"))
      return parseAttachment(xpp);
    else if (type.equals("Duration"))
      return parseDuration(xpp);
    else if (type.equals("Count"))
      return parseCount(xpp);
    else if (type.equals("Range"))
      return parseRange(xpp);
    else if (type.equals("Annotation"))
      return parseAnnotation(xpp);
    else if (type.equals("Money"))
      return parseMoney(xpp);
    else if (type.equals("Identifier"))
      return parseIdentifier(xpp);
    else if (type.equals("Coding"))
      return parseCoding(xpp);
    else if (type.equals("Signature"))
      return parseSignature(xpp);
    else if (type.equals("SampledData"))
      return parseSampledData(xpp);
    else if (type.equals("Ratio"))
      return parseRatio(xpp);
    else if (type.equals("Distance"))
      return parseDistance(xpp);
    else if (type.equals("Age"))
      return parseAge(xpp);
    else if (type.equals("CodeableConcept"))
      return parseCodeableConcept(xpp);
    else if (type.equals("SimpleQuantity"))
      return parseSimpleQuantity(xpp);
    else if (type.equals("Meta"))
      return parseMeta(xpp);
    else if (type.equals("Address"))
      return parseAddress(xpp);
    else if (type.equals("TriggerDefinition"))
      return parseTriggerDefinition(xpp);
    else if (type.equals("Contributor"))
      return parseContributor(xpp);
    else if (type.equals("DataRequirement"))
      return parseDataRequirement(xpp);
    else if (type.equals("Dosage"))
      return parseDosage(xpp);
    else if (type.equals("RelatedArtifact"))
      return parseRelatedArtifact(xpp);
    else if (type.equals("ContactDetail"))
      return parseContactDetail(xpp);
    else if (type.equals("HumanName"))
      return parseHumanName(xpp);
    else if (type.equals("ContactPoint"))
      return parseContactPoint(xpp);
    else if (type.equals("UsageContext"))
      return parseUsageContext(xpp);
    else if (type.equals("Timing"))
      return parseTiming(xpp);
    else if (type.equals("ElementDefinition"))
      return parseElementDefinition(xpp);
    else if (type.equals("ParameterDefinition"))
      return parseParameterDefinition(xpp);
    else if (type.equals("Parameters"))
      return parseParameters(xpp);
    else if (type.equals("Account"))
      return parseAccount(xpp);
    else if (type.equals("ActivityDefinition"))
      return parseActivityDefinition(xpp);
    else if (type.equals("AdverseEvent"))
      return parseAdverseEvent(xpp);
    else if (type.equals("AllergyIntolerance"))
      return parseAllergyIntolerance(xpp);
    else if (type.equals("Appointment"))
      return parseAppointment(xpp);
    else if (type.equals("AppointmentResponse"))
      return parseAppointmentResponse(xpp);
    else if (type.equals("AuditEvent"))
      return parseAuditEvent(xpp);
    else if (type.equals("Basic"))
      return parseBasic(xpp);
    else if (type.equals("Binary"))
      return parseBinary(xpp);
    else if (type.equals("BodySite"))
      return parseBodySite(xpp);
    else if (type.equals("Bundle"))
      return parseBundle(xpp);
    else if (type.equals("CapabilityStatement"))
      return parseCapabilityStatement(xpp);
    else if (type.equals("CarePlan"))
      return parseCarePlan(xpp);
    else if (type.equals("CareTeam"))
      return parseCareTeam(xpp);
    else if (type.equals("ChargeItem"))
      return parseChargeItem(xpp);
    else if (type.equals("Claim"))
      return parseClaim(xpp);
    else if (type.equals("ClaimResponse"))
      return parseClaimResponse(xpp);
    else if (type.equals("ClinicalImpression"))
      return parseClinicalImpression(xpp);
    else if (type.equals("CodeSystem"))
      return parseCodeSystem(xpp);
    else if (type.equals("Communication"))
      return parseCommunication(xpp);
    else if (type.equals("CommunicationRequest"))
      return parseCommunicationRequest(xpp);
    else if (type.equals("CompartmentDefinition"))
      return parseCompartmentDefinition(xpp);
    else if (type.equals("Composition"))
      return parseComposition(xpp);
    else if (type.equals("ConceptMap"))
      return parseConceptMap(xpp);
    else if (type.equals("Condition"))
      return parseCondition(xpp);
    else if (type.equals("Consent"))
      return parseConsent(xpp);
    else if (type.equals("Contract"))
      return parseContract(xpp);
    else if (type.equals("Coverage"))
      return parseCoverage(xpp);
    else if (type.equals("DataElement"))
      return parseDataElement(xpp);
    else if (type.equals("DetectedIssue"))
      return parseDetectedIssue(xpp);
    else if (type.equals("Device"))
      return parseDevice(xpp);
    else if (type.equals("DeviceComponent"))
      return parseDeviceComponent(xpp);
    else if (type.equals("DeviceMetric"))
      return parseDeviceMetric(xpp);
    else if (type.equals("DeviceRequest"))
      return parseDeviceRequest(xpp);
    else if (type.equals("DeviceUseStatement"))
      return parseDeviceUseStatement(xpp);
    else if (type.equals("DiagnosticReport"))
      return parseDiagnosticReport(xpp);
    else if (type.equals("DocumentManifest"))
      return parseDocumentManifest(xpp);
    else if (type.equals("DocumentReference"))
      return parseDocumentReference(xpp);
    else if (type.equals("EligibilityRequest"))
      return parseEligibilityRequest(xpp);
    else if (type.equals("EligibilityResponse"))
      return parseEligibilityResponse(xpp);
    else if (type.equals("Encounter"))
      return parseEncounter(xpp);
    else if (type.equals("Endpoint"))
      return parseEndpoint(xpp);
    else if (type.equals("EnrollmentRequest"))
      return parseEnrollmentRequest(xpp);
    else if (type.equals("EnrollmentResponse"))
      return parseEnrollmentResponse(xpp);
    else if (type.equals("EpisodeOfCare"))
      return parseEpisodeOfCare(xpp);
    else if (type.equals("ExpansionProfile"))
      return parseExpansionProfile(xpp);
    else if (type.equals("ExplanationOfBenefit"))
      return parseExplanationOfBenefit(xpp);
    else if (type.equals("FamilyMemberHistory"))
      return parseFamilyMemberHistory(xpp);
    else if (type.equals("Flag"))
      return parseFlag(xpp);
    else if (type.equals("Goal"))
      return parseGoal(xpp);
    else if (type.equals("GraphDefinition"))
      return parseGraphDefinition(xpp);
    else if (type.equals("Group"))
      return parseGroup(xpp);
    else if (type.equals("GuidanceResponse"))
      return parseGuidanceResponse(xpp);
    else if (type.equals("HealthcareService"))
      return parseHealthcareService(xpp);
    else if (type.equals("ImagingManifest"))
      return parseImagingManifest(xpp);
    else if (type.equals("ImagingStudy"))
      return parseImagingStudy(xpp);
    else if (type.equals("Immunization"))
      return parseImmunization(xpp);
    else if (type.equals("ImmunizationRecommendation"))
      return parseImmunizationRecommendation(xpp);
    else if (type.equals("ImplementationGuide"))
      return parseImplementationGuide(xpp);
    else if (type.equals("Library"))
      return parseLibrary(xpp);
    else if (type.equals("Linkage"))
      return parseLinkage(xpp);
    else if (type.equals("List"))
      return parseListResource(xpp);
    else if (type.equals("Location"))
      return parseLocation(xpp);
    else if (type.equals("Measure"))
      return parseMeasure(xpp);
    else if (type.equals("MeasureReport"))
      return parseMeasureReport(xpp);
    else if (type.equals("Media"))
      return parseMedia(xpp);
    else if (type.equals("Medication"))
      return parseMedication(xpp);
    else if (type.equals("MedicationAdministration"))
      return parseMedicationAdministration(xpp);
    else if (type.equals("MedicationDispense"))
      return parseMedicationDispense(xpp);
    else if (type.equals("MedicationRequest"))
      return parseMedicationRequest(xpp);
    else if (type.equals("MedicationStatement"))
      return parseMedicationStatement(xpp);
    else if (type.equals("MessageDefinition"))
      return parseMessageDefinition(xpp);
    else if (type.equals("MessageHeader"))
      return parseMessageHeader(xpp);
    else if (type.equals("NamingSystem"))
      return parseNamingSystem(xpp);
    else if (type.equals("NutritionOrder"))
      return parseNutritionOrder(xpp);
    else if (type.equals("Observation"))
      return parseObservation(xpp);
    else if (type.equals("OperationDefinition"))
      return parseOperationDefinition(xpp);
    else if (type.equals("OperationOutcome"))
      return parseOperationOutcome(xpp);
    else if (type.equals("Organization"))
      return parseOrganization(xpp);
    else if (type.equals("Patient"))
      return parsePatient(xpp);
    else if (type.equals("PaymentNotice"))
      return parsePaymentNotice(xpp);
    else if (type.equals("PaymentReconciliation"))
      return parsePaymentReconciliation(xpp);
    else if (type.equals("Person"))
      return parsePerson(xpp);
    else if (type.equals("PlanDefinition"))
      return parsePlanDefinition(xpp);
    else if (type.equals("Practitioner"))
      return parsePractitioner(xpp);
    else if (type.equals("PractitionerRole"))
      return parsePractitionerRole(xpp);
    else if (type.equals("Procedure"))
      return parseProcedure(xpp);
    else if (type.equals("ProcedureRequest"))
      return parseProcedureRequest(xpp);
    else if (type.equals("ProcessRequest"))
      return parseProcessRequest(xpp);
    else if (type.equals("ProcessResponse"))
      return parseProcessResponse(xpp);
    else if (type.equals("Provenance"))
      return parseProvenance(xpp);
    else if (type.equals("Questionnaire"))
      return parseQuestionnaire(xpp);
    else if (type.equals("QuestionnaireResponse"))
      return parseQuestionnaireResponse(xpp);
    else if (type.equals("ReferralRequest"))
      return parseReferralRequest(xpp);
    else if (type.equals("RelatedPerson"))
      return parseRelatedPerson(xpp);
    else if (type.equals("RequestGroup"))
      return parseRequestGroup(xpp);
    else if (type.equals("ResearchStudy"))
      return parseResearchStudy(xpp);
    else if (type.equals("ResearchSubject"))
      return parseResearchSubject(xpp);
    else if (type.equals("RiskAssessment"))
      return parseRiskAssessment(xpp);
    else if (type.equals("Schedule"))
      return parseSchedule(xpp);
    else if (type.equals("SearchParameter"))
      return parseSearchParameter(xpp);
    else if (type.equals("Sequence"))
      return parseSequence(xpp);
    else if (type.equals("ServiceDefinition"))
      return parseServiceDefinition(xpp);
    else if (type.equals("Slot"))
      return parseSlot(xpp);
    else if (type.equals("Specimen"))
      return parseSpecimen(xpp);
    else if (type.equals("StructureDefinition"))
      return parseStructureDefinition(xpp);
    else if (type.equals("StructureMap"))
      return parseStructureMap(xpp);
    else if (type.equals("Subscription"))
      return parseSubscription(xpp);
    else if (type.equals("Substance"))
      return parseSubstance(xpp);
    else if (type.equals("SupplyDelivery"))
      return parseSupplyDelivery(xpp);
    else if (type.equals("SupplyRequest"))
      return parseSupplyRequest(xpp);
    else if (type.equals("Task"))
      return parseTask(xpp);
    else if (type.equals("TestReport"))
      return parseTestReport(xpp);
    else if (type.equals("TestScript"))
      return parseTestScript(xpp);
    else if (type.equals("ValueSet"))
      return parseValueSet(xpp);
    else if (type.equals("VisionPrescription"))
      return parseVisionPrescription(xpp);
    else if (type.equals("date"))
      return parseDate(xpp);
    else if (type.equals("dateTime"))
      return parseDateTime(xpp);
    else if (type.equals("code"))
      return parseCode(xpp);
    else if (type.equals("string"))
      return parseString(xpp);
    else if (type.equals("integer"))
      return parseInteger(xpp);
    else if (type.equals("oid"))
      return parseOid(xpp);
    else if (type.equals("uri"))
      return parseUri(xpp);
    else if (type.equals("uuid"))
      return parseUuid(xpp);
    else if (type.equals("instant"))
      return parseInstant(xpp);
    else if (type.equals("boolean"))
      return parseBoolean(xpp);
    else if (type.equals("base64Binary"))
      return parseBase64Binary(xpp);
    else if (type.equals("unsignedInt"))
      return parseUnsignedInt(xpp);
    else if (type.equals("markdown"))
      return parseMarkdown(xpp);
    else if (type.equals("time"))
      return parseTime(xpp);
    else if (type.equals("id"))
      return parseId(xpp);
    else if (type.equals("positiveInt"))
      return parsePositiveInt(xpp);
    else if (type.equals("decimal"))
      return parseDecimal(xpp);
    throw new FHIRFormatError("Unknown type "+type);
  }

  private boolean nameIsTypeName(XmlPullParser xpp, String prefix) {
        if (xpp.getName().equals(prefix+"Reference"))
      return true;
    if (xpp.getName().equals(prefix+"Quantity"))
      return true;
    if (xpp.getName().equals(prefix+"Period"))
      return true;
    if (xpp.getName().equals(prefix+"Attachment"))
      return true;
    if (xpp.getName().equals(prefix+"Duration"))
      return true;
    if (xpp.getName().equals(prefix+"Count"))
      return true;
    if (xpp.getName().equals(prefix+"Range"))
      return true;
    if (xpp.getName().equals(prefix+"Annotation"))
      return true;
    if (xpp.getName().equals(prefix+"Money"))
      return true;
    if (xpp.getName().equals(prefix+"Identifier"))
      return true;
    if (xpp.getName().equals(prefix+"Coding"))
      return true;
    if (xpp.getName().equals(prefix+"Signature"))
      return true;
    if (xpp.getName().equals(prefix+"SampledData"))
      return true;
    if (xpp.getName().equals(prefix+"Ratio"))
      return true;
    if (xpp.getName().equals(prefix+"Distance"))
      return true;
    if (xpp.getName().equals(prefix+"Age"))
      return true;
    if (xpp.getName().equals(prefix+"CodeableConcept"))
      return true;
    if (xpp.getName().equals(prefix+"SimpleQuantity"))
      return true;
    if (xpp.getName().equals(prefix+"Meta"))
      return true;
    if (xpp.getName().equals(prefix+"Address"))
      return true;
    if (xpp.getName().equals(prefix+"TriggerDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"Contributor"))
      return true;
    if (xpp.getName().equals(prefix+"DataRequirement"))
      return true;
    if (xpp.getName().equals(prefix+"Dosage"))
      return true;
    if (xpp.getName().equals(prefix+"RelatedArtifact"))
      return true;
    if (xpp.getName().equals(prefix+"ContactDetail"))
      return true;
    if (xpp.getName().equals(prefix+"HumanName"))
      return true;
    if (xpp.getName().equals(prefix+"ContactPoint"))
      return true;
    if (xpp.getName().equals(prefix+"UsageContext"))
      return true;
    if (xpp.getName().equals(prefix+"Timing"))
      return true;
    if (xpp.getName().equals(prefix+"ElementDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"ParameterDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"Parameters"))
      return true;
    if (xpp.getName().equals(prefix+"Account"))
      return true;
    if (xpp.getName().equals(prefix+"ActivityDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"AdverseEvent"))
      return true;
    if (xpp.getName().equals(prefix+"AllergyIntolerance"))
      return true;
    if (xpp.getName().equals(prefix+"Appointment"))
      return true;
    if (xpp.getName().equals(prefix+"AppointmentResponse"))
      return true;
    if (xpp.getName().equals(prefix+"AuditEvent"))
      return true;
    if (xpp.getName().equals(prefix+"Basic"))
      return true;
    if (xpp.getName().equals(prefix+"Binary"))
      return true;
    if (xpp.getName().equals(prefix+"BodySite"))
      return true;
    if (xpp.getName().equals(prefix+"Bundle"))
      return true;
    if (xpp.getName().equals(prefix+"CapabilityStatement"))
      return true;
    if (xpp.getName().equals(prefix+"CarePlan"))
      return true;
    if (xpp.getName().equals(prefix+"CareTeam"))
      return true;
    if (xpp.getName().equals(prefix+"ChargeItem"))
      return true;
    if (xpp.getName().equals(prefix+"Claim"))
      return true;
    if (xpp.getName().equals(prefix+"ClaimResponse"))
      return true;
    if (xpp.getName().equals(prefix+"ClinicalImpression"))
      return true;
    if (xpp.getName().equals(prefix+"CodeSystem"))
      return true;
    if (xpp.getName().equals(prefix+"Communication"))
      return true;
    if (xpp.getName().equals(prefix+"CommunicationRequest"))
      return true;
    if (xpp.getName().equals(prefix+"CompartmentDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"Composition"))
      return true;
    if (xpp.getName().equals(prefix+"ConceptMap"))
      return true;
    if (xpp.getName().equals(prefix+"Condition"))
      return true;
    if (xpp.getName().equals(prefix+"Consent"))
      return true;
    if (xpp.getName().equals(prefix+"Contract"))
      return true;
    if (xpp.getName().equals(prefix+"Coverage"))
      return true;
    if (xpp.getName().equals(prefix+"DataElement"))
      return true;
    if (xpp.getName().equals(prefix+"DetectedIssue"))
      return true;
    if (xpp.getName().equals(prefix+"Device"))
      return true;
    if (xpp.getName().equals(prefix+"DeviceComponent"))
      return true;
    if (xpp.getName().equals(prefix+"DeviceMetric"))
      return true;
    if (xpp.getName().equals(prefix+"DeviceRequest"))
      return true;
    if (xpp.getName().equals(prefix+"DeviceUseStatement"))
      return true;
    if (xpp.getName().equals(prefix+"DiagnosticReport"))
      return true;
    if (xpp.getName().equals(prefix+"DocumentManifest"))
      return true;
    if (xpp.getName().equals(prefix+"DocumentReference"))
      return true;
    if (xpp.getName().equals(prefix+"EligibilityRequest"))
      return true;
    if (xpp.getName().equals(prefix+"EligibilityResponse"))
      return true;
    if (xpp.getName().equals(prefix+"Encounter"))
      return true;
    if (xpp.getName().equals(prefix+"Endpoint"))
      return true;
    if (xpp.getName().equals(prefix+"EnrollmentRequest"))
      return true;
    if (xpp.getName().equals(prefix+"EnrollmentResponse"))
      return true;
    if (xpp.getName().equals(prefix+"EpisodeOfCare"))
      return true;
    if (xpp.getName().equals(prefix+"ExpansionProfile"))
      return true;
    if (xpp.getName().equals(prefix+"ExplanationOfBenefit"))
      return true;
    if (xpp.getName().equals(prefix+"FamilyMemberHistory"))
      return true;
    if (xpp.getName().equals(prefix+"Flag"))
      return true;
    if (xpp.getName().equals(prefix+"Goal"))
      return true;
    if (xpp.getName().equals(prefix+"GraphDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"Group"))
      return true;
    if (xpp.getName().equals(prefix+"GuidanceResponse"))
      return true;
    if (xpp.getName().equals(prefix+"HealthcareService"))
      return true;
    if (xpp.getName().equals(prefix+"ImagingManifest"))
      return true;
    if (xpp.getName().equals(prefix+"ImagingStudy"))
      return true;
    if (xpp.getName().equals(prefix+"Immunization"))
      return true;
    if (xpp.getName().equals(prefix+"ImmunizationRecommendation"))
      return true;
    if (xpp.getName().equals(prefix+"ImplementationGuide"))
      return true;
    if (xpp.getName().equals(prefix+"Library"))
      return true;
    if (xpp.getName().equals(prefix+"Linkage"))
      return true;
    if (xpp.getName().equals(prefix+"List"))
      return true;
    if (xpp.getName().equals(prefix+"Location"))
      return true;
    if (xpp.getName().equals(prefix+"Measure"))
      return true;
    if (xpp.getName().equals(prefix+"MeasureReport"))
      return true;
    if (xpp.getName().equals(prefix+"Media"))
      return true;
    if (xpp.getName().equals(prefix+"Medication"))
      return true;
    if (xpp.getName().equals(prefix+"MedicationAdministration"))
      return true;
    if (xpp.getName().equals(prefix+"MedicationDispense"))
      return true;
    if (xpp.getName().equals(prefix+"MedicationRequest"))
      return true;
    if (xpp.getName().equals(prefix+"MedicationStatement"))
      return true;
    if (xpp.getName().equals(prefix+"MessageDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"MessageHeader"))
      return true;
    if (xpp.getName().equals(prefix+"NamingSystem"))
      return true;
    if (xpp.getName().equals(prefix+"NutritionOrder"))
      return true;
    if (xpp.getName().equals(prefix+"Observation"))
      return true;
    if (xpp.getName().equals(prefix+"OperationDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"OperationOutcome"))
      return true;
    if (xpp.getName().equals(prefix+"Organization"))
      return true;
    if (xpp.getName().equals(prefix+"Patient"))
      return true;
    if (xpp.getName().equals(prefix+"PaymentNotice"))
      return true;
    if (xpp.getName().equals(prefix+"PaymentReconciliation"))
      return true;
    if (xpp.getName().equals(prefix+"Person"))
      return true;
    if (xpp.getName().equals(prefix+"PlanDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"Practitioner"))
      return true;
    if (xpp.getName().equals(prefix+"PractitionerRole"))
      return true;
    if (xpp.getName().equals(prefix+"Procedure"))
      return true;
    if (xpp.getName().equals(prefix+"ProcedureRequest"))
      return true;
    if (xpp.getName().equals(prefix+"ProcessRequest"))
      return true;
    if (xpp.getName().equals(prefix+"ProcessResponse"))
      return true;
    if (xpp.getName().equals(prefix+"Provenance"))
      return true;
    if (xpp.getName().equals(prefix+"Questionnaire"))
      return true;
    if (xpp.getName().equals(prefix+"QuestionnaireResponse"))
      return true;
    if (xpp.getName().equals(prefix+"ReferralRequest"))
      return true;
    if (xpp.getName().equals(prefix+"RelatedPerson"))
      return true;
    if (xpp.getName().equals(prefix+"RequestGroup"))
      return true;
    if (xpp.getName().equals(prefix+"ResearchStudy"))
      return true;
    if (xpp.getName().equals(prefix+"ResearchSubject"))
      return true;
    if (xpp.getName().equals(prefix+"RiskAssessment"))
      return true;
    if (xpp.getName().equals(prefix+"Schedule"))
      return true;
    if (xpp.getName().equals(prefix+"SearchParameter"))
      return true;
    if (xpp.getName().equals(prefix+"Sequence"))
      return true;
    if (xpp.getName().equals(prefix+"ServiceDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"Slot"))
      return true;
    if (xpp.getName().equals(prefix+"Specimen"))
      return true;
    if (xpp.getName().equals(prefix+"StructureDefinition"))
      return true;
    if (xpp.getName().equals(prefix+"StructureMap"))
      return true;
    if (xpp.getName().equals(prefix+"Subscription"))
      return true;
    if (xpp.getName().equals(prefix+"Substance"))
      return true;
    if (xpp.getName().equals(prefix+"SupplyDelivery"))
      return true;
    if (xpp.getName().equals(prefix+"SupplyRequest"))
      return true;
    if (xpp.getName().equals(prefix+"Task"))
      return true;
    if (xpp.getName().equals(prefix+"TestReport"))
      return true;
    if (xpp.getName().equals(prefix+"TestScript"))
      return true;
    if (xpp.getName().equals(prefix+"ValueSet"))
      return true;
    if (xpp.getName().equals(prefix+"VisionPrescription"))
      return true;
    if (xpp.getName().equals(prefix+"Date"))
      return true;
    if (xpp.getName().equals(prefix+"DateTime"))
      return true;
    if (xpp.getName().equals(prefix+"Code"))
      return true;
    if (xpp.getName().equals(prefix+"String"))
      return true;
    if (xpp.getName().equals(prefix+"Integer"))
      return true;
    if (xpp.getName().equals(prefix+"Oid"))
      return true;
    if (xpp.getName().equals(prefix+"Uri"))
      return true;
    if (xpp.getName().equals(prefix+"Uuid"))
      return true;
    if (xpp.getName().equals(prefix+"Instant"))
      return true;
    if (xpp.getName().equals(prefix+"Boolean"))
      return true;
    if (xpp.getName().equals(prefix+"Base64Binary"))
      return true;
    if (xpp.getName().equals(prefix+"UnsignedInt"))
      return true;
    if (xpp.getName().equals(prefix+"Markdown"))
      return true;
    if (xpp.getName().equals(prefix+"Time"))
      return true;
    if (xpp.getName().equals(prefix+"Id"))
      return true;
    if (xpp.getName().equals(prefix+"PositiveInt"))
      return true;
    if (xpp.getName().equals(prefix+"Decimal"))
      return true;
    return false;
  }
  protected void composeElementElements(Element element) throws IOException {
    for (Extension e : element.getExtension()) {
      composeExtension("extension", e);
    }
  }

  protected void composeBackboneElements(BackboneElement element) throws IOException {
    composeElementElements(element);
    for (Extension e : element.getModifierExtension()) {
      composeExtension("modifierExtension", e);
    }
  }

  protected > void composeEnumeration(String name, Enumeration value, EnumFactory e) throws IOException {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {
      composeElementAttributes(value);
      if (value.getValue() != null) 
        xml.attribute("value", e.toCode(value.getValue()));
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeDate(String name, DateType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {// date
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeDateTime(String name, DateTimeType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {// dateTime
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeCode(String name, CodeType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// code
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeString(String name, StringType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// string
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeInteger(String name, IntegerType value) throws IOException  {
    if (value != null) { // integer
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeOid(String name, OidType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// oid
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeUri(String name, UriType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {// uri
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeUuid(String name, UuidType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// uuid
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeInstant(String name, InstantType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {// instant
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeBoolean(String name, BooleanType value) throws IOException  {
    if (value != null) { // boolean
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeBase64Binary(String name, Base64BinaryType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {// base64Binary
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeUnsignedInt(String name, UnsignedIntType value) throws IOException  {
    if (value != null) { // unsignedInt
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeMarkdown(String name, MarkdownType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// markdown
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeTime(String name, TimeType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// time
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeId(String name, IdType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// id
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composePositiveInt(String name, PositiveIntType value) throws IOException  {
    if (value != null) { // positiveInt
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeDecimal(String name, DecimalType value) throws IOException  {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {// decimal
      composeElementAttributes(value);
      if (value.asStringValue() != null) 
        xml.attribute("value", value.asStringValue());
        
      xml.enter(FHIR_NS, name);
      composeElementElements(value);
      composeElementClose(value);
      xml.exit(FHIR_NS, name);
    }    
  }    

  protected void composeExtension(String name, Extension element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      if (element.hasUrlElement())
        xml.attribute("url", element.getUrlElement().getValue());
      xml.enter(FHIR_NS, name);
      composeExtensionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExtensionElements(Extension element) throws IOException {
      composeElementElements(element);
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeNarrative(String name, Narrative element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNarrativeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNarrativeElements(Narrative element) throws IOException {
      composeElementElements(element);
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory());
      if (element.hasDiv()) {
        composeXhtml("div", element.getDiv());
      }
  }

  protected void composeDuration(String name, Duration element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDurationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDurationElements(Duration element) throws IOException {
      composeQuantityElements(element);
  }

  protected void composeCount(String name, Count element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCountElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCountElements(Count element) throws IOException {
      composeQuantityElements(element);
  }

  protected void composeMoney(String name, Money element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMoneyElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMoneyElements(Money element) throws IOException {
      composeQuantityElements(element);
  }

  protected void composeDistance(String name, Distance element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDistanceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDistanceElements(Distance element) throws IOException {
      composeQuantityElements(element);
  }

  protected void composeAge(String name, Age element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAgeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAgeElements(Age element) throws IOException {
      composeQuantityElements(element);
  }

  protected void composeReference(String name, Reference element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeReferenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeReferenceElements(Reference element) throws IOException {
      composeElementElements(element);
      if (element.hasReferenceElement()) {
        composeString("reference", element.getReferenceElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
  }

  protected void composeQuantity(String name, Quantity element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuantityElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuantityElements(Quantity element) throws IOException {
      composeElementElements(element);
      if (element.hasValueElement()) {
        composeDecimal("value", element.getValueElement());
      }
      if (element.hasComparatorElement())
        composeEnumeration("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory());
      if (element.hasUnitElement()) {
        composeString("unit", element.getUnitElement());
      }
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
  }

  protected void composePeriod(String name, Period element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composePeriodElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePeriodElements(Period element) throws IOException {
      composeElementElements(element);
      if (element.hasStartElement()) {
        composeDateTime("start", element.getStartElement());
      }
      if (element.hasEndElement()) {
        composeDateTime("end", element.getEndElement());
      }
  }

  protected void composeAttachment(String name, Attachment element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAttachmentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAttachmentElements(Attachment element) throws IOException {
      composeElementElements(element);
      if (element.hasContentTypeElement()) {
        composeCode("contentType", element.getContentTypeElement());
      }
      if (element.hasLanguageElement()) {
        composeCode("language", element.getLanguageElement());
      }
      if (element.hasDataElement()) {
        composeBase64Binary("data", element.getDataElement());
      }
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasSizeElement()) {
        composeUnsignedInt("size", element.getSizeElement());
      }
      if (element.hasHashElement()) {
        composeBase64Binary("hash", element.getHashElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasCreationElement()) {
        composeDateTime("creation", element.getCreationElement());
      }
  }

  protected void composeRange(String name, Range element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRangeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRangeElements(Range element) throws IOException {
      composeElementElements(element);
      if (element.hasLow()) {
        composeSimpleQuantity("low", element.getLow());
      }
      if (element.hasHigh()) {
        composeSimpleQuantity("high", element.getHigh());
      }
  }

  protected void composeAnnotation(String name, Annotation element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAnnotationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAnnotationElements(Annotation element) throws IOException {
      composeElementElements(element);
      if (element.hasAuthor()) {
        composeType("author", element.getAuthor());
      }      if (element.hasTimeElement()) {
        composeDateTime("time", element.getTimeElement());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
  }

  protected void composeIdentifier(String name, Identifier element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeIdentifierElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeIdentifierElements(Identifier element) throws IOException {
      composeElementElements(element);
      if (element.hasUseElement())
        composeEnumeration("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasAssigner()) {
        composeReference("assigner", element.getAssigner());
      }
  }

  protected void composeCoding(String name, Coding element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodingElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodingElements(Coding element) throws IOException {
      composeElementElements(element);
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasUserSelectedElement()) {
        composeBoolean("userSelected", element.getUserSelectedElement());
      }
  }

  protected void composeSignature(String name, Signature element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSignatureElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSignatureElements(Signature element) throws IOException {
      composeElementElements(element);
      if (element.hasType()) { 
        for (Coding e : element.getType()) 
          composeCoding("type", e);
      }
      if (element.hasWhenElement()) {
        composeInstant("when", element.getWhenElement());
      }
      if (element.hasWho()) {
        composeType("who", element.getWho());
      }      if (element.hasOnBehalfOf()) {
        composeType("onBehalfOf", element.getOnBehalfOf());
      }      if (element.hasContentTypeElement()) {
        composeCode("contentType", element.getContentTypeElement());
      }
      if (element.hasBlobElement()) {
        composeBase64Binary("blob", element.getBlobElement());
      }
  }

  protected void composeSampledData(String name, SampledData element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSampledDataElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSampledDataElements(SampledData element) throws IOException {
      composeElementElements(element);
      if (element.hasOrigin()) {
        composeSimpleQuantity("origin", element.getOrigin());
      }
      if (element.hasPeriodElement()) {
        composeDecimal("period", element.getPeriodElement());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasLowerLimitElement()) {
        composeDecimal("lowerLimit", element.getLowerLimitElement());
      }
      if (element.hasUpperLimitElement()) {
        composeDecimal("upperLimit", element.getUpperLimitElement());
      }
      if (element.hasDimensionsElement()) {
        composePositiveInt("dimensions", element.getDimensionsElement());
      }
      if (element.hasDataElement()) {
        composeString("data", element.getDataElement());
      }
  }

  protected void composeRatio(String name, Ratio element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRatioElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRatioElements(Ratio element) throws IOException {
      composeElementElements(element);
      if (element.hasNumerator()) {
        composeQuantity("numerator", element.getNumerator());
      }
      if (element.hasDenominator()) {
        composeQuantity("denominator", element.getDenominator());
      }
  }

  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeableConceptElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeableConceptElements(CodeableConcept element) throws IOException {
      composeElementElements(element);
      if (element.hasCoding()) { 
        for (Coding e : element.getCoding()) 
          composeCoding("coding", e);
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
  }

  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSimpleQuantityElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSimpleQuantityElements(SimpleQuantity element) throws IOException {
      composeElementElements(element);
      if (element.hasValueElement()) {
        composeDecimal("value", element.getValueElement());
      }
      if (element.hasComparatorElement())
        composeEnumeration("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory());
      if (element.hasUnitElement()) {
        composeString("unit", element.getUnitElement());
      }
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
  }

  protected void composeMeta(String name, Meta element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMetaElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMetaElements(Meta element) throws IOException {
      composeElementElements(element);
      if (element.hasVersionIdElement()) {
        composeId("versionId", element.getVersionIdElement());
      }
      if (element.hasLastUpdatedElement()) {
        composeInstant("lastUpdated", element.getLastUpdatedElement());
      }
      if (element.hasProfile()) { 
        for (UriType e : element.getProfile()) 
          composeUri("profile", e);
      }
      if (element.hasSecurity()) { 
        for (Coding e : element.getSecurity()) 
          composeCoding("security", e);
      }
      if (element.hasTag()) { 
        for (Coding e : element.getTag()) 
          composeCoding("tag", e);
      }
  }

  protected void composeAddress(String name, Address element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAddressElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAddressElements(Address element) throws IOException {
      composeElementElements(element);
      if (element.hasUseElement())
        composeEnumeration("use", element.getUseElement(), new Address.AddressUseEnumFactory());
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Address.AddressTypeEnumFactory());
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasLine()) { 
        for (StringType e : element.getLine()) 
          composeString("line", e);
      }
      if (element.hasCityElement()) {
        composeString("city", element.getCityElement());
      }
      if (element.hasDistrictElement()) {
        composeString("district", element.getDistrictElement());
      }
      if (element.hasStateElement()) {
        composeString("state", element.getStateElement());
      }
      if (element.hasPostalCodeElement()) {
        composeString("postalCode", element.getPostalCodeElement());
      }
      if (element.hasCountryElement()) {
        composeString("country", element.getCountryElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTriggerDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTriggerDefinitionElements(TriggerDefinition element) throws IOException {
      composeElementElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory());
      if (element.hasEventNameElement()) {
        composeString("eventName", element.getEventNameElement());
      }
      if (element.hasEventTiming()) {
        composeType("eventTiming", element.getEventTiming());
      }      if (element.hasEventData()) {
        composeDataRequirement("eventData", element.getEventData());
      }
  }

  protected void composeContributor(String name, Contributor element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContributorElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContributorElements(Contributor element) throws IOException {
      composeElementElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory());
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
  }

  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataRequirementElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataRequirementElements(DataRequirement element) throws IOException {
      composeElementElements(element);
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasProfile()) { 
        for (UriType e : element.getProfile()) 
          composeUri("profile", e);
      }
      if (element.hasMustSupport()) { 
        for (StringType e : element.getMustSupport()) 
          composeString("mustSupport", e);
      }
      if (element.hasCodeFilter()) { 
        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
          composeDataRequirementDataRequirementCodeFilterComponent("codeFilter", e);
      }
      if (element.hasDateFilter()) { 
        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
          composeDataRequirementDataRequirementDateFilterComponent("dateFilter", e);
      }
  }

  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataRequirementDataRequirementCodeFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataRequirementDataRequirementCodeFilterComponentElements(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasValueSet()) {
        composeType("valueSet", element.getValueSet());
      }      if (element.hasValueCode()) { 
        for (CodeType e : element.getValueCode()) 
          composeCode("valueCode", e);
      }
      if (element.hasValueCoding()) { 
        for (Coding e : element.getValueCoding()) 
          composeCoding("valueCoding", e);
      }
      if (element.hasValueCodeableConcept()) { 
        for (CodeableConcept e : element.getValueCodeableConcept()) 
          composeCodeableConcept("valueCodeableConcept", e);
      }
  }

  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataRequirementDataRequirementDateFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataRequirementDataRequirementDateFilterComponentElements(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeDosage(String name, Dosage element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDosageElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDosageElements(Dosage element) throws IOException {
      composeElementElements(element);
      if (element.hasSequenceElement()) {
        composeInteger("sequence", element.getSequenceElement());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasAdditionalInstruction()) { 
        for (CodeableConcept e : element.getAdditionalInstruction()) 
          composeCodeableConcept("additionalInstruction", e);
      }
      if (element.hasPatientInstructionElement()) {
        composeString("patientInstruction", element.getPatientInstructionElement());
      }
      if (element.hasTiming()) {
        composeTiming("timing", element.getTiming());
      }
      if (element.hasAsNeeded()) {
        composeType("asNeeded", element.getAsNeeded());
      }      if (element.hasSite()) {
        composeCodeableConcept("site", element.getSite());
      }
      if (element.hasRoute()) {
        composeCodeableConcept("route", element.getRoute());
      }
      if (element.hasMethod()) {
        composeCodeableConcept("method", element.getMethod());
      }
      if (element.hasDose()) {
        composeType("dose", element.getDose());
      }      if (element.hasMaxDosePerPeriod()) {
        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
      }
      if (element.hasMaxDosePerAdministration()) {
        composeSimpleQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
      }
      if (element.hasMaxDosePerLifetime()) {
        composeSimpleQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
      }
      if (element.hasRate()) {
        composeType("rate", element.getRate());
      }  }

  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRelatedArtifactElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRelatedArtifactElements(RelatedArtifact element) throws IOException {
      composeElementElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory());
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasCitationElement()) {
        composeString("citation", element.getCitationElement());
      }
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasDocument()) {
        composeAttachment("document", element.getDocument());
      }
      if (element.hasResource()) {
        composeReference("resource", element.getResource());
      }
  }

  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContactDetailElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContactDetailElements(ContactDetail element) throws IOException {
      composeElementElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
  }

  protected void composeHumanName(String name, HumanName element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHumanNameElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHumanNameElements(HumanName element) throws IOException {
      composeElementElements(element);
      if (element.hasUseElement())
        composeEnumeration("use", element.getUseElement(), new HumanName.NameUseEnumFactory());
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasFamilyElement()) {
        composeString("family", element.getFamilyElement());
      }
      if (element.hasGiven()) { 
        for (StringType e : element.getGiven()) 
          composeString("given", e);
      }
      if (element.hasPrefix()) { 
        for (StringType e : element.getPrefix()) 
          composeString("prefix", e);
      }
      if (element.hasSuffix()) { 
        for (StringType e : element.getSuffix()) 
          composeString("suffix", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContactPointElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContactPointElements(ContactPoint element) throws IOException {
      composeElementElements(element);
      if (element.hasSystemElement())
        composeEnumeration("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory());
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
      if (element.hasUseElement())
        composeEnumeration("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory());
      if (element.hasRankElement()) {
        composePositiveInt("rank", element.getRankElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeUsageContext(String name, UsageContext element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeUsageContextElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeUsageContextElements(UsageContext element) throws IOException {
      composeElementElements(element);
      if (element.hasCode()) {
        composeCoding("code", element.getCode());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeTiming(String name, Timing element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTimingElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTimingElements(Timing element) throws IOException {
      composeElementElements(element);
      if (element.hasEvent()) { 
        for (DateTimeType e : element.getEvent()) 
          composeDateTime("event", e);
      }
      if (element.hasRepeat()) {
        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
  }

  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTimingTimingRepeatComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTimingTimingRepeatComponentElements(Timing.TimingRepeatComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasBounds()) {
        composeType("bounds", element.getBounds());
      }      if (element.hasCountElement()) {
        composeInteger("count", element.getCountElement());
      }
      if (element.hasCountMaxElement()) {
        composeInteger("countMax", element.getCountMaxElement());
      }
      if (element.hasDurationElement()) {
        composeDecimal("duration", element.getDurationElement());
      }
      if (element.hasDurationMaxElement()) {
        composeDecimal("durationMax", element.getDurationMaxElement());
      }
      if (element.hasDurationUnitElement())
        composeEnumeration("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory());
      if (element.hasFrequencyElement()) {
        composeInteger("frequency", element.getFrequencyElement());
      }
      if (element.hasFrequencyMaxElement()) {
        composeInteger("frequencyMax", element.getFrequencyMaxElement());
      }
      if (element.hasPeriodElement()) {
        composeDecimal("period", element.getPeriodElement());
      }
      if (element.hasPeriodMaxElement()) {
        composeDecimal("periodMax", element.getPeriodMaxElement());
      }
      if (element.hasPeriodUnitElement())
        composeEnumeration("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory());
        if (element.hasDayOfWeek()) 
          for (Enumeration e : element.getDayOfWeek()) 
            composeEnumeration("dayOfWeek", e, new Timing.DayOfWeekEnumFactory());
      if (element.hasTimeOfDay()) { 
        for (TimeType e : element.getTimeOfDay()) 
          composeTime("timeOfDay", e);
      }
        if (element.hasWhen()) 
          for (Enumeration e : element.getWhen()) 
            composeEnumeration("when", e, new Timing.EventTimingEnumFactory());
      if (element.hasOffsetElement()) {
        composeUnsignedInt("offset", element.getOffsetElement());
      }
  }

  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElements(ElementDefinition element) throws IOException {
      composeElementElements(element);
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
        if (element.hasRepresentation()) 
          for (Enumeration e : element.getRepresentation()) 
            composeEnumeration("representation", e, new ElementDefinition.PropertyRepresentationEnumFactory());
      if (element.hasSliceNameElement()) {
        composeString("sliceName", element.getSliceNameElement());
      }
      if (element.hasLabelElement()) {
        composeString("label", element.getLabelElement());
      }
      if (element.hasCode()) { 
        for (Coding e : element.getCode()) 
          composeCoding("code", e);
      }
      if (element.hasSlicing()) {
        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
      }
      if (element.hasShortElement()) {
        composeString("short", element.getShortElement());
      }
      if (element.hasDefinitionElement()) {
        composeMarkdown("definition", element.getDefinitionElement());
      }
      if (element.hasCommentElement()) {
        composeMarkdown("comment", element.getCommentElement());
      }
      if (element.hasRequirementsElement()) {
        composeMarkdown("requirements", element.getRequirementsElement());
      }
      if (element.hasAlias()) { 
        for (StringType e : element.getAlias()) 
          composeString("alias", e);
      }
      if (element.hasMinElement()) {
        composeUnsignedInt("min", element.getMinElement());
      }
      if (element.hasMaxElement()) {
        composeString("max", element.getMaxElement());
      }
      if (element.hasBase()) {
        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
      }
      if (element.hasContentReferenceElement()) {
        composeUri("contentReference", element.getContentReferenceElement());
      }
      if (element.hasType()) { 
        for (ElementDefinition.TypeRefComponent e : element.getType()) 
          composeElementDefinitionTypeRefComponent("type", e);
      }
      if (element.hasDefaultValue()) {
        composeType("defaultValue", element.getDefaultValue());
      }      if (element.hasMeaningWhenMissingElement()) {
        composeMarkdown("meaningWhenMissing", element.getMeaningWhenMissingElement());
      }
      if (element.hasOrderMeaningElement()) {
        composeString("orderMeaning", element.getOrderMeaningElement());
      }
      if (element.hasFixed()) {
        composeType("fixed", element.getFixed());
      }      if (element.hasPattern()) {
        composeType("pattern", element.getPattern());
      }      if (element.hasExample()) { 
        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
          composeElementDefinitionElementDefinitionExampleComponent("example", e);
      }
      if (element.hasMinValue()) {
        composeType("minValue", element.getMinValue());
      }      if (element.hasMaxValue()) {
        composeType("maxValue", element.getMaxValue());
      }      if (element.hasMaxLengthElement()) {
        composeInteger("maxLength", element.getMaxLengthElement());
      }
      if (element.hasCondition()) { 
        for (IdType e : element.getCondition()) 
          composeId("condition", e);
      }
      if (element.hasConstraint()) { 
        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
          composeElementDefinitionElementDefinitionConstraintComponent("constraint", e);
      }
      if (element.hasMustSupportElement()) {
        composeBoolean("mustSupport", element.getMustSupportElement());
      }
      if (element.hasIsModifierElement()) {
        composeBoolean("isModifier", element.getIsModifierElement());
      }
      if (element.hasIsSummaryElement()) {
        composeBoolean("isSummary", element.getIsSummaryElement());
      }
      if (element.hasBinding()) {
        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
      }
      if (element.hasMapping()) { 
        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
          composeElementDefinitionElementDefinitionMappingComponent("mapping", e);
      }
  }

  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElementDefinitionSlicingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElementDefinitionSlicingComponentElements(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasDiscriminator()) { 
        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent("discriminator", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasOrderedElement()) {
        composeBoolean("ordered", element.getOrderedElement());
      }
      if (element.hasRulesElement())
        composeEnumeration("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory());
  }

  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentElements(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory());
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
  }

  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElementDefinitionBaseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElementDefinitionBaseComponentElements(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasMinElement()) {
        composeUnsignedInt("min", element.getMinElement());
      }
      if (element.hasMaxElement()) {
        composeString("max", element.getMaxElement());
      }
  }

  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionTypeRefComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionTypeRefComponentElements(ElementDefinition.TypeRefComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasCodeElement()) {
        composeUri("code", element.getCodeElement());
      }
      if (element.hasProfileElement()) {
        composeUri("profile", element.getProfileElement());
      }
      if (element.hasTargetProfileElement()) {
        composeUri("targetProfile", element.getTargetProfileElement());
      }
        if (element.hasAggregation()) 
          for (Enumeration e : element.getAggregation()) 
            composeEnumeration("aggregation", e, new ElementDefinition.AggregationModeEnumFactory());
      if (element.hasVersioningElement())
        composeEnumeration("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory());
  }

  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElementDefinitionExampleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElementDefinitionExampleComponentElements(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasLabelElement()) {
        composeString("label", element.getLabelElement());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElementDefinitionConstraintComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElementDefinitionConstraintComponentElements(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasKeyElement()) {
        composeId("key", element.getKeyElement());
      }
      if (element.hasRequirementsElement()) {
        composeString("requirements", element.getRequirementsElement());
      }
      if (element.hasSeverityElement())
        composeEnumeration("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory());
      if (element.hasHumanElement()) {
        composeString("human", element.getHumanElement());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
      if (element.hasXpathElement()) {
        composeString("xpath", element.getXpathElement());
      }
      if (element.hasSourceElement()) {
        composeUri("source", element.getSourceElement());
      }
  }

  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElementDefinitionBindingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElementDefinitionBindingComponentElements(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasStrengthElement())
        composeEnumeration("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory());
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasValueSet()) {
        composeType("valueSet", element.getValueSet());
      }  }

  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionElementDefinitionMappingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionElementDefinitionMappingComponentElements(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
      composeElementElements(element);
      if (element.hasIdentityElement()) {
        composeId("identity", element.getIdentityElement());
      }
      if (element.hasLanguageElement()) {
        composeCode("language", element.getLanguageElement());
      }
      if (element.hasMapElement()) {
        composeString("map", element.getMapElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeParameterDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeParameterDefinitionElements(ParameterDefinition element) throws IOException {
      composeElementElements(element);
      if (element.hasNameElement()) {
        composeCode("name", element.getNameElement());
      }
      if (element.hasUseElement())
        composeEnumeration("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory());
      if (element.hasMinElement()) {
        composeInteger("min", element.getMinElement());
      }
      if (element.hasMaxElement()) {
        composeString("max", element.getMaxElement());
      }
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasProfile()) {
        composeReference("profile", element.getProfile());
      }
  }

  protected void composeDomainResourceAttributes(DomainResource element) throws IOException {
    composeResourceAttributes(element);
  }

  protected void composeDomainResourceElements(DomainResource element) throws IOException {
    composeResourceElements(element);
      if (element.hasText()) {
        composeNarrative("text", element.getText());
      }
      if (element.hasContained()) { 
        for (Resource e : element.getContained()) 
        {
          xml.enter(FHIR_NS, "contained");
          composeResource(e);
          xml.exit(FHIR_NS, "contained");
        }
      }
      if (element.hasExtension()) 
        for (Extension e : element.getExtension()) 
          composeExtension("extension", e);
      if (element.hasModifierExtension()) { 
        for (Extension e : element.getModifierExtension()) 
          composeExtension("modifierExtension", e);
      }
  }

  protected void composeParameters(String name, Parameters element) throws IOException {
    if (element != null) {
      composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeParametersElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeParametersElements(Parameters element) throws IOException {
      composeResourceElements(element);
      if (element.hasParameter()) { 
        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
          composeParametersParametersParameterComponent("parameter", e);
      }
  }

  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeParametersParametersParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeParametersParametersParameterComponentElements(Parameters.ParametersParameterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }      if (element.hasResource()) {
        xml.enter(FHIR_NS, "resource");
        composeResource(element.getResource());
        xml.exit(FHIR_NS, "resource");
      }
      if (element.hasPart()) { 
        for (Parameters.ParametersParameterComponent e : element.getPart()) 
          composeParametersParametersParameterComponent("part", e);
      }
  }

  protected void composeResourceAttributes(Resource element) throws IOException {
    if (style != OutputStyle.CANONICAL)
      for (String comment : element.getFormatCommentsPre())
        xml.comment(comment, getOutputStyle() == OutputStyle.PRETTY);
  }

  protected void composeResourceElements(Resource element) throws IOException {
      if (element.hasIdElement()) {
        composeId("id", element.getIdElement());
      }
      if (element.hasMeta()) {
        composeMeta("meta", element.getMeta());
      }
      if (element.hasImplicitRulesElement()) {
        composeUri("implicitRules", element.getImplicitRulesElement());
      }
      if (element.hasLanguageElement()) {
        composeCode("language", element.getLanguageElement());
      }
  }

  protected void composeAccount(String name, Account element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAccountElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAccountElements(Account element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Account.AccountStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasActive()) {
        composePeriod("active", element.getActive());
      }
      if (element.hasBalance()) {
        composeMoney("balance", element.getBalance());
      }
      if (element.hasCoverage()) { 
        for (Account.CoverageComponent e : element.getCoverage()) 
          composeAccountCoverageComponent("coverage", e);
      }
      if (element.hasOwner()) {
        composeReference("owner", element.getOwner());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasGuarantor()) { 
        for (Account.GuarantorComponent e : element.getGuarantor()) 
          composeAccountGuarantorComponent("guarantor", e);
      }
  }

  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAccountCoverageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAccountCoverageComponentElements(Account.CoverageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCoverage()) {
        composeReference("coverage", element.getCoverage());
      }
      if (element.hasPriorityElement()) {
        composePositiveInt("priority", element.getPriorityElement());
      }
  }

  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAccountGuarantorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAccountGuarantorComponentElements(Account.GuarantorComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasParty()) {
        composeReference("party", element.getParty());
      }
      if (element.hasOnHoldElement()) {
        composeBoolean("onHold", element.getOnHoldElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeActivityDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeActivityDefinitionElements(ActivityDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasUsageElement()) {
        composeString("usage", element.getUsageElement());
      }
      if (element.hasApprovalDateElement()) {
        composeDate("approvalDate", element.getApprovalDateElement());
      }
      if (element.hasLastReviewDateElement()) {
        composeDate("lastReviewDate", element.getLastReviewDateElement());
      }
      if (element.hasEffectivePeriod()) {
        composePeriod("effectivePeriod", element.getEffectivePeriod());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasTopic()) { 
        for (CodeableConcept e : element.getTopic()) 
          composeCodeableConcept("topic", e);
      }
      if (element.hasContributor()) { 
        for (Contributor e : element.getContributor()) 
          composeContributor("contributor", e);
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasRelatedArtifact()) { 
        for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
      }
      if (element.hasLibrary()) { 
        for (Reference e : element.getLibrary()) 
          composeReference("library", e);
      }
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory());
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasTiming()) {
        composeType("timing", element.getTiming());
      }      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasParticipant()) { 
        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
          composeActivityDefinitionActivityDefinitionParticipantComponent("participant", e);
      }
      if (element.hasProduct()) {
        composeType("product", element.getProduct());
      }      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasDosage()) { 
        for (Dosage e : element.getDosage()) 
          composeDosage("dosage", e);
      }
      if (element.hasBodySite()) { 
        for (CodeableConcept e : element.getBodySite()) 
          composeCodeableConcept("bodySite", e);
      }
      if (element.hasTransform()) {
        composeReference("transform", element.getTransform());
      }
      if (element.hasDynamicValue()) { 
        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
          composeActivityDefinitionActivityDefinitionDynamicValueComponent("dynamicValue", e);
      }
  }

  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeActivityDefinitionActivityDefinitionParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeActivityDefinitionActivityDefinitionParticipantComponentElements(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory());
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
  }

  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeActivityDefinitionActivityDefinitionDynamicValueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentElements(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasLanguageElement()) {
        composeString("language", element.getLanguageElement());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
  }

  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdverseEventElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdverseEventElements(AdverseEvent element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasCategoryElement())
        composeEnumeration("category", element.getCategoryElement(), new AdverseEvent.AdverseEventCategoryEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasReaction()) { 
        for (Reference e : element.getReaction()) 
          composeReference("reaction", e);
      }
      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasSeriousness()) {
        composeCodeableConcept("seriousness", element.getSeriousness());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasRecorder()) {
        composeReference("recorder", element.getRecorder());
      }
      if (element.hasEventParticipant()) {
        composeReference("eventParticipant", element.getEventParticipant());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasSuspectEntity()) { 
        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
          composeAdverseEventAdverseEventSuspectEntityComponent("suspectEntity", e);
      }
      if (element.hasSubjectMedicalHistory()) { 
        for (Reference e : element.getSubjectMedicalHistory()) 
          composeReference("subjectMedicalHistory", e);
      }
      if (element.hasReferenceDocument()) { 
        for (Reference e : element.getReferenceDocument()) 
          composeReference("referenceDocument", e);
      }
      if (element.hasStudy()) { 
        for (Reference e : element.getStudy()) 
          composeReference("study", e);
      }
  }

  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdverseEventAdverseEventSuspectEntityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdverseEventAdverseEventSuspectEntityComponentElements(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasInstance()) {
        composeReference("instance", element.getInstance());
      }
      if (element.hasCausalityElement())
        composeEnumeration("causality", element.getCausalityElement(), new AdverseEvent.AdverseEventCausalityEnumFactory());
      if (element.hasCausalityAssessment()) {
        composeCodeableConcept("causalityAssessment", element.getCausalityAssessment());
      }
      if (element.hasCausalityProductRelatednessElement()) {
        composeString("causalityProductRelatedness", element.getCausalityProductRelatednessElement());
      }
      if (element.hasCausalityMethod()) {
        composeCodeableConcept("causalityMethod", element.getCausalityMethod());
      }
      if (element.hasCausalityAuthor()) {
        composeReference("causalityAuthor", element.getCausalityAuthor());
      }
      if (element.hasCausalityResult()) {
        composeCodeableConcept("causalityResult", element.getCausalityResult());
      }
  }

  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAllergyIntoleranceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAllergyIntoleranceElements(AllergyIntolerance element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasClinicalStatusElement())
        composeEnumeration("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory());
      if (element.hasVerificationStatusElement())
        composeEnumeration("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory());
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory());
        if (element.hasCategory()) 
          for (Enumeration e : element.getCategory()) 
            composeEnumeration("category", e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory());
      if (element.hasCriticalityElement())
        composeEnumeration("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory());
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasOnset()) {
        composeType("onset", element.getOnset());
      }      if (element.hasAssertedDateElement()) {
        composeDateTime("assertedDate", element.getAssertedDateElement());
      }
      if (element.hasRecorder()) {
        composeReference("recorder", element.getRecorder());
      }
      if (element.hasAsserter()) {
        composeReference("asserter", element.getAsserter());
      }
      if (element.hasLastOccurrenceElement()) {
        composeDateTime("lastOccurrence", element.getLastOccurrenceElement());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasReaction()) { 
        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
          composeAllergyIntoleranceAllergyIntoleranceReactionComponent("reaction", e);
      }
  }

  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAllergyIntoleranceAllergyIntoleranceReactionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentElements(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSubstance()) {
        composeCodeableConcept("substance", element.getSubstance());
      }
      if (element.hasManifestation()) { 
        for (CodeableConcept e : element.getManifestation()) 
          composeCodeableConcept("manifestation", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasOnsetElement()) {
        composeDateTime("onset", element.getOnsetElement());
      }
      if (element.hasSeverityElement())
        composeEnumeration("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory());
      if (element.hasExposureRoute()) {
        composeCodeableConcept("exposureRoute", element.getExposureRoute());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeAppointment(String name, Appointment element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAppointmentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAppointmentElements(Appointment element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory());
      if (element.hasServiceCategory()) {
        composeCodeableConcept("serviceCategory", element.getServiceCategory());
      }
      if (element.hasServiceType()) { 
        for (CodeableConcept e : element.getServiceType()) 
          composeCodeableConcept("serviceType", e);
      }
      if (element.hasSpecialty()) { 
        for (CodeableConcept e : element.getSpecialty()) 
          composeCodeableConcept("specialty", e);
      }
      if (element.hasAppointmentType()) {
        composeCodeableConcept("appointmentType", element.getAppointmentType());
      }
      if (element.hasReason()) { 
        for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
      }
      if (element.hasIndication()) { 
        for (Reference e : element.getIndication()) 
          composeReference("indication", e);
      }
      if (element.hasPriorityElement()) {
        composeUnsignedInt("priority", element.getPriorityElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasSupportingInformation()) { 
        for (Reference e : element.getSupportingInformation()) 
          composeReference("supportingInformation", e);
      }
      if (element.hasStartElement()) {
        composeInstant("start", element.getStartElement());
      }
      if (element.hasEndElement()) {
        composeInstant("end", element.getEndElement());
      }
      if (element.hasMinutesDurationElement()) {
        composePositiveInt("minutesDuration", element.getMinutesDurationElement());
      }
      if (element.hasSlot()) { 
        for (Reference e : element.getSlot()) 
          composeReference("slot", e);
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
      if (element.hasIncomingReferral()) { 
        for (Reference e : element.getIncomingReferral()) 
          composeReference("incomingReferral", e);
      }
      if (element.hasParticipant()) { 
        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
          composeAppointmentAppointmentParticipantComponent("participant", e);
      }
      if (element.hasRequestedPeriod()) { 
        for (Period e : element.getRequestedPeriod()) 
          composePeriod("requestedPeriod", e);
      }
  }

  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAppointmentAppointmentParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAppointmentAppointmentParticipantComponentElements(Appointment.AppointmentParticipantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
      if (element.hasRequiredElement())
        composeEnumeration("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory());
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory());
  }

  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAppointmentResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAppointmentResponseElements(AppointmentResponse element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasAppointment()) {
        composeReference("appointment", element.getAppointment());
      }
      if (element.hasStartElement()) {
        composeInstant("start", element.getStartElement());
      }
      if (element.hasEndElement()) {
        composeInstant("end", element.getEndElement());
      }
      if (element.hasParticipantType()) { 
        for (CodeableConcept e : element.getParticipantType()) 
          composeCodeableConcept("participantType", e);
      }
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
      if (element.hasParticipantStatusElement())
        composeEnumeration("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory());
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventElements(AuditEvent element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasType()) {
        composeCoding("type", element.getType());
      }
      if (element.hasSubtype()) { 
        for (Coding e : element.getSubtype()) 
          composeCoding("subtype", e);
      }
      if (element.hasActionElement())
        composeEnumeration("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory());
      if (element.hasRecordedElement()) {
        composeInstant("recorded", element.getRecordedElement());
      }
      if (element.hasOutcomeElement())
        composeEnumeration("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory());
      if (element.hasOutcomeDescElement()) {
        composeString("outcomeDesc", element.getOutcomeDescElement());
      }
      if (element.hasPurposeOfEvent()) { 
        for (CodeableConcept e : element.getPurposeOfEvent()) 
          composeCodeableConcept("purposeOfEvent", e);
      }
      if (element.hasAgent()) { 
        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
          composeAuditEventAuditEventAgentComponent("agent", e);
      }
      if (element.hasSource()) {
        composeAuditEventAuditEventSourceComponent("source", element.getSource());
      }
      if (element.hasEntity()) { 
        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
          composeAuditEventAuditEventEntityComponent("entity", e);
      }
  }

  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventAuditEventAgentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventAuditEventAgentComponentElements(AuditEvent.AuditEventAgentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) { 
        for (CodeableConcept e : element.getRole()) 
          composeCodeableConcept("role", e);
      }
      if (element.hasReference()) {
        composeReference("reference", element.getReference());
      }
      if (element.hasUserId()) {
        composeIdentifier("userId", element.getUserId());
      }
      if (element.hasAltIdElement()) {
        composeString("altId", element.getAltIdElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasRequestorElement()) {
        composeBoolean("requestor", element.getRequestorElement());
      }
      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasPolicy()) { 
        for (UriType e : element.getPolicy()) 
          composeUri("policy", e);
      }
      if (element.hasMedia()) {
        composeCoding("media", element.getMedia());
      }
      if (element.hasNetwork()) {
        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
      }
      if (element.hasPurposeOfUse()) { 
        for (CodeableConcept e : element.getPurposeOfUse()) 
          composeCodeableConcept("purposeOfUse", e);
      }
  }

  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventAuditEventAgentNetworkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventAuditEventAgentNetworkComponentElements(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAddressElement()) {
        composeString("address", element.getAddressElement());
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory());
  }

  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventAuditEventSourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventAuditEventSourceComponentElements(AuditEvent.AuditEventSourceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSiteElement()) {
        composeString("site", element.getSiteElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasType()) { 
        for (Coding e : element.getType()) 
          composeCoding("type", e);
      }
  }

  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventAuditEventEntityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventAuditEventEntityComponentElements(AuditEvent.AuditEventEntityComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasReference()) {
        composeReference("reference", element.getReference());
      }
      if (element.hasType()) {
        composeCoding("type", element.getType());
      }
      if (element.hasRole()) {
        composeCoding("role", element.getRole());
      }
      if (element.hasLifecycle()) {
        composeCoding("lifecycle", element.getLifecycle());
      }
      if (element.hasSecurityLabel()) { 
        for (Coding e : element.getSecurityLabel()) 
          composeCoding("securityLabel", e);
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasQueryElement()) {
        composeBase64Binary("query", element.getQueryElement());
      }
      if (element.hasDetail()) { 
        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
          composeAuditEventAuditEventEntityDetailComponent("detail", e);
      }
  }

  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventAuditEventEntityDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventAuditEventEntityDetailComponentElements(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement()) {
        composeString("type", element.getTypeElement());
      }
      if (element.hasValueElement()) {
        composeBase64Binary("value", element.getValueElement());
      }
  }

  protected void composeBasic(String name, Basic element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBasicElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBasicElements(Basic element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasCreatedElement()) {
        composeDate("created", element.getCreatedElement());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
  }

  protected void composeBinary(String name, Binary element) throws IOException {
    if (element != null) {
      composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBinaryElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBinaryElements(Binary element) throws IOException {
      composeResourceElements(element);
      if (element.hasContentTypeElement()) {
        composeCode("contentType", element.getContentTypeElement());
      }
      if (element.hasSecurityContext()) {
        composeReference("securityContext", element.getSecurityContext());
      }
      if (element.hasContentElement()) {
        composeBase64Binary("content", element.getContentElement());
      }
  }

  protected void composeBodySite(String name, BodySite element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBodySiteElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBodySiteElements(BodySite element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasQualifier()) { 
        for (CodeableConcept e : element.getQualifier()) 
          composeCodeableConcept("qualifier", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasImage()) { 
        for (Attachment e : element.getImage()) 
          composeAttachment("image", e);
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
  }

  protected void composeBundle(String name, Bundle element) throws IOException {
    if (element != null) {
      composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleElements(Bundle element) throws IOException {
      composeResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory());
      if (element.hasTotalElement()) {
        composeUnsignedInt("total", element.getTotalElement());
      }
      if (element.hasLink()) { 
        for (Bundle.BundleLinkComponent e : element.getLink()) 
          composeBundleBundleLinkComponent("link", e);
      }
      if (element.hasEntry()) { 
        for (Bundle.BundleEntryComponent e : element.getEntry()) 
          composeBundleBundleEntryComponent("entry", e);
      }
      if (element.hasSignature()) {
        composeSignature("signature", element.getSignature());
      }
  }

  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleBundleLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleBundleLinkComponentElements(Bundle.BundleLinkComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRelationElement()) {
        composeString("relation", element.getRelationElement());
      }
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
  }

  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleBundleEntryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleBundleEntryComponentElements(Bundle.BundleEntryComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLink()) { 
        for (Bundle.BundleLinkComponent e : element.getLink()) 
          composeBundleBundleLinkComponent("link", e);
      }
      if (element.hasFullUrlElement()) {
        composeUri("fullUrl", element.getFullUrlElement());
      }
      if (element.hasResource()) {
        xml.enter(FHIR_NS, "resource");
        composeResource(element.getResource());
        xml.exit(FHIR_NS, "resource");
      }
      if (element.hasSearch()) {
        composeBundleBundleEntrySearchComponent("search", element.getSearch());
      }
      if (element.hasRequest()) {
        composeBundleBundleEntryRequestComponent("request", element.getRequest());
      }
      if (element.hasResponse()) {
        composeBundleBundleEntryResponseComponent("response", element.getResponse());
      }
  }

  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleBundleEntrySearchComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleBundleEntrySearchComponentElements(Bundle.BundleEntrySearchComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory());
      if (element.hasScoreElement()) {
        composeDecimal("score", element.getScoreElement());
      }
  }

  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleBundleEntryRequestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleBundleEntryRequestComponentElements(Bundle.BundleEntryRequestComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasMethodElement())
        composeEnumeration("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory());
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIfNoneMatchElement()) {
        composeString("ifNoneMatch", element.getIfNoneMatchElement());
      }
      if (element.hasIfModifiedSinceElement()) {
        composeInstant("ifModifiedSince", element.getIfModifiedSinceElement());
      }
      if (element.hasIfMatchElement()) {
        composeString("ifMatch", element.getIfMatchElement());
      }
      if (element.hasIfNoneExistElement()) {
        composeString("ifNoneExist", element.getIfNoneExistElement());
      }
  }

  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleBundleEntryResponseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleBundleEntryResponseComponentElements(Bundle.BundleEntryResponseComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasStatusElement()) {
        composeString("status", element.getStatusElement());
      }
      if (element.hasLocationElement()) {
        composeUri("location", element.getLocationElement());
      }
      if (element.hasEtagElement()) {
        composeString("etag", element.getEtagElement());
      }
      if (element.hasLastModifiedElement()) {
        composeInstant("lastModified", element.getLastModifiedElement());
      }
      if (element.hasOutcome()) {
        xml.enter(FHIR_NS, "outcome");
        composeResource(element.getOutcome());
        xml.exit(FHIR_NS, "outcome");
      }
  }

  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementElements(CapabilityStatement element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory());
      if (element.hasInstantiates()) { 
        for (UriType e : element.getInstantiates()) 
          composeUri("instantiates", e);
      }
      if (element.hasSoftware()) {
        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
      }
      if (element.hasImplementation()) {
        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
      }
      if (element.hasFhirVersionElement()) {
        composeId("fhirVersion", element.getFhirVersionElement());
      }
      if (element.hasAcceptUnknownElement())
        composeEnumeration("acceptUnknown", element.getAcceptUnknownElement(), new CapabilityStatement.UnknownContentCodeEnumFactory());
      if (element.hasFormat()) { 
        for (CodeType e : element.getFormat()) 
          composeCode("format", e);
      }
      if (element.hasPatchFormat()) { 
        for (CodeType e : element.getPatchFormat()) 
          composeCode("patchFormat", e);
      }
      if (element.hasImplementationGuide()) { 
        for (UriType e : element.getImplementationGuide()) 
          composeUri("implementationGuide", e);
      }
      if (element.hasProfile()) { 
        for (Reference e : element.getProfile()) 
          composeReference("profile", e);
      }
      if (element.hasRest()) { 
        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
          composeCapabilityStatementCapabilityStatementRestComponent("rest", e);
      }
      if (element.hasMessaging()) { 
        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
          composeCapabilityStatementCapabilityStatementMessagingComponent("messaging", e);
      }
      if (element.hasDocument()) { 
        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
          composeCapabilityStatementCapabilityStatementDocumentComponent("document", e);
      }
  }

  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementSoftwareComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentElements(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasReleaseDateElement()) {
        composeDateTime("releaseDate", element.getReleaseDateElement());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementImplementationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementImplementationComponentElements(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementRestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestComponentElements(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory());
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
      if (element.hasSecurity()) {
        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
      }
      if (element.hasResource()) { 
        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
          composeCapabilityStatementCapabilityStatementRestResourceComponent("resource", e);
      }
      if (element.hasInteraction()) { 
        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
          composeCapabilityStatementSystemInteractionComponent("interaction", e);
      }
      if (element.hasSearchParam()) { 
        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent("searchParam", e);
      }
      if (element.hasOperation()) { 
        for (CapabilityStatement.CapabilityStatementRestOperationComponent e : element.getOperation()) 
          composeCapabilityStatementCapabilityStatementRestOperationComponent("operation", e);
      }
      if (element.hasCompartment()) { 
        for (UriType e : element.getCompartment()) 
          composeUri("compartment", e);
      }
  }

  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementRestSecurityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentElements(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCorsElement()) {
        composeBoolean("cors", element.getCorsElement());
      }
      if (element.hasService()) { 
        for (CodeableConcept e : element.getService()) 
          composeCodeableConcept("service", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasCertificate()) { 
        for (CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent e : element.getCertificate()) 
          composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent("certificate", e);
      }
  }

  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentElements(CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasBlobElement()) {
        composeBase64Binary("blob", element.getBlobElement());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementRestResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentElements(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasProfile()) {
        composeReference("profile", element.getProfile());
      }
      if (element.hasDocumentationElement()) {
        composeMarkdown("documentation", element.getDocumentationElement());
      }
      if (element.hasInteraction()) { 
        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
          composeCapabilityStatementResourceInteractionComponent("interaction", e);
      }
      if (element.hasVersioningElement())
        composeEnumeration("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory());
      if (element.hasReadHistoryElement()) {
        composeBoolean("readHistory", element.getReadHistoryElement());
      }
      if (element.hasUpdateCreateElement()) {
        composeBoolean("updateCreate", element.getUpdateCreateElement());
      }
      if (element.hasConditionalCreateElement()) {
        composeBoolean("conditionalCreate", element.getConditionalCreateElement());
      }
      if (element.hasConditionalReadElement())
        composeEnumeration("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory());
      if (element.hasConditionalUpdateElement()) {
        composeBoolean("conditionalUpdate", element.getConditionalUpdateElement());
      }
      if (element.hasConditionalDeleteElement())
        composeEnumeration("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory());
        if (element.hasReferencePolicy()) 
          for (Enumeration e : element.getReferencePolicy()) 
            composeEnumeration("referencePolicy", e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory());
      if (element.hasSearchInclude()) { 
        for (StringType e : element.getSearchInclude()) 
          composeString("searchInclude", e);
      }
      if (element.hasSearchRevInclude()) { 
        for (StringType e : element.getSearchRevInclude()) 
          composeString("searchRevInclude", e);
      }
      if (element.hasSearchParam()) { 
        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent("searchParam", e);
      }
  }

  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementResourceInteractionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementResourceInteractionComponentElements(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory());
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentElements(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDefinitionElement()) {
        composeUri("definition", element.getDefinitionElement());
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory());
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementSystemInteractionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementSystemInteractionComponentElements(CapabilityStatement.SystemInteractionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory());
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementRestOperationComponent(String name, CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementRestOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestOperationComponentElements(CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDefinition()) {
        composeReference("definition", element.getDefinition());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementMessagingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingComponentElements(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasEndpoint()) { 
        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent("endpoint", e);
      }
      if (element.hasReliableCacheElement()) {
        composeUnsignedInt("reliableCache", element.getReliableCacheElement());
      }
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
      if (element.hasSupportedMessage()) { 
        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent("supportedMessage", e);
      }
      if (element.hasEvent()) { 
        for (CapabilityStatement.CapabilityStatementMessagingEventComponent e : element.getEvent()) 
          composeCapabilityStatementCapabilityStatementMessagingEventComponent("event", e);
      }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentElements(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasProtocol()) {
        composeCoding("protocol", element.getProtocol());
      }
      if (element.hasAddressElement()) {
        composeUri("address", element.getAddressElement());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentElements(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory());
      if (element.hasDefinition()) {
        composeReference("definition", element.getDefinition());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponent(String name, CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementMessagingEventComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponentElements(CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) {
        composeCoding("code", element.getCode());
      }
      if (element.hasCategoryElement())
        composeEnumeration("category", element.getCategoryElement(), new CapabilityStatement.MessageSignificanceCategoryEnumFactory());
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory());
      if (element.hasFocusElement()) {
        composeCode("focus", element.getFocusElement());
      }
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasResponse()) {
        composeReference("response", element.getResponse());
      }
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementDocumentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementDocumentComponentElements(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory());
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
      if (element.hasProfile()) {
        composeReference("profile", element.getProfile());
      }
  }

  protected void composeCarePlan(String name, CarePlan element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCarePlanElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCarePlanElements(CarePlan element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasReplaces()) { 
        for (Reference e : element.getReplaces()) 
          composeReference("replaces", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory());
      if (element.hasIntentElement())
        composeEnumeration("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasAuthor()) { 
        for (Reference e : element.getAuthor()) 
          composeReference("author", e);
      }
      if (element.hasCareTeam()) { 
        for (Reference e : element.getCareTeam()) 
          composeReference("careTeam", e);
      }
      if (element.hasAddresses()) { 
        for (Reference e : element.getAddresses()) 
          composeReference("addresses", e);
      }
      if (element.hasSupportingInfo()) { 
        for (Reference e : element.getSupportingInfo()) 
          composeReference("supportingInfo", e);
      }
      if (element.hasGoal()) { 
        for (Reference e : element.getGoal()) 
          composeReference("goal", e);
      }
      if (element.hasActivity()) { 
        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
          composeCarePlanCarePlanActivityComponent("activity", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCarePlanCarePlanActivityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCarePlanCarePlanActivityComponentElements(CarePlan.CarePlanActivityComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOutcomeCodeableConcept()) { 
        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
          composeCodeableConcept("outcomeCodeableConcept", e);
      }
      if (element.hasOutcomeReference()) { 
        for (Reference e : element.getOutcomeReference()) 
          composeReference("outcomeReference", e);
      }
      if (element.hasProgress()) { 
        for (Annotation e : element.getProgress()) 
          composeAnnotation("progress", e);
      }
      if (element.hasReference()) {
        composeReference("reference", element.getReference());
      }
      if (element.hasDetail()) {
        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
      }
  }

  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCarePlanCarePlanActivityDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCarePlanCarePlanActivityDetailComponentElements(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasDefinition()) {
        composeReference("definition", element.getDefinition());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasGoal()) { 
        for (Reference e : element.getGoal()) 
          composeReference("goal", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory());
      if (element.hasStatusReasonElement()) {
        composeString("statusReason", element.getStatusReasonElement());
      }
      if (element.hasProhibitedElement()) {
        composeBoolean("prohibited", element.getProhibitedElement());
      }
      if (element.hasScheduled()) {
        composeType("scheduled", element.getScheduled());
      }      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasPerformer()) { 
        for (Reference e : element.getPerformer()) 
          composeReference("performer", e);
      }
      if (element.hasProduct()) {
        composeType("product", element.getProduct());
      }      if (element.hasDailyAmount()) {
        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
  }

  protected void composeCareTeam(String name, CareTeam element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCareTeamElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCareTeamElements(CareTeam element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasParticipant()) { 
        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
          composeCareTeamCareTeamParticipantComponent("participant", e);
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasManagingOrganization()) { 
        for (Reference e : element.getManagingOrganization()) 
          composeReference("managingOrganization", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCareTeamCareTeamParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCareTeamCareTeamParticipantComponentElements(CareTeam.CareTeamParticipantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasMember()) {
        composeReference("member", element.getMember());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemElements(ChargeItem element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasDefinition()) { 
        for (UriType e : element.getDefinition()) 
          composeUri("definition", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory());
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasParticipant()) { 
        for (ChargeItem.ChargeItemParticipantComponent e : element.getParticipant()) 
          composeChargeItemChargeItemParticipantComponent("participant", e);
      }
      if (element.hasPerformingOrganization()) {
        composeReference("performingOrganization", element.getPerformingOrganization());
      }
      if (element.hasRequestingOrganization()) {
        composeReference("requestingOrganization", element.getRequestingOrganization());
      }
      if (element.hasQuantity()) {
        composeQuantity("quantity", element.getQuantity());
      }
      if (element.hasBodysite()) { 
        for (CodeableConcept e : element.getBodysite()) 
          composeCodeableConcept("bodysite", e);
      }
      if (element.hasFactorOverrideElement()) {
        composeDecimal("factorOverride", element.getFactorOverrideElement());
      }
      if (element.hasPriceOverride()) {
        composeMoney("priceOverride", element.getPriceOverride());
      }
      if (element.hasOverrideReasonElement()) {
        composeString("overrideReason", element.getOverrideReasonElement());
      }
      if (element.hasEnterer()) {
        composeReference("enterer", element.getEnterer());
      }
      if (element.hasEnteredDateElement()) {
        composeDateTime("enteredDate", element.getEnteredDateElement());
      }
      if (element.hasReason()) { 
        for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
      }
      if (element.hasService()) { 
        for (Reference e : element.getService()) 
          composeReference("service", e);
      }
      if (element.hasAccount()) { 
        for (Reference e : element.getAccount()) 
          composeReference("account", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasSupportingInformation()) { 
        for (Reference e : element.getSupportingInformation()) 
          composeReference("supportingInformation", e);
      }
  }

  protected void composeChargeItemChargeItemParticipantComponent(String name, ChargeItem.ChargeItemParticipantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemChargeItemParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemChargeItemParticipantComponentElements(ChargeItem.ChargeItemParticipantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
  }

  protected void composeClaim(String name, Claim element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimElements(Claim element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSubType()) { 
        for (CodeableConcept e : element.getSubType()) 
          composeCodeableConcept("subType", e);
      }
      if (element.hasUseElement())
        composeEnumeration("use", element.getUseElement(), new Claim.UseEnumFactory());
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasBillablePeriod()) {
        composePeriod("billablePeriod", element.getBillablePeriod());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasEnterer()) {
        composeReference("enterer", element.getEnterer());
      }
      if (element.hasInsurer()) {
        composeReference("insurer", element.getInsurer());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasPriority()) {
        composeCodeableConcept("priority", element.getPriority());
      }
      if (element.hasFundsReserve()) {
        composeCodeableConcept("fundsReserve", element.getFundsReserve());
      }
      if (element.hasRelated()) { 
        for (Claim.RelatedClaimComponent e : element.getRelated()) 
          composeClaimRelatedClaimComponent("related", e);
      }
      if (element.hasPrescription()) {
        composeReference("prescription", element.getPrescription());
      }
      if (element.hasOriginalPrescription()) {
        composeReference("originalPrescription", element.getOriginalPrescription());
      }
      if (element.hasPayee()) {
        composeClaimPayeeComponent("payee", element.getPayee());
      }
      if (element.hasReferral()) {
        composeReference("referral", element.getReferral());
      }
      if (element.hasFacility()) {
        composeReference("facility", element.getFacility());
      }
      if (element.hasCareTeam()) { 
        for (Claim.CareTeamComponent e : element.getCareTeam()) 
          composeClaimCareTeamComponent("careTeam", e);
      }
      if (element.hasInformation()) { 
        for (Claim.SpecialConditionComponent e : element.getInformation()) 
          composeClaimSpecialConditionComponent("information", e);
      }
      if (element.hasDiagnosis()) { 
        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
          composeClaimDiagnosisComponent("diagnosis", e);
      }
      if (element.hasProcedure()) { 
        for (Claim.ProcedureComponent e : element.getProcedure()) 
          composeClaimProcedureComponent("procedure", e);
      }
      if (element.hasInsurance()) { 
        for (Claim.InsuranceComponent e : element.getInsurance()) 
          composeClaimInsuranceComponent("insurance", e);
      }
      if (element.hasAccident()) {
        composeClaimAccidentComponent("accident", element.getAccident());
      }
      if (element.hasEmploymentImpacted()) {
        composePeriod("employmentImpacted", element.getEmploymentImpacted());
      }
      if (element.hasHospitalization()) {
        composePeriod("hospitalization", element.getHospitalization());
      }
      if (element.hasItem()) { 
        for (Claim.ItemComponent e : element.getItem()) 
          composeClaimItemComponent("item", e);
      }
      if (element.hasTotal()) {
        composeMoney("total", element.getTotal());
      }
  }

  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimRelatedClaimComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimRelatedClaimComponentElements(Claim.RelatedClaimComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasClaim()) {
        composeReference("claim", element.getClaim());
      }
      if (element.hasRelationship()) {
        composeCodeableConcept("relationship", element.getRelationship());
      }
      if (element.hasReference()) {
        composeIdentifier("reference", element.getReference());
      }
  }

  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimPayeeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimPayeeComponentElements(Claim.PayeeComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasResourceType()) {
        composeCoding("resourceType", element.getResourceType());
      }
      if (element.hasParty()) {
        composeReference("party", element.getParty());
      }
  }

  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimCareTeamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimCareTeamComponentElements(Claim.CareTeamComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasResponsibleElement()) {
        composeBoolean("responsible", element.getResponsibleElement());
      }
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasQualification()) {
        composeCodeableConcept("qualification", element.getQualification());
      }
  }

  protected void composeClaimSpecialConditionComponent(String name, Claim.SpecialConditionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimSpecialConditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimSpecialConditionComponentElements(Claim.SpecialConditionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasTiming()) {
        composeType("timing", element.getTiming());
      }      if (element.hasValue()) {
        composeType("value", element.getValue());
      }      if (element.hasReason()) {
        composeCodeableConcept("reason", element.getReason());
      }
  }

  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimDiagnosisComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimDiagnosisComponentElements(Claim.DiagnosisComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasDiagnosis()) {
        composeType("diagnosis", element.getDiagnosis());
      }      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasPackageCode()) {
        composeCodeableConcept("packageCode", element.getPackageCode());
      }
  }

  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimProcedureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimProcedureComponentElements(Claim.ProcedureComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasProcedure()) {
        composeType("procedure", element.getProcedure());
      }  }

  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimInsuranceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimInsuranceComponentElements(Claim.InsuranceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasFocalElement()) {
        composeBoolean("focal", element.getFocalElement());
      }
      if (element.hasCoverage()) {
        composeReference("coverage", element.getCoverage());
      }
      if (element.hasBusinessArrangementElement()) {
        composeString("businessArrangement", element.getBusinessArrangementElement());
      }
      if (element.hasPreAuthRef()) { 
        for (StringType e : element.getPreAuthRef()) 
          composeString("preAuthRef", e);
      }
      if (element.hasClaimResponse()) {
        composeReference("claimResponse", element.getClaimResponse());
      }
  }

  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimAccidentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimAccidentComponentElements(Claim.AccidentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDateElement()) {
        composeDate("date", element.getDateElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasLocation()) {
        composeType("location", element.getLocation());
      }  }

  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimItemComponentElements(Claim.ItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasCareTeamLinkId()) { 
        for (PositiveIntType e : element.getCareTeamLinkId()) 
          composePositiveInt("careTeamLinkId", e);
      }
      if (element.hasDiagnosisLinkId()) { 
        for (PositiveIntType e : element.getDiagnosisLinkId()) 
          composePositiveInt("diagnosisLinkId", e);
      }
      if (element.hasProcedureLinkId()) { 
        for (PositiveIntType e : element.getProcedureLinkId()) 
          composePositiveInt("procedureLinkId", e);
      }
      if (element.hasInformationLinkId()) { 
        for (PositiveIntType e : element.getInformationLinkId()) 
          composePositiveInt("informationLinkId", e);
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasProgramCode()) { 
        for (CodeableConcept e : element.getProgramCode()) 
          composeCodeableConcept("programCode", e);
      }
      if (element.hasServiced()) {
        composeType("serviced", element.getServiced());
      }      if (element.hasLocation()) {
        composeType("location", element.getLocation());
      }      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
      if (element.hasUdi()) { 
        for (Reference e : element.getUdi()) 
          composeReference("udi", e);
      }
      if (element.hasBodySite()) {
        composeCodeableConcept("bodySite", element.getBodySite());
      }
      if (element.hasSubSite()) { 
        for (CodeableConcept e : element.getSubSite()) 
          composeCodeableConcept("subSite", e);
      }
      if (element.hasEncounter()) { 
        for (Reference e : element.getEncounter()) 
          composeReference("encounter", e);
      }
      if (element.hasDetail()) { 
        for (Claim.DetailComponent e : element.getDetail()) 
          composeClaimDetailComponent("detail", e);
      }
  }

  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimDetailComponentElements(Claim.DetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasProgramCode()) { 
        for (CodeableConcept e : element.getProgramCode()) 
          composeCodeableConcept("programCode", e);
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
      if (element.hasUdi()) { 
        for (Reference e : element.getUdi()) 
          composeReference("udi", e);
      }
      if (element.hasSubDetail()) { 
        for (Claim.SubDetailComponent e : element.getSubDetail()) 
          composeClaimSubDetailComponent("subDetail", e);
      }
  }

  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimSubDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimSubDetailComponentElements(Claim.SubDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasProgramCode()) { 
        for (CodeableConcept e : element.getProgramCode()) 
          composeCodeableConcept("programCode", e);
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
      if (element.hasUdi()) { 
        for (Reference e : element.getUdi()) 
          composeReference("udi", e);
      }
  }

  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseElements(ClaimResponse element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory());
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasInsurer()) {
        composeReference("insurer", element.getInsurer());
      }
      if (element.hasRequestProvider()) {
        composeReference("requestProvider", element.getRequestProvider());
      }
      if (element.hasRequestOrganization()) {
        composeReference("requestOrganization", element.getRequestOrganization());
      }
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasDispositionElement()) {
        composeString("disposition", element.getDispositionElement());
      }
      if (element.hasPayeeType()) {
        composeCodeableConcept("payeeType", element.getPayeeType());
      }
      if (element.hasItem()) { 
        for (ClaimResponse.ItemComponent e : element.getItem()) 
          composeClaimResponseItemComponent("item", e);
      }
      if (element.hasAddItem()) { 
        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
          composeClaimResponseAddedItemComponent("addItem", e);
      }
      if (element.hasError()) { 
        for (ClaimResponse.ErrorComponent e : element.getError()) 
          composeClaimResponseErrorComponent("error", e);
      }
      if (element.hasTotalCost()) {
        composeMoney("totalCost", element.getTotalCost());
      }
      if (element.hasUnallocDeductable()) {
        composeMoney("unallocDeductable", element.getUnallocDeductable());
      }
      if (element.hasTotalBenefit()) {
        composeMoney("totalBenefit", element.getTotalBenefit());
      }
      if (element.hasPayment()) {
        composeClaimResponsePaymentComponent("payment", element.getPayment());
      }
      if (element.hasReserved()) {
        composeCoding("reserved", element.getReserved());
      }
      if (element.hasForm()) {
        composeCodeableConcept("form", element.getForm());
      }
      if (element.hasProcessNote()) { 
        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
          composeClaimResponseNoteComponent("processNote", e);
      }
      if (element.hasCommunicationRequest()) { 
        for (Reference e : element.getCommunicationRequest()) 
          composeReference("communicationRequest", e);
      }
      if (element.hasInsurance()) { 
        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
          composeClaimResponseInsuranceComponent("insurance", e);
      }
  }

  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseItemComponentElements(ClaimResponse.ItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceLinkIdElement()) {
        composePositiveInt("sequenceLinkId", element.getSequenceLinkIdElement());
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
          composeClaimResponseAdjudicationComponent("adjudication", e);
      }
      if (element.hasDetail()) { 
        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
          composeClaimResponseItemDetailComponent("detail", e);
      }
  }

  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseAdjudicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseAdjudicationComponentElements(ClaimResponse.AdjudicationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasReason()) {
        composeCodeableConcept("reason", element.getReason());
      }
      if (element.hasAmount()) {
        composeMoney("amount", element.getAmount());
      }
      if (element.hasValueElement()) {
        composeDecimal("value", element.getValueElement());
      }
  }

  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseItemDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseItemDetailComponentElements(ClaimResponse.ItemDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceLinkIdElement()) {
        composePositiveInt("sequenceLinkId", element.getSequenceLinkIdElement());
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
          composeClaimResponseAdjudicationComponent("adjudication", e);
      }
      if (element.hasSubDetail()) { 
        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
          composeClaimResponseSubDetailComponent("subDetail", e);
      }
  }

  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseSubDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseSubDetailComponentElements(ClaimResponse.SubDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceLinkIdElement()) {
        composePositiveInt("sequenceLinkId", element.getSequenceLinkIdElement());
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
          composeClaimResponseAdjudicationComponent("adjudication", e);
      }
  }

  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseAddedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseAddedItemComponentElements(ClaimResponse.AddedItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceLinkId()) { 
        for (PositiveIntType e : element.getSequenceLinkId()) 
          composePositiveInt("sequenceLinkId", e);
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasFee()) {
        composeMoney("fee", element.getFee());
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
          composeClaimResponseAdjudicationComponent("adjudication", e);
      }
      if (element.hasDetail()) { 
        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
          composeClaimResponseAddedItemsDetailComponent("detail", e);
      }
  }

  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseAddedItemsDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseAddedItemsDetailComponentElements(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasFee()) {
        composeMoney("fee", element.getFee());
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
          composeClaimResponseAdjudicationComponent("adjudication", e);
      }
  }

  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseErrorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseErrorComponentElements(ClaimResponse.ErrorComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceLinkIdElement()) {
        composePositiveInt("sequenceLinkId", element.getSequenceLinkIdElement());
      }
      if (element.hasDetailSequenceLinkIdElement()) {
        composePositiveInt("detailSequenceLinkId", element.getDetailSequenceLinkIdElement());
      }
      if (element.hasSubdetailSequenceLinkIdElement()) {
        composePositiveInt("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
  }

  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponsePaymentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponsePaymentComponentElements(ClaimResponse.PaymentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasAdjustment()) {
        composeMoney("adjustment", element.getAdjustment());
      }
      if (element.hasAdjustmentReason()) {
        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
      }
      if (element.hasDateElement()) {
        composeDate("date", element.getDateElement());
      }
      if (element.hasAmount()) {
        composeMoney("amount", element.getAmount());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
  }

  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseNoteComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseNoteComponentElements(ClaimResponse.NoteComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNumberElement()) {
        composePositiveInt("number", element.getNumberElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasLanguage()) {
        composeCodeableConcept("language", element.getLanguage());
      }
  }

  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseInsuranceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseInsuranceComponentElements(ClaimResponse.InsuranceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasFocalElement()) {
        composeBoolean("focal", element.getFocalElement());
      }
      if (element.hasCoverage()) {
        composeReference("coverage", element.getCoverage());
      }
      if (element.hasBusinessArrangementElement()) {
        composeString("businessArrangement", element.getBusinessArrangementElement());
      }
      if (element.hasPreAuthRef()) { 
        for (StringType e : element.getPreAuthRef()) 
          composeString("preAuthRef", e);
      }
      if (element.hasClaimResponse()) {
        composeReference("claimResponse", element.getClaimResponse());
      }
  }

  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalImpressionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalImpressionElements(ClinicalImpression element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory());
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasEffective()) {
        composeType("effective", element.getEffective());
      }      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasAssessor()) {
        composeReference("assessor", element.getAssessor());
      }
      if (element.hasPrevious()) {
        composeReference("previous", element.getPrevious());
      }
      if (element.hasProblem()) { 
        for (Reference e : element.getProblem()) 
          composeReference("problem", e);
      }
      if (element.hasInvestigation()) { 
        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
          composeClinicalImpressionClinicalImpressionInvestigationComponent("investigation", e);
      }
      if (element.hasProtocol()) { 
        for (UriType e : element.getProtocol()) 
          composeUri("protocol", e);
      }
      if (element.hasSummaryElement()) {
        composeString("summary", element.getSummaryElement());
      }
      if (element.hasFinding()) { 
        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
          composeClinicalImpressionClinicalImpressionFindingComponent("finding", e);
      }
      if (element.hasPrognosisCodeableConcept()) { 
        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
          composeCodeableConcept("prognosisCodeableConcept", e);
      }
      if (element.hasPrognosisReference()) { 
        for (Reference e : element.getPrognosisReference()) 
          composeReference("prognosisReference", e);
      }
      if (element.hasAction()) { 
        for (Reference e : element.getAction()) 
          composeReference("action", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalImpressionClinicalImpressionInvestigationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentElements(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasItem()) { 
        for (Reference e : element.getItem()) 
          composeReference("item", e);
      }
  }

  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalImpressionClinicalImpressionFindingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalImpressionClinicalImpressionFindingComponentElements(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasItem()) {
        composeType("item", element.getItem());
      }      if (element.hasBasisElement()) {
        composeString("basis", element.getBasisElement());
      }
  }

  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemElements(CodeSystem element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasCaseSensitiveElement()) {
        composeBoolean("caseSensitive", element.getCaseSensitiveElement());
      }
      if (element.hasValueSetElement()) {
        composeUri("valueSet", element.getValueSetElement());
      }
      if (element.hasHierarchyMeaningElement())
        composeEnumeration("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory());
      if (element.hasCompositionalElement()) {
        composeBoolean("compositional", element.getCompositionalElement());
      }
      if (element.hasVersionNeededElement()) {
        composeBoolean("versionNeeded", element.getVersionNeededElement());
      }
      if (element.hasContentElement())
        composeEnumeration("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory());
      if (element.hasCountElement()) {
        composeUnsignedInt("count", element.getCountElement());
      }
      if (element.hasFilter()) { 
        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
          composeCodeSystemCodeSystemFilterComponent("filter", e);
      }
      if (element.hasProperty()) { 
        for (CodeSystem.PropertyComponent e : element.getProperty()) 
          composeCodeSystemPropertyComponent("property", e);
      }
      if (element.hasConcept()) { 
        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
          composeCodeSystemConceptDefinitionComponent("concept", e);
      }
  }

  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemCodeSystemFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemCodeSystemFilterComponentElements(CodeSystem.CodeSystemFilterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
        if (element.hasOperator()) 
          for (Enumeration e : element.getOperator()) 
            composeEnumeration("operator", e, new CodeSystem.FilterOperatorEnumFactory());
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemPropertyComponentElements(CodeSystem.PropertyComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasUriElement()) {
        composeUri("uri", element.getUriElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory());
  }

  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemConceptDefinitionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemConceptDefinitionComponentElements(CodeSystem.ConceptDefinitionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasDefinitionElement()) {
        composeString("definition", element.getDefinitionElement());
      }
      if (element.hasDesignation()) { 
        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
          composeCodeSystemConceptDefinitionDesignationComponent("designation", e);
      }
      if (element.hasProperty()) { 
        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
          composeCodeSystemConceptPropertyComponent("property", e);
      }
      if (element.hasConcept()) { 
        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
          composeCodeSystemConceptDefinitionComponent("concept", e);
      }
  }

  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemConceptDefinitionDesignationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemConceptDefinitionDesignationComponentElements(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLanguageElement()) {
        composeCode("language", element.getLanguageElement());
      }
      if (element.hasUse()) {
        composeCoding("use", element.getUse());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemConceptPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemConceptPropertyComponentElements(CodeSystem.ConceptPropertyComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeCommunication(String name, Communication element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCommunicationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCommunicationElements(Communication element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory());
      if (element.hasNotDoneElement()) {
        composeBoolean("notDone", element.getNotDoneElement());
      }
      if (element.hasNotDoneReason()) {
        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
      }
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasMedium()) { 
        for (CodeableConcept e : element.getMedium()) 
          composeCodeableConcept("medium", e);
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasRecipient()) { 
        for (Reference e : element.getRecipient()) 
          composeReference("recipient", e);
      }
      if (element.hasTopic()) { 
        for (Reference e : element.getTopic()) 
          composeReference("topic", e);
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasSentElement()) {
        composeDateTime("sent", element.getSentElement());
      }
      if (element.hasReceivedElement()) {
        composeDateTime("received", element.getReceivedElement());
      }
      if (element.hasSender()) {
        composeReference("sender", element.getSender());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasPayload()) { 
        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
          composeCommunicationCommunicationPayloadComponent("payload", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCommunicationCommunicationPayloadComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCommunicationCommunicationPayloadComponentElements(Communication.CommunicationPayloadComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContent()) {
        composeType("content", element.getContent());
      }  }

  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCommunicationRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCommunicationRequestElements(CommunicationRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasReplaces()) { 
        for (Reference e : element.getReplaces()) 
          composeReference("replaces", e);
      }
      if (element.hasGroupIdentifier()) {
        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory());
      if (element.hasMedium()) { 
        for (CodeableConcept e : element.getMedium()) 
          composeCodeableConcept("medium", e);
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasRecipient()) { 
        for (Reference e : element.getRecipient()) 
          composeReference("recipient", e);
      }
      if (element.hasTopic()) { 
        for (Reference e : element.getTopic()) 
          composeReference("topic", e);
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasPayload()) { 
        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
          composeCommunicationRequestCommunicationRequestPayloadComponent("payload", e);
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasSender()) {
        composeReference("sender", element.getSender());
      }
      if (element.hasRequester()) {
        composeCommunicationRequestCommunicationRequestRequesterComponent("requester", element.getRequester());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCommunicationRequestCommunicationRequestPayloadComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCommunicationRequestCommunicationRequestPayloadComponentElements(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContent()) {
        composeType("content", element.getContent());
      }  }

  protected void composeCommunicationRequestCommunicationRequestRequesterComponent(String name, CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCommunicationRequestCommunicationRequestRequesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCommunicationRequestCommunicationRequestRequesterComponentElements(CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAgent()) {
        composeReference("agent", element.getAgent());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompartmentDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompartmentDefinitionElements(CompartmentDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory());
      if (element.hasSearchElement()) {
        composeBoolean("search", element.getSearchElement());
      }
      if (element.hasResource()) { 
        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
          composeCompartmentDefinitionCompartmentDefinitionResourceComponent("resource", e);
      }
  }

  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompartmentDefinitionCompartmentDefinitionResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentElements(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasParam()) { 
        for (StringType e : element.getParam()) 
          composeString("param", e);
      }
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeComposition(String name, Composition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionElements(Composition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasClass_()) {
        composeCodeableConcept("class", element.getClass_());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasEncounter()) {
        composeReference("encounter", element.getEncounter());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasAuthor()) { 
        for (Reference e : element.getAuthor()) 
          composeReference("author", e);
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasConfidentialityElement())
        composeEnumeration("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory());
      if (element.hasAttester()) { 
        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
          composeCompositionCompositionAttesterComponent("attester", e);
      }
      if (element.hasCustodian()) {
        composeReference("custodian", element.getCustodian());
      }
      if (element.hasRelatesTo()) { 
        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
          composeCompositionCompositionRelatesToComponent("relatesTo", e);
      }
      if (element.hasEvent()) { 
        for (Composition.CompositionEventComponent e : element.getEvent()) 
          composeCompositionCompositionEventComponent("event", e);
      }
      if (element.hasSection()) { 
        for (Composition.SectionComponent e : element.getSection()) 
          composeCompositionSectionComponent("section", e);
      }
  }

  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionCompositionAttesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionCompositionAttesterComponentElements(Composition.CompositionAttesterComponent element) throws IOException {
      composeBackboneElements(element);
        if (element.hasMode()) 
          for (Enumeration e : element.getMode()) 
            composeEnumeration("mode", e, new Composition.CompositionAttestationModeEnumFactory());
      if (element.hasTimeElement()) {
        composeDateTime("time", element.getTimeElement());
      }
      if (element.hasParty()) {
        composeReference("party", element.getParty());
      }
  }

  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionCompositionRelatesToComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionCompositionRelatesToComponentElements(Composition.CompositionRelatesToComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory());
      if (element.hasTarget()) {
        composeType("target", element.getTarget());
      }  }

  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionCompositionEventComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionCompositionEventComponentElements(Composition.CompositionEventComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) { 
        for (CodeableConcept e : element.getCode()) 
          composeCodeableConcept("code", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasDetail()) { 
        for (Reference e : element.getDetail()) 
          composeReference("detail", e);
      }
  }

  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionSectionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionSectionComponentElements(Composition.SectionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasText()) {
        composeNarrative("text", element.getText());
      }
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new Composition.SectionModeEnumFactory());
      if (element.hasOrderedBy()) {
        composeCodeableConcept("orderedBy", element.getOrderedBy());
      }
      if (element.hasEntry()) { 
        for (Reference e : element.getEntry()) 
          composeReference("entry", e);
      }
      if (element.hasEmptyReason()) {
        composeCodeableConcept("emptyReason", element.getEmptyReason());
      }
      if (element.hasSection()) { 
        for (Composition.SectionComponent e : element.getSection()) 
          composeCompositionSectionComponent("section", e);
      }
  }

  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapElements(ConceptMap element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasSource()) {
        composeType("source", element.getSource());
      }      if (element.hasTarget()) {
        composeType("target", element.getTarget());
      }      if (element.hasGroup()) { 
        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
          composeConceptMapConceptMapGroupComponent("group", e);
      }
  }

  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapConceptMapGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapConceptMapGroupComponentElements(ConceptMap.ConceptMapGroupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSourceElement()) {
        composeUri("source", element.getSourceElement());
      }
      if (element.hasSourceVersionElement()) {
        composeString("sourceVersion", element.getSourceVersionElement());
      }
      if (element.hasTargetElement()) {
        composeUri("target", element.getTargetElement());
      }
      if (element.hasTargetVersionElement()) {
        composeString("targetVersion", element.getTargetVersionElement());
      }
      if (element.hasElement()) { 
        for (ConceptMap.SourceElementComponent e : element.getElement()) 
          composeConceptMapSourceElementComponent("element", e);
      }
      if (element.hasUnmapped()) {
        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
      }
  }

  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapSourceElementComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapSourceElementComponentElements(ConceptMap.SourceElementComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasTarget()) { 
        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
          composeConceptMapTargetElementComponent("target", e);
      }
  }

  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapTargetElementComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapTargetElementComponentElements(ConceptMap.TargetElementComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasEquivalenceElement())
        composeEnumeration("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory());
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
      if (element.hasDependsOn()) { 
        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
          composeConceptMapOtherElementComponent("dependsOn", e);
      }
      if (element.hasProduct()) { 
        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
          composeConceptMapOtherElementComponent("product", e);
      }
  }

  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapOtherElementComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapOtherElementComponentElements(ConceptMap.OtherElementComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasPropertyElement()) {
        composeUri("property", element.getPropertyElement());
      }
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasCodeElement()) {
        composeString("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
  }

  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapConceptMapGroupUnmappedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapConceptMapGroupUnmappedComponentElements(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory());
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
  }

  protected void composeCondition(String name, Condition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionElements(Condition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasClinicalStatusElement())
        composeEnumeration("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory());
      if (element.hasVerificationStatusElement())
        composeEnumeration("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasSeverity()) {
        composeCodeableConcept("severity", element.getSeverity());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasBodySite()) { 
        for (CodeableConcept e : element.getBodySite()) 
          composeCodeableConcept("bodySite", e);
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOnset()) {
        composeType("onset", element.getOnset());
      }      if (element.hasAbatement()) {
        composeType("abatement", element.getAbatement());
      }      if (element.hasAssertedDateElement()) {
        composeDateTime("assertedDate", element.getAssertedDateElement());
      }
      if (element.hasAsserter()) {
        composeReference("asserter", element.getAsserter());
      }
      if (element.hasStage()) {
        composeConditionConditionStageComponent("stage", element.getStage());
      }
      if (element.hasEvidence()) { 
        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
          composeConditionConditionEvidenceComponent("evidence", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionConditionStageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionConditionStageComponentElements(Condition.ConditionStageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSummary()) {
        composeCodeableConcept("summary", element.getSummary());
      }
      if (element.hasAssessment()) { 
        for (Reference e : element.getAssessment()) 
          composeReference("assessment", e);
      }
  }

  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionConditionEvidenceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionConditionEvidenceComponentElements(Condition.ConditionEvidenceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) { 
        for (CodeableConcept e : element.getCode()) 
          composeCodeableConcept("code", e);
      }
      if (element.hasDetail()) { 
        for (Reference e : element.getDetail()) 
          composeReference("detail", e);
      }
  }

  protected void composeConsent(String name, Consent element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentElements(Consent element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasDateTimeElement()) {
        composeDateTime("dateTime", element.getDateTimeElement());
      }
      if (element.hasConsentingParty()) { 
        for (Reference e : element.getConsentingParty()) 
          composeReference("consentingParty", e);
      }
      if (element.hasActor()) { 
        for (Consent.ConsentActorComponent e : element.getActor()) 
          composeConsentConsentActorComponent("actor", e);
      }
      if (element.hasAction()) { 
        for (CodeableConcept e : element.getAction()) 
          composeCodeableConcept("action", e);
      }
      if (element.hasOrganization()) { 
        for (Reference e : element.getOrganization()) 
          composeReference("organization", e);
      }
      if (element.hasSource()) {
        composeType("source", element.getSource());
      }      if (element.hasPolicy()) { 
        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
          composeConsentConsentPolicyComponent("policy", e);
      }
      if (element.hasPolicyRuleElement()) {
        composeUri("policyRule", element.getPolicyRuleElement());
      }
      if (element.hasSecurityLabel()) { 
        for (Coding e : element.getSecurityLabel()) 
          composeCoding("securityLabel", e);
      }
      if (element.hasPurpose()) { 
        for (Coding e : element.getPurpose()) 
          composeCoding("purpose", e);
      }
      if (element.hasDataPeriod()) {
        composePeriod("dataPeriod", element.getDataPeriod());
      }
      if (element.hasData()) { 
        for (Consent.ConsentDataComponent e : element.getData()) 
          composeConsentConsentDataComponent("data", e);
      }
      if (element.hasExcept()) { 
        for (Consent.ExceptComponent e : element.getExcept()) 
          composeConsentExceptComponent("except", e);
      }
  }

  protected void composeConsentConsentActorComponent(String name, Consent.ConsentActorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentConsentActorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentConsentActorComponentElements(Consent.ConsentActorComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasReference()) {
        composeReference("reference", element.getReference());
      }
  }

  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentConsentPolicyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentConsentPolicyComponentElements(Consent.ConsentPolicyComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAuthorityElement()) {
        composeUri("authority", element.getAuthorityElement());
      }
      if (element.hasUriElement()) {
        composeUri("uri", element.getUriElement());
      }
  }

  protected void composeConsentConsentDataComponent(String name, Consent.ConsentDataComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentConsentDataComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentConsentDataComponentElements(Consent.ConsentDataComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasMeaningElement())
        composeEnumeration("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory());
      if (element.hasReference()) {
        composeReference("reference", element.getReference());
      }
  }

  protected void composeConsentExceptComponent(String name, Consent.ExceptComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentExceptComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentExceptComponentElements(Consent.ExceptComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Consent.ConsentExceptTypeEnumFactory());
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasActor()) { 
        for (Consent.ExceptActorComponent e : element.getActor()) 
          composeConsentExceptActorComponent("actor", e);
      }
      if (element.hasAction()) { 
        for (CodeableConcept e : element.getAction()) 
          composeCodeableConcept("action", e);
      }
      if (element.hasSecurityLabel()) { 
        for (Coding e : element.getSecurityLabel()) 
          composeCoding("securityLabel", e);
      }
      if (element.hasPurpose()) { 
        for (Coding e : element.getPurpose()) 
          composeCoding("purpose", e);
      }
      if (element.hasClass_()) { 
        for (Coding e : element.getClass_()) 
          composeCoding("class", e);
      }
      if (element.hasCode()) { 
        for (Coding e : element.getCode()) 
          composeCoding("code", e);
      }
      if (element.hasDataPeriod()) {
        composePeriod("dataPeriod", element.getDataPeriod());
      }
      if (element.hasData()) { 
        for (Consent.ExceptDataComponent e : element.getData()) 
          composeConsentExceptDataComponent("data", e);
      }
  }

  protected void composeConsentExceptActorComponent(String name, Consent.ExceptActorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentExceptActorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentExceptActorComponentElements(Consent.ExceptActorComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasReference()) {
        composeReference("reference", element.getReference());
      }
  }

  protected void composeConsentExceptDataComponent(String name, Consent.ExceptDataComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentExceptDataComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentExceptDataComponentElements(Consent.ExceptDataComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasMeaningElement())
        composeEnumeration("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory());
      if (element.hasReference()) {
        composeReference("reference", element.getReference());
      }
  }

  protected void composeContract(String name, Contract element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractElements(Contract element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory());
      if (element.hasIssuedElement()) {
        composeDateTime("issued", element.getIssuedElement());
      }
      if (element.hasApplies()) {
        composePeriod("applies", element.getApplies());
      }
      if (element.hasSubject()) { 
        for (Reference e : element.getSubject()) 
          composeReference("subject", e);
      }
      if (element.hasTopic()) { 
        for (Reference e : element.getTopic()) 
          composeReference("topic", e);
      }
      if (element.hasAuthority()) { 
        for (Reference e : element.getAuthority()) 
          composeReference("authority", e);
      }
      if (element.hasDomain()) { 
        for (Reference e : element.getDomain()) 
          composeReference("domain", e);
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSubType()) { 
        for (CodeableConcept e : element.getSubType()) 
          composeCodeableConcept("subType", e);
      }
      if (element.hasAction()) { 
        for (CodeableConcept e : element.getAction()) 
          composeCodeableConcept("action", e);
      }
      if (element.hasActionReason()) { 
        for (CodeableConcept e : element.getActionReason()) 
          composeCodeableConcept("actionReason", e);
      }
      if (element.hasDecisionType()) {
        composeCodeableConcept("decisionType", element.getDecisionType());
      }
      if (element.hasContentDerivative()) {
        composeCodeableConcept("contentDerivative", element.getContentDerivative());
      }
      if (element.hasSecurityLabel()) { 
        for (Coding e : element.getSecurityLabel()) 
          composeCoding("securityLabel", e);
      }
      if (element.hasAgent()) { 
        for (Contract.AgentComponent e : element.getAgent()) 
          composeContractAgentComponent("agent", e);
      }
      if (element.hasSigner()) { 
        for (Contract.SignatoryComponent e : element.getSigner()) 
          composeContractSignatoryComponent("signer", e);
      }
      if (element.hasValuedItem()) { 
        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
          composeContractValuedItemComponent("valuedItem", e);
      }
      if (element.hasTerm()) { 
        for (Contract.TermComponent e : element.getTerm()) 
          composeContractTermComponent("term", e);
      }
      if (element.hasBinding()) {
        composeType("binding", element.getBinding());
      }      if (element.hasFriendly()) { 
        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
          composeContractFriendlyLanguageComponent("friendly", e);
      }
      if (element.hasLegal()) { 
        for (Contract.LegalLanguageComponent e : element.getLegal()) 
          composeContractLegalLanguageComponent("legal", e);
      }
      if (element.hasRule()) { 
        for (Contract.ComputableLanguageComponent e : element.getRule()) 
          composeContractComputableLanguageComponent("rule", e);
      }
  }

  protected void composeContractAgentComponent(String name, Contract.AgentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractAgentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractAgentComponentElements(Contract.AgentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
      if (element.hasRole()) { 
        for (CodeableConcept e : element.getRole()) 
          composeCodeableConcept("role", e);
      }
  }

  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractSignatoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractSignatoryComponentElements(Contract.SignatoryComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCoding("type", element.getType());
      }
      if (element.hasParty()) {
        composeReference("party", element.getParty());
      }
      if (element.hasSignature()) { 
        for (Signature e : element.getSignature()) 
          composeSignature("signature", e);
      }
  }

  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractValuedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractValuedItemComponentElements(Contract.ValuedItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasEntity()) {
        composeType("entity", element.getEntity());
      }      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasEffectiveTimeElement()) {
        composeDateTime("effectiveTime", element.getEffectiveTimeElement());
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasPointsElement()) {
        composeDecimal("points", element.getPointsElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
  }

  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractTermComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractTermComponentElements(Contract.TermComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasIssuedElement()) {
        composeDateTime("issued", element.getIssuedElement());
      }
      if (element.hasApplies()) {
        composePeriod("applies", element.getApplies());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSubType()) {
        composeCodeableConcept("subType", element.getSubType());
      }
      if (element.hasTopic()) { 
        for (Reference e : element.getTopic()) 
          composeReference("topic", e);
      }
      if (element.hasAction()) { 
        for (CodeableConcept e : element.getAction()) 
          composeCodeableConcept("action", e);
      }
      if (element.hasActionReason()) { 
        for (CodeableConcept e : element.getActionReason()) 
          composeCodeableConcept("actionReason", e);
      }
      if (element.hasSecurityLabel()) { 
        for (Coding e : element.getSecurityLabel()) 
          composeCoding("securityLabel", e);
      }
      if (element.hasAgent()) { 
        for (Contract.TermAgentComponent e : element.getAgent()) 
          composeContractTermAgentComponent("agent", e);
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasValuedItem()) { 
        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
          composeContractTermValuedItemComponent("valuedItem", e);
      }
      if (element.hasGroup()) { 
        for (Contract.TermComponent e : element.getGroup()) 
          composeContractTermComponent("group", e);
      }
  }

  protected void composeContractTermAgentComponent(String name, Contract.TermAgentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractTermAgentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractTermAgentComponentElements(Contract.TermAgentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
      if (element.hasRole()) { 
        for (CodeableConcept e : element.getRole()) 
          composeCodeableConcept("role", e);
      }
  }

  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractTermValuedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractTermValuedItemComponentElements(Contract.TermValuedItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasEntity()) {
        composeType("entity", element.getEntity());
      }      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasEffectiveTimeElement()) {
        composeDateTime("effectiveTime", element.getEffectiveTimeElement());
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasPointsElement()) {
        composeDecimal("points", element.getPointsElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
  }

  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractFriendlyLanguageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractFriendlyLanguageComponentElements(Contract.FriendlyLanguageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContent()) {
        composeType("content", element.getContent());
      }  }

  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractLegalLanguageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractLegalLanguageComponentElements(Contract.LegalLanguageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContent()) {
        composeType("content", element.getContent());
      }  }

  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractComputableLanguageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractComputableLanguageComponentElements(Contract.ComputableLanguageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContent()) {
        composeType("content", element.getContent());
      }  }

  protected void composeCoverage(String name, Coverage element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageElements(Coverage element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasPolicyHolder()) {
        composeReference("policyHolder", element.getPolicyHolder());
      }
      if (element.hasSubscriber()) {
        composeReference("subscriber", element.getSubscriber());
      }
      if (element.hasSubscriberIdElement()) {
        composeString("subscriberId", element.getSubscriberIdElement());
      }
      if (element.hasBeneficiary()) {
        composeReference("beneficiary", element.getBeneficiary());
      }
      if (element.hasRelationship()) {
        composeCodeableConcept("relationship", element.getRelationship());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasPayor()) { 
        for (Reference e : element.getPayor()) 
          composeReference("payor", e);
      }
      if (element.hasGrouping()) {
        composeCoverageGroupComponent("grouping", element.getGrouping());
      }
      if (element.hasDependentElement()) {
        composeString("dependent", element.getDependentElement());
      }
      if (element.hasSequenceElement()) {
        composeString("sequence", element.getSequenceElement());
      }
      if (element.hasOrderElement()) {
        composePositiveInt("order", element.getOrderElement());
      }
      if (element.hasNetworkElement()) {
        composeString("network", element.getNetworkElement());
      }
      if (element.hasContract()) { 
        for (Reference e : element.getContract()) 
          composeReference("contract", e);
      }
  }

  protected void composeCoverageGroupComponent(String name, Coverage.GroupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageGroupComponentElements(Coverage.GroupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasGroupElement()) {
        composeString("group", element.getGroupElement());
      }
      if (element.hasGroupDisplayElement()) {
        composeString("groupDisplay", element.getGroupDisplayElement());
      }
      if (element.hasSubGroupElement()) {
        composeString("subGroup", element.getSubGroupElement());
      }
      if (element.hasSubGroupDisplayElement()) {
        composeString("subGroupDisplay", element.getSubGroupDisplayElement());
      }
      if (element.hasPlanElement()) {
        composeString("plan", element.getPlanElement());
      }
      if (element.hasPlanDisplayElement()) {
        composeString("planDisplay", element.getPlanDisplayElement());
      }
      if (element.hasSubPlanElement()) {
        composeString("subPlan", element.getSubPlanElement());
      }
      if (element.hasSubPlanDisplayElement()) {
        composeString("subPlanDisplay", element.getSubPlanDisplayElement());
      }
      if (element.hasClass_Element()) {
        composeString("class", element.getClass_Element());
      }
      if (element.hasClassDisplayElement()) {
        composeString("classDisplay", element.getClassDisplayElement());
      }
      if (element.hasSubClassElement()) {
        composeString("subClass", element.getSubClassElement());
      }
      if (element.hasSubClassDisplayElement()) {
        composeString("subClassDisplay", element.getSubClassDisplayElement());
      }
  }

  protected void composeDataElement(String name, DataElement element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataElementElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataElementElements(DataElement element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasStringencyElement())
        composeEnumeration("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory());
      if (element.hasMapping()) { 
        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
          composeDataElementDataElementMappingComponent("mapping", e);
      }
      if (element.hasElement()) { 
        for (ElementDefinition e : element.getElement()) 
          composeElementDefinition("element", e);
      }
  }

  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataElementDataElementMappingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataElementDataElementMappingComponentElements(DataElement.DataElementMappingComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentityElement()) {
        composeId("identity", element.getIdentityElement());
      }
      if (element.hasUriElement()) {
        composeUri("uri", element.getUriElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDetectedIssueElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDetectedIssueElements(DetectedIssue element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasSeverityElement())
        composeEnumeration("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory());
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
      if (element.hasImplicated()) { 
        for (Reference e : element.getImplicated()) 
          composeReference("implicated", e);
      }
      if (element.hasDetailElement()) {
        composeString("detail", element.getDetailElement());
      }
      if (element.hasReferenceElement()) {
        composeUri("reference", element.getReferenceElement());
      }
      if (element.hasMitigation()) { 
        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
          composeDetectedIssueDetectedIssueMitigationComponent("mitigation", e);
      }
  }

  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDetectedIssueDetectedIssueMitigationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDetectedIssueDetectedIssueMitigationComponentElements(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAction()) {
        composeCodeableConcept("action", element.getAction());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
  }

  protected void composeDevice(String name, Device element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceElements(Device element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasUdi()) {
        composeDeviceDeviceUdiComponent("udi", element.getUdi());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasLotNumberElement()) {
        composeString("lotNumber", element.getLotNumberElement());
      }
      if (element.hasManufacturerElement()) {
        composeString("manufacturer", element.getManufacturerElement());
      }
      if (element.hasManufactureDateElement()) {
        composeDateTime("manufactureDate", element.getManufactureDateElement());
      }
      if (element.hasExpirationDateElement()) {
        composeDateTime("expirationDate", element.getExpirationDateElement());
      }
      if (element.hasModelElement()) {
        composeString("model", element.getModelElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasOwner()) {
        composeReference("owner", element.getOwner());
      }
      if (element.hasContact()) { 
        for (ContactPoint e : element.getContact()) 
          composeContactPoint("contact", e);
      }
      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasSafety()) { 
        for (CodeableConcept e : element.getSafety()) 
          composeCodeableConcept("safety", e);
      }
  }

  protected void composeDeviceDeviceUdiComponent(String name, Device.DeviceUdiComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDeviceUdiComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDeviceUdiComponentElements(Device.DeviceUdiComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDeviceIdentifierElement()) {
        composeString("deviceIdentifier", element.getDeviceIdentifierElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasJurisdictionElement()) {
        composeUri("jurisdiction", element.getJurisdictionElement());
      }
      if (element.hasCarrierHRFElement()) {
        composeString("carrierHRF", element.getCarrierHRFElement());
      }
      if (element.hasCarrierAIDCElement()) {
        composeBase64Binary("carrierAIDC", element.getCarrierAIDCElement());
      }
      if (element.hasIssuerElement()) {
        composeUri("issuer", element.getIssuerElement());
      }
      if (element.hasEntryTypeElement())
        composeEnumeration("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory());
  }

  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceComponentElements(DeviceComponent element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasLastSystemChangeElement()) {
        composeInstant("lastSystemChange", element.getLastSystemChangeElement());
      }
      if (element.hasSource()) {
        composeReference("source", element.getSource());
      }
      if (element.hasParent()) {
        composeReference("parent", element.getParent());
      }
      if (element.hasOperationalStatus()) { 
        for (CodeableConcept e : element.getOperationalStatus()) 
          composeCodeableConcept("operationalStatus", e);
      }
      if (element.hasParameterGroup()) {
        composeCodeableConcept("parameterGroup", element.getParameterGroup());
      }
      if (element.hasMeasurementPrincipleElement())
        composeEnumeration("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory());
      if (element.hasProductionSpecification()) { 
        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
          composeDeviceComponentDeviceComponentProductionSpecificationComponent("productionSpecification", e);
      }
      if (element.hasLanguageCode()) {
        composeCodeableConcept("languageCode", element.getLanguageCode());
      }
  }

  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceComponentDeviceComponentProductionSpecificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentElements(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSpecType()) {
        composeCodeableConcept("specType", element.getSpecType());
      }
      if (element.hasComponentId()) {
        composeIdentifier("componentId", element.getComponentId());
      }
      if (element.hasProductionSpecElement()) {
        composeString("productionSpec", element.getProductionSpecElement());
      }
  }

  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceMetricElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceMetricElements(DeviceMetric element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasUnit()) {
        composeCodeableConcept("unit", element.getUnit());
      }
      if (element.hasSource()) {
        composeReference("source", element.getSource());
      }
      if (element.hasParent()) {
        composeReference("parent", element.getParent());
      }
      if (element.hasOperationalStatusElement())
        composeEnumeration("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory());
      if (element.hasColorElement())
        composeEnumeration("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory());
      if (element.hasCategoryElement())
        composeEnumeration("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory());
      if (element.hasMeasurementPeriod()) {
        composeTiming("measurementPeriod", element.getMeasurementPeriod());
      }
      if (element.hasCalibration()) { 
        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
          composeDeviceMetricDeviceMetricCalibrationComponent("calibration", e);
      }
  }

  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceMetricDeviceMetricCalibrationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceMetricDeviceMetricCalibrationComponentElements(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory());
      if (element.hasStateElement())
        composeEnumeration("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory());
      if (element.hasTimeElement()) {
        composeInstant("time", element.getTimeElement());
      }
  }

  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceRequestElements(DeviceRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasPriorRequest()) { 
        for (Reference e : element.getPriorRequest()) 
          composeReference("priorRequest", e);
      }
      if (element.hasGroupIdentifier()) {
        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory());
      if (element.hasIntent()) {
        composeCodeableConcept("intent", element.getIntent());
      }
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory());
      if (element.hasCode()) {
        composeType("code", element.getCode());
      }      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasRequester()) {
        composeDeviceRequestDeviceRequestRequesterComponent("requester", element.getRequester());
      }
      if (element.hasPerformerType()) {
        composeCodeableConcept("performerType", element.getPerformerType());
      }
      if (element.hasPerformer()) {
        composeReference("performer", element.getPerformer());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasSupportingInfo()) { 
        for (Reference e : element.getSupportingInfo()) 
          composeReference("supportingInfo", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasRelevantHistory()) { 
        for (Reference e : element.getRelevantHistory()) 
          composeReference("relevantHistory", e);
      }
  }

  protected void composeDeviceRequestDeviceRequestRequesterComponent(String name, DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceRequestDeviceRequestRequesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceRequestDeviceRequestRequesterComponentElements(DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAgent()) {
        composeReference("agent", element.getAgent());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceUseStatementElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceUseStatementElements(DeviceUseStatement element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory());
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasWhenUsed()) {
        composePeriod("whenUsed", element.getWhenUsed());
      }
      if (element.hasTiming()) {
        composeType("timing", element.getTiming());
      }      if (element.hasRecordedOnElement()) {
        composeDateTime("recordedOn", element.getRecordedOnElement());
      }
      if (element.hasSource()) {
        composeReference("source", element.getSource());
      }
      if (element.hasDevice()) {
        composeReference("device", element.getDevice());
      }
      if (element.hasIndication()) { 
        for (CodeableConcept e : element.getIndication()) 
          composeCodeableConcept("indication", e);
      }
      if (element.hasBodySite()) {
        composeCodeableConcept("bodySite", element.getBodySite());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDiagnosticReportElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDiagnosticReportElements(DiagnosticReport element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasEffective()) {
        composeType("effective", element.getEffective());
      }      if (element.hasIssuedElement()) {
        composeInstant("issued", element.getIssuedElement());
      }
      if (element.hasPerformer()) { 
        for (DiagnosticReport.DiagnosticReportPerformerComponent e : element.getPerformer()) 
          composeDiagnosticReportDiagnosticReportPerformerComponent("performer", e);
      }
      if (element.hasSpecimen()) { 
        for (Reference e : element.getSpecimen()) 
          composeReference("specimen", e);
      }
      if (element.hasResult()) { 
        for (Reference e : element.getResult()) 
          composeReference("result", e);
      }
      if (element.hasImagingStudy()) { 
        for (Reference e : element.getImagingStudy()) 
          composeReference("imagingStudy", e);
      }
      if (element.hasImage()) { 
        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
          composeDiagnosticReportDiagnosticReportImageComponent("image", e);
      }
      if (element.hasConclusionElement()) {
        composeString("conclusion", element.getConclusionElement());
      }
      if (element.hasCodedDiagnosis()) { 
        for (CodeableConcept e : element.getCodedDiagnosis()) 
          composeCodeableConcept("codedDiagnosis", e);
      }
      if (element.hasPresentedForm()) { 
        for (Attachment e : element.getPresentedForm()) 
          composeAttachment("presentedForm", e);
      }
  }

  protected void composeDiagnosticReportDiagnosticReportPerformerComponent(String name, DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDiagnosticReportDiagnosticReportPerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDiagnosticReportDiagnosticReportPerformerComponentElements(DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
  }

  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDiagnosticReportDiagnosticReportImageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDiagnosticReportDiagnosticReportImageComponentElements(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
      if (element.hasLink()) {
        composeReference("link", element.getLink());
      }
  }

  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentManifestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentManifestElements(DocumentManifest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasMasterIdentifier()) {
        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasAuthor()) { 
        for (Reference e : element.getAuthor()) 
          composeReference("author", e);
      }
      if (element.hasRecipient()) { 
        for (Reference e : element.getRecipient()) 
          composeReference("recipient", e);
      }
      if (element.hasSourceElement()) {
        composeUri("source", element.getSourceElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasContent()) { 
        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
          composeDocumentManifestDocumentManifestContentComponent("content", e);
      }
      if (element.hasRelated()) { 
        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
          composeDocumentManifestDocumentManifestRelatedComponent("related", e);
      }
  }

  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentManifestDocumentManifestContentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentManifestDocumentManifestContentComponentElements(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasP()) {
        composeType("p", element.getP());
      }  }

  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentManifestDocumentManifestRelatedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentManifestDocumentManifestRelatedComponentElements(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasRef()) {
        composeReference("ref", element.getRef());
      }
  }

  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceElements(DocumentReference element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasMasterIdentifier()) {
        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory());
      if (element.hasDocStatusElement())
        composeEnumeration("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasClass_()) {
        composeCodeableConcept("class", element.getClass_());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasIndexedElement()) {
        composeInstant("indexed", element.getIndexedElement());
      }
      if (element.hasAuthor()) { 
        for (Reference e : element.getAuthor()) 
          composeReference("author", e);
      }
      if (element.hasAuthenticator()) {
        composeReference("authenticator", element.getAuthenticator());
      }
      if (element.hasCustodian()) {
        composeReference("custodian", element.getCustodian());
      }
      if (element.hasRelatesTo()) { 
        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
          composeDocumentReferenceDocumentReferenceRelatesToComponent("relatesTo", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasSecurityLabel()) { 
        for (CodeableConcept e : element.getSecurityLabel()) 
          composeCodeableConcept("securityLabel", e);
      }
      if (element.hasContent()) { 
        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
          composeDocumentReferenceDocumentReferenceContentComponent("content", e);
      }
      if (element.hasContext()) {
        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
      }
  }

  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceDocumentReferenceRelatesToComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentElements(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory());
      if (element.hasTarget()) {
        composeReference("target", element.getTarget());
      }
  }

  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceDocumentReferenceContentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceDocumentReferenceContentComponentElements(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAttachment()) {
        composeAttachment("attachment", element.getAttachment());
      }
      if (element.hasFormat()) {
        composeCoding("format", element.getFormat());
      }
  }

  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceDocumentReferenceContextComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceDocumentReferenceContextComponentElements(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasEncounter()) {
        composeReference("encounter", element.getEncounter());
      }
      if (element.hasEvent()) { 
        for (CodeableConcept e : element.getEvent()) 
          composeCodeableConcept("event", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasFacilityType()) {
        composeCodeableConcept("facilityType", element.getFacilityType());
      }
      if (element.hasPracticeSetting()) {
        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
      }
      if (element.hasSourcePatientInfo()) {
        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
      }
      if (element.hasRelated()) { 
        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
          composeDocumentReferenceDocumentReferenceContextRelatedComponent("related", e);
      }
  }

  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceDocumentReferenceContextRelatedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentElements(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasRef()) {
        composeReference("ref", element.getRef());
      }
  }

  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEligibilityRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEligibilityRequestElements(EligibilityRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory());
      if (element.hasPriority()) {
        composeCodeableConcept("priority", element.getPriority());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasServiced()) {
        composeType("serviced", element.getServiced());
      }      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasEnterer()) {
        composeReference("enterer", element.getEnterer());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasInsurer()) {
        composeReference("insurer", element.getInsurer());
      }
      if (element.hasFacility()) {
        composeReference("facility", element.getFacility());
      }
      if (element.hasCoverage()) {
        composeReference("coverage", element.getCoverage());
      }
      if (element.hasBusinessArrangementElement()) {
        composeString("businessArrangement", element.getBusinessArrangementElement());
      }
      if (element.hasBenefitCategory()) {
        composeCodeableConcept("benefitCategory", element.getBenefitCategory());
      }
      if (element.hasBenefitSubCategory()) {
        composeCodeableConcept("benefitSubCategory", element.getBenefitSubCategory());
      }
  }

  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEligibilityResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEligibilityResponseElements(EligibilityResponse element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory());
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasRequestProvider()) {
        composeReference("requestProvider", element.getRequestProvider());
      }
      if (element.hasRequestOrganization()) {
        composeReference("requestOrganization", element.getRequestOrganization());
      }
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasDispositionElement()) {
        composeString("disposition", element.getDispositionElement());
      }
      if (element.hasInsurer()) {
        composeReference("insurer", element.getInsurer());
      }
      if (element.hasInforceElement()) {
        composeBoolean("inforce", element.getInforceElement());
      }
      if (element.hasInsurance()) { 
        for (EligibilityResponse.InsuranceComponent e : element.getInsurance()) 
          composeEligibilityResponseInsuranceComponent("insurance", e);
      }
      if (element.hasForm()) {
        composeCodeableConcept("form", element.getForm());
      }
      if (element.hasError()) { 
        for (EligibilityResponse.ErrorsComponent e : element.getError()) 
          composeEligibilityResponseErrorsComponent("error", e);
      }
  }

  protected void composeEligibilityResponseInsuranceComponent(String name, EligibilityResponse.InsuranceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEligibilityResponseInsuranceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEligibilityResponseInsuranceComponentElements(EligibilityResponse.InsuranceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCoverage()) {
        composeReference("coverage", element.getCoverage());
      }
      if (element.hasContract()) {
        composeReference("contract", element.getContract());
      }
      if (element.hasBenefitBalance()) { 
        for (EligibilityResponse.BenefitsComponent e : element.getBenefitBalance()) 
          composeEligibilityResponseBenefitsComponent("benefitBalance", e);
      }
  }

  protected void composeEligibilityResponseBenefitsComponent(String name, EligibilityResponse.BenefitsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEligibilityResponseBenefitsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEligibilityResponseBenefitsComponentElements(EligibilityResponse.BenefitsComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasSubCategory()) {
        composeCodeableConcept("subCategory", element.getSubCategory());
      }
      if (element.hasExcludedElement()) {
        composeBoolean("excluded", element.getExcludedElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasNetwork()) {
        composeCodeableConcept("network", element.getNetwork());
      }
      if (element.hasUnit()) {
        composeCodeableConcept("unit", element.getUnit());
      }
      if (element.hasTerm()) {
        composeCodeableConcept("term", element.getTerm());
      }
      if (element.hasFinancial()) { 
        for (EligibilityResponse.BenefitComponent e : element.getFinancial()) 
          composeEligibilityResponseBenefitComponent("financial", e);
      }
  }

  protected void composeEligibilityResponseBenefitComponent(String name, EligibilityResponse.BenefitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEligibilityResponseBenefitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEligibilityResponseBenefitComponentElements(EligibilityResponse.BenefitComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasAllowed()) {
        composeType("allowed", element.getAllowed());
      }      if (element.hasUsed()) {
        composeType("used", element.getUsed());
      }  }

  protected void composeEligibilityResponseErrorsComponent(String name, EligibilityResponse.ErrorsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEligibilityResponseErrorsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEligibilityResponseErrorsComponentElements(EligibilityResponse.ErrorsComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
  }

  protected void composeEncounter(String name, Encounter element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterElements(Encounter element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory());
      if (element.hasStatusHistory()) { 
        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
          composeEncounterStatusHistoryComponent("statusHistory", e);
      }
      if (element.hasClass_()) {
        composeCoding("class", element.getClass_());
      }
      if (element.hasClassHistory()) { 
        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
          composeEncounterClassHistoryComponent("classHistory", e);
      }
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasPriority()) {
        composeCodeableConcept("priority", element.getPriority());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasEpisodeOfCare()) { 
        for (Reference e : element.getEpisodeOfCare()) 
          composeReference("episodeOfCare", e);
      }
      if (element.hasIncomingReferral()) { 
        for (Reference e : element.getIncomingReferral()) 
          composeReference("incomingReferral", e);
      }
      if (element.hasParticipant()) { 
        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
          composeEncounterEncounterParticipantComponent("participant", e);
      }
      if (element.hasAppointment()) {
        composeReference("appointment", element.getAppointment());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasLength()) {
        composeDuration("length", element.getLength());
      }
      if (element.hasReason()) { 
        for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
      }
      if (element.hasDiagnosis()) { 
        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
          composeEncounterDiagnosisComponent("diagnosis", e);
      }
      if (element.hasAccount()) { 
        for (Reference e : element.getAccount()) 
          composeReference("account", e);
      }
      if (element.hasHospitalization()) {
        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
      }
      if (element.hasLocation()) { 
        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
          composeEncounterEncounterLocationComponent("location", e);
      }
      if (element.hasServiceProvider()) {
        composeReference("serviceProvider", element.getServiceProvider());
      }
      if (element.hasPartOf()) {
        composeReference("partOf", element.getPartOf());
      }
  }

  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterStatusHistoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterStatusHistoryComponentElements(Encounter.StatusHistoryComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory());
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterClassHistoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterClassHistoryComponentElements(Encounter.ClassHistoryComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasClass_()) {
        composeCoding("class", element.getClass_());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterEncounterParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterEncounterParticipantComponentElements(Encounter.EncounterParticipantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasIndividual()) {
        composeReference("individual", element.getIndividual());
      }
  }

  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterDiagnosisComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterDiagnosisComponentElements(Encounter.DiagnosisComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCondition()) {
        composeReference("condition", element.getCondition());
      }
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasRankElement()) {
        composePositiveInt("rank", element.getRankElement());
      }
  }

  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterEncounterHospitalizationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterEncounterHospitalizationComponentElements(Encounter.EncounterHospitalizationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasPreAdmissionIdentifier()) {
        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
      }
      if (element.hasOrigin()) {
        composeReference("origin", element.getOrigin());
      }
      if (element.hasAdmitSource()) {
        composeCodeableConcept("admitSource", element.getAdmitSource());
      }
      if (element.hasReAdmission()) {
        composeCodeableConcept("reAdmission", element.getReAdmission());
      }
      if (element.hasDietPreference()) { 
        for (CodeableConcept e : element.getDietPreference()) 
          composeCodeableConcept("dietPreference", e);
      }
      if (element.hasSpecialCourtesy()) { 
        for (CodeableConcept e : element.getSpecialCourtesy()) 
          composeCodeableConcept("specialCourtesy", e);
      }
      if (element.hasSpecialArrangement()) { 
        for (CodeableConcept e : element.getSpecialArrangement()) 
          composeCodeableConcept("specialArrangement", e);
      }
      if (element.hasDestination()) {
        composeReference("destination", element.getDestination());
      }
      if (element.hasDischargeDisposition()) {
        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
      }
  }

  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterEncounterLocationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterEncounterLocationComponentElements(Encounter.EncounterLocationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory());
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeEndpoint(String name, Endpoint element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEndpointElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEndpointElements(Endpoint element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory());
      if (element.hasConnectionType()) {
        composeCoding("connectionType", element.getConnectionType());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasManagingOrganization()) {
        composeReference("managingOrganization", element.getManagingOrganization());
      }
      if (element.hasContact()) { 
        for (ContactPoint e : element.getContact()) 
          composeContactPoint("contact", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasPayloadType()) { 
        for (CodeableConcept e : element.getPayloadType()) 
          composeCodeableConcept("payloadType", e);
      }
      if (element.hasPayloadMimeType()) { 
        for (CodeType e : element.getPayloadMimeType()) 
          composeCode("payloadMimeType", e);
      }
      if (element.hasAddressElement()) {
        composeUri("address", element.getAddressElement());
      }
      if (element.hasHeader()) { 
        for (StringType e : element.getHeader()) 
          composeString("header", e);
      }
  }

  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEnrollmentRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEnrollmentRequestElements(EnrollmentRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory());
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasInsurer()) {
        composeReference("insurer", element.getInsurer());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasCoverage()) {
        composeReference("coverage", element.getCoverage());
      }
  }

  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEnrollmentResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEnrollmentResponseElements(EnrollmentResponse element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory());
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasDispositionElement()) {
        composeString("disposition", element.getDispositionElement());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasRequestProvider()) {
        composeReference("requestProvider", element.getRequestProvider());
      }
      if (element.hasRequestOrganization()) {
        composeReference("requestOrganization", element.getRequestOrganization());
      }
  }

  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEpisodeOfCareElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEpisodeOfCareElements(EpisodeOfCare element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory());
      if (element.hasStatusHistory()) { 
        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent("statusHistory", e);
      }
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasDiagnosis()) { 
        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
          composeEpisodeOfCareDiagnosisComponent("diagnosis", e);
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasManagingOrganization()) {
        composeReference("managingOrganization", element.getManagingOrganization());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasReferralRequest()) { 
        for (Reference e : element.getReferralRequest()) 
          composeReference("referralRequest", e);
      }
      if (element.hasCareManager()) {
        composeReference("careManager", element.getCareManager());
      }
      if (element.hasTeam()) { 
        for (Reference e : element.getTeam()) 
          composeReference("team", e);
      }
      if (element.hasAccount()) { 
        for (Reference e : element.getAccount()) 
          composeReference("account", e);
      }
  }

  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentElements(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory());
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEpisodeOfCareDiagnosisComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEpisodeOfCareDiagnosisComponentElements(EpisodeOfCare.DiagnosisComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCondition()) {
        composeReference("condition", element.getCondition());
      }
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasRankElement()) {
        composePositiveInt("rank", element.getRankElement());
      }
  }

  protected void composeExpansionProfile(String name, ExpansionProfile element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileElements(ExpansionProfile element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasFixedVersion()) { 
        for (ExpansionProfile.ExpansionProfileFixedVersionComponent e : element.getFixedVersion()) 
          composeExpansionProfileExpansionProfileFixedVersionComponent("fixedVersion", e);
      }
      if (element.hasExcludedSystem()) {
        composeExpansionProfileExpansionProfileExcludedSystemComponent("excludedSystem", element.getExcludedSystem());
      }
      if (element.hasIncludeDesignationsElement()) {
        composeBoolean("includeDesignations", element.getIncludeDesignationsElement());
      }
      if (element.hasDesignation()) {
        composeExpansionProfileExpansionProfileDesignationComponent("designation", element.getDesignation());
      }
      if (element.hasIncludeDefinitionElement()) {
        composeBoolean("includeDefinition", element.getIncludeDefinitionElement());
      }
      if (element.hasActiveOnlyElement()) {
        composeBoolean("activeOnly", element.getActiveOnlyElement());
      }
      if (element.hasExcludeNestedElement()) {
        composeBoolean("excludeNested", element.getExcludeNestedElement());
      }
      if (element.hasExcludeNotForUIElement()) {
        composeBoolean("excludeNotForUI", element.getExcludeNotForUIElement());
      }
      if (element.hasExcludePostCoordinatedElement()) {
        composeBoolean("excludePostCoordinated", element.getExcludePostCoordinatedElement());
      }
      if (element.hasDisplayLanguageElement()) {
        composeCode("displayLanguage", element.getDisplayLanguageElement());
      }
      if (element.hasLimitedExpansionElement()) {
        composeBoolean("limitedExpansion", element.getLimitedExpansionElement());
      }
  }

  protected void composeExpansionProfileExpansionProfileFixedVersionComponent(String name, ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileExpansionProfileFixedVersionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileExpansionProfileFixedVersionComponentElements(ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory());
  }

  protected void composeExpansionProfileExpansionProfileExcludedSystemComponent(String name, ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileExpansionProfileExcludedSystemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileExpansionProfileExcludedSystemComponentElements(ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
  }

  protected void composeExpansionProfileExpansionProfileDesignationComponent(String name, ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileExpansionProfileDesignationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileExpansionProfileDesignationComponentElements(ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasInclude()) {
        composeExpansionProfileDesignationIncludeComponent("include", element.getInclude());
      }
      if (element.hasExclude()) {
        composeExpansionProfileDesignationExcludeComponent("exclude", element.getExclude());
      }
  }

  protected void composeExpansionProfileDesignationIncludeComponent(String name, ExpansionProfile.DesignationIncludeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileDesignationIncludeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileDesignationIncludeComponentElements(ExpansionProfile.DesignationIncludeComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDesignation()) { 
        for (ExpansionProfile.DesignationIncludeDesignationComponent e : element.getDesignation()) 
          composeExpansionProfileDesignationIncludeDesignationComponent("designation", e);
      }
  }

  protected void composeExpansionProfileDesignationIncludeDesignationComponent(String name, ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileDesignationIncludeDesignationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileDesignationIncludeDesignationComponentElements(ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLanguageElement()) {
        composeCode("language", element.getLanguageElement());
      }
      if (element.hasUse()) {
        composeCoding("use", element.getUse());
      }
  }

  protected void composeExpansionProfileDesignationExcludeComponent(String name, ExpansionProfile.DesignationExcludeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileDesignationExcludeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileDesignationExcludeComponentElements(ExpansionProfile.DesignationExcludeComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDesignation()) { 
        for (ExpansionProfile.DesignationExcludeDesignationComponent e : element.getDesignation()) 
          composeExpansionProfileDesignationExcludeDesignationComponent("designation", e);
      }
  }

  protected void composeExpansionProfileDesignationExcludeDesignationComponent(String name, ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpansionProfileDesignationExcludeDesignationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpansionProfileDesignationExcludeDesignationComponentElements(ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLanguageElement()) {
        composeCode("language", element.getLanguageElement());
      }
      if (element.hasUse()) {
        composeCoding("use", element.getUse());
      }
  }

  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitElements(ExplanationOfBenefit element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSubType()) { 
        for (CodeableConcept e : element.getSubType()) 
          composeCodeableConcept("subType", e);
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasBillablePeriod()) {
        composePeriod("billablePeriod", element.getBillablePeriod());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasEnterer()) {
        composeReference("enterer", element.getEnterer());
      }
      if (element.hasInsurer()) {
        composeReference("insurer", element.getInsurer());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasReferral()) {
        composeReference("referral", element.getReferral());
      }
      if (element.hasFacility()) {
        composeReference("facility", element.getFacility());
      }
      if (element.hasClaim()) {
        composeReference("claim", element.getClaim());
      }
      if (element.hasClaimResponse()) {
        composeReference("claimResponse", element.getClaimResponse());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasDispositionElement()) {
        composeString("disposition", element.getDispositionElement());
      }
      if (element.hasRelated()) { 
        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
          composeExplanationOfBenefitRelatedClaimComponent("related", e);
      }
      if (element.hasPrescription()) {
        composeReference("prescription", element.getPrescription());
      }
      if (element.hasOriginalPrescription()) {
        composeReference("originalPrescription", element.getOriginalPrescription());
      }
      if (element.hasPayee()) {
        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
      }
      if (element.hasInformation()) { 
        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getInformation()) 
          composeExplanationOfBenefitSupportingInformationComponent("information", e);
      }
      if (element.hasCareTeam()) { 
        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
          composeExplanationOfBenefitCareTeamComponent("careTeam", e);
      }
      if (element.hasDiagnosis()) { 
        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
          composeExplanationOfBenefitDiagnosisComponent("diagnosis", e);
      }
      if (element.hasProcedure()) { 
        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
          composeExplanationOfBenefitProcedureComponent("procedure", e);
      }
      if (element.hasPrecedenceElement()) {
        composePositiveInt("precedence", element.getPrecedenceElement());
      }
      if (element.hasInsurance()) {
        composeExplanationOfBenefitInsuranceComponent("insurance", element.getInsurance());
      }
      if (element.hasAccident()) {
        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
      }
      if (element.hasEmploymentImpacted()) {
        composePeriod("employmentImpacted", element.getEmploymentImpacted());
      }
      if (element.hasHospitalization()) {
        composePeriod("hospitalization", element.getHospitalization());
      }
      if (element.hasItem()) { 
        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
          composeExplanationOfBenefitItemComponent("item", e);
      }
      if (element.hasAddItem()) { 
        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
          composeExplanationOfBenefitAddedItemComponent("addItem", e);
      }
      if (element.hasTotalCost()) {
        composeMoney("totalCost", element.getTotalCost());
      }
      if (element.hasUnallocDeductable()) {
        composeMoney("unallocDeductable", element.getUnallocDeductable());
      }
      if (element.hasTotalBenefit()) {
        composeMoney("totalBenefit", element.getTotalBenefit());
      }
      if (element.hasPayment()) {
        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
      }
      if (element.hasForm()) {
        composeCodeableConcept("form", element.getForm());
      }
      if (element.hasProcessNote()) { 
        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
          composeExplanationOfBenefitNoteComponent("processNote", e);
      }
      if (element.hasBenefitBalance()) { 
        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
          composeExplanationOfBenefitBenefitBalanceComponent("benefitBalance", e);
      }
  }

  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitRelatedClaimComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitRelatedClaimComponentElements(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasClaim()) {
        composeReference("claim", element.getClaim());
      }
      if (element.hasRelationship()) {
        composeCodeableConcept("relationship", element.getRelationship());
      }
      if (element.hasReference()) {
        composeIdentifier("reference", element.getReference());
      }
  }

  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitPayeeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitPayeeComponentElements(ExplanationOfBenefit.PayeeComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasResourceType()) {
        composeCodeableConcept("resourceType", element.getResourceType());
      }
      if (element.hasParty()) {
        composeReference("party", element.getParty());
      }
  }

  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitSupportingInformationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitSupportingInformationComponentElements(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasTiming()) {
        composeType("timing", element.getTiming());
      }      if (element.hasValue()) {
        composeType("value", element.getValue());
      }      if (element.hasReason()) {
        composeCoding("reason", element.getReason());
      }
  }

  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitCareTeamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitCareTeamComponentElements(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasResponsibleElement()) {
        composeBoolean("responsible", element.getResponsibleElement());
      }
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasQualification()) {
        composeCodeableConcept("qualification", element.getQualification());
      }
  }

  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitDiagnosisComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitDiagnosisComponentElements(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasDiagnosis()) {
        composeType("diagnosis", element.getDiagnosis());
      }      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasPackageCode()) {
        composeCodeableConcept("packageCode", element.getPackageCode());
      }
  }

  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitProcedureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitProcedureComponentElements(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasProcedure()) {
        composeType("procedure", element.getProcedure());
      }  }

  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitInsuranceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitInsuranceComponentElements(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCoverage()) {
        composeReference("coverage", element.getCoverage());
      }
      if (element.hasPreAuthRef()) { 
        for (StringType e : element.getPreAuthRef()) 
          composeString("preAuthRef", e);
      }
  }

  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitAccidentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitAccidentComponentElements(ExplanationOfBenefit.AccidentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDateElement()) {
        composeDate("date", element.getDateElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasLocation()) {
        composeType("location", element.getLocation());
      }  }

  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitItemComponentElements(ExplanationOfBenefit.ItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasCareTeamLinkId()) { 
        for (PositiveIntType e : element.getCareTeamLinkId()) 
          composePositiveInt("careTeamLinkId", e);
      }
      if (element.hasDiagnosisLinkId()) { 
        for (PositiveIntType e : element.getDiagnosisLinkId()) 
          composePositiveInt("diagnosisLinkId", e);
      }
      if (element.hasProcedureLinkId()) { 
        for (PositiveIntType e : element.getProcedureLinkId()) 
          composePositiveInt("procedureLinkId", e);
      }
      if (element.hasInformationLinkId()) { 
        for (PositiveIntType e : element.getInformationLinkId()) 
          composePositiveInt("informationLinkId", e);
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasProgramCode()) { 
        for (CodeableConcept e : element.getProgramCode()) 
          composeCodeableConcept("programCode", e);
      }
      if (element.hasServiced()) {
        composeType("serviced", element.getServiced());
      }      if (element.hasLocation()) {
        composeType("location", element.getLocation());
      }      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
      if (element.hasUdi()) { 
        for (Reference e : element.getUdi()) 
          composeReference("udi", e);
      }
      if (element.hasBodySite()) {
        composeCodeableConcept("bodySite", element.getBodySite());
      }
      if (element.hasSubSite()) { 
        for (CodeableConcept e : element.getSubSite()) 
          composeCodeableConcept("subSite", e);
      }
      if (element.hasEncounter()) { 
        for (Reference e : element.getEncounter()) 
          composeReference("encounter", e);
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
          composeExplanationOfBenefitAdjudicationComponent("adjudication", e);
      }
      if (element.hasDetail()) { 
        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
          composeExplanationOfBenefitDetailComponent("detail", e);
      }
  }

  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitAdjudicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitAdjudicationComponentElements(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasReason()) {
        composeCodeableConcept("reason", element.getReason());
      }
      if (element.hasAmount()) {
        composeMoney("amount", element.getAmount());
      }
      if (element.hasValueElement()) {
        composeDecimal("value", element.getValueElement());
      }
  }

  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitDetailComponentElements(ExplanationOfBenefit.DetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasProgramCode()) { 
        for (CodeableConcept e : element.getProgramCode()) 
          composeCodeableConcept("programCode", e);
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
      if (element.hasUdi()) { 
        for (Reference e : element.getUdi()) 
          composeReference("udi", e);
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
          composeExplanationOfBenefitAdjudicationComponent("adjudication", e);
      }
      if (element.hasSubDetail()) { 
        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
          composeExplanationOfBenefitSubDetailComponent("subDetail", e);
      }
  }

  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitSubDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitSubDetailComponentElements(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceElement()) {
        composePositiveInt("sequence", element.getSequenceElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasProgramCode()) { 
        for (CodeableConcept e : element.getProgramCode()) 
          composeCodeableConcept("programCode", e);
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasUnitPrice()) {
        composeMoney("unitPrice", element.getUnitPrice());
      }
      if (element.hasFactorElement()) {
        composeDecimal("factor", element.getFactorElement());
      }
      if (element.hasNet()) {
        composeMoney("net", element.getNet());
      }
      if (element.hasUdi()) { 
        for (Reference e : element.getUdi()) 
          composeReference("udi", e);
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
          composeExplanationOfBenefitAdjudicationComponent("adjudication", e);
      }
  }

  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitAddedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitAddedItemComponentElements(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceLinkId()) { 
        for (PositiveIntType e : element.getSequenceLinkId()) 
          composePositiveInt("sequenceLinkId", e);
      }
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasFee()) {
        composeMoney("fee", element.getFee());
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
          composeExplanationOfBenefitAdjudicationComponent("adjudication", e);
      }
      if (element.hasDetail()) { 
        for (ExplanationOfBenefit.AddedItemsDetailComponent e : element.getDetail()) 
          composeExplanationOfBenefitAddedItemsDetailComponent("detail", e);
      }
  }

  protected void composeExplanationOfBenefitAddedItemsDetailComponent(String name, ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitAddedItemsDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitAddedItemsDetailComponentElements(ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRevenue()) {
        composeCodeableConcept("revenue", element.getRevenue());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasService()) {
        composeCodeableConcept("service", element.getService());
      }
      if (element.hasModifier()) { 
        for (CodeableConcept e : element.getModifier()) 
          composeCodeableConcept("modifier", e);
      }
      if (element.hasFee()) {
        composeMoney("fee", element.getFee());
      }
      if (element.hasNoteNumber()) { 
        for (PositiveIntType e : element.getNoteNumber()) 
          composePositiveInt("noteNumber", e);
      }
      if (element.hasAdjudication()) { 
        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
          composeExplanationOfBenefitAdjudicationComponent("adjudication", e);
      }
  }

  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitPaymentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitPaymentComponentElements(ExplanationOfBenefit.PaymentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasAdjustment()) {
        composeMoney("adjustment", element.getAdjustment());
      }
      if (element.hasAdjustmentReason()) {
        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
      }
      if (element.hasDateElement()) {
        composeDate("date", element.getDateElement());
      }
      if (element.hasAmount()) {
        composeMoney("amount", element.getAmount());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
  }

  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitNoteComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitNoteComponentElements(ExplanationOfBenefit.NoteComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNumberElement()) {
        composePositiveInt("number", element.getNumberElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasLanguage()) {
        composeCodeableConcept("language", element.getLanguage());
      }
  }

  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitBenefitBalanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitBenefitBalanceComponentElements(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasSubCategory()) {
        composeCodeableConcept("subCategory", element.getSubCategory());
      }
      if (element.hasExcludedElement()) {
        composeBoolean("excluded", element.getExcludedElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasNetwork()) {
        composeCodeableConcept("network", element.getNetwork());
      }
      if (element.hasUnit()) {
        composeCodeableConcept("unit", element.getUnit());
      }
      if (element.hasTerm()) {
        composeCodeableConcept("term", element.getTerm());
      }
      if (element.hasFinancial()) { 
        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
          composeExplanationOfBenefitBenefitComponent("financial", e);
      }
  }

  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitBenefitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitBenefitComponentElements(ExplanationOfBenefit.BenefitComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasAllowed()) {
        composeType("allowed", element.getAllowed());
      }      if (element.hasUsed()) {
        composeType("used", element.getUsed());
      }  }

  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeFamilyMemberHistoryElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeFamilyMemberHistoryElements(FamilyMemberHistory element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory());
      if (element.hasNotDoneElement()) {
        composeBoolean("notDone", element.getNotDoneElement());
      }
      if (element.hasNotDoneReason()) {
        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasRelationship()) {
        composeCodeableConcept("relationship", element.getRelationship());
      }
      if (element.hasGenderElement())
        composeEnumeration("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory());
      if (element.hasBorn()) {
        composeType("born", element.getBorn());
      }      if (element.hasAge()) {
        composeType("age", element.getAge());
      }      if (element.hasEstimatedAgeElement()) {
        composeBoolean("estimatedAge", element.getEstimatedAgeElement());
      }
      if (element.hasDeceased()) {
        composeType("deceased", element.getDeceased());
      }      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasCondition()) { 
        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent("condition", e);
      }
  }

  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentElements(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasOnset()) {
        composeType("onset", element.getOnset());
      }      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeFlag(String name, Flag element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeFlagElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeFlagElements(Flag element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasEncounter()) {
        composeReference("encounter", element.getEncounter());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
  }

  protected void composeGoal(String name, Goal element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGoalElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGoalElements(Goal element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasPriority()) {
        composeCodeableConcept("priority", element.getPriority());
      }
      if (element.hasDescription()) {
        composeCodeableConcept("description", element.getDescription());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasStart()) {
        composeType("start", element.getStart());
      }      if (element.hasTarget()) {
        composeGoalGoalTargetComponent("target", element.getTarget());
      }
      if (element.hasStatusDateElement()) {
        composeDate("statusDate", element.getStatusDateElement());
      }
      if (element.hasStatusReasonElement()) {
        composeString("statusReason", element.getStatusReasonElement());
      }
      if (element.hasExpressedBy()) {
        composeReference("expressedBy", element.getExpressedBy());
      }
      if (element.hasAddresses()) { 
        for (Reference e : element.getAddresses()) 
          composeReference("addresses", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasOutcomeCode()) { 
        for (CodeableConcept e : element.getOutcomeCode()) 
          composeCodeableConcept("outcomeCode", e);
      }
      if (element.hasOutcomeReference()) { 
        for (Reference e : element.getOutcomeReference()) 
          composeReference("outcomeReference", e);
      }
  }

  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGoalGoalTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGoalGoalTargetComponentElements(Goal.GoalTargetComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasMeasure()) {
        composeCodeableConcept("measure", element.getMeasure());
      }
      if (element.hasDetail()) {
        composeType("detail", element.getDetail());
      }      if (element.hasDue()) {
        composeType("due", element.getDue());
      }  }

  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionElements(GraphDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasStartElement()) {
        composeCode("start", element.getStartElement());
      }
      if (element.hasProfileElement()) {
        composeUri("profile", element.getProfileElement());
      }
      if (element.hasLink()) { 
        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
          composeGraphDefinitionGraphDefinitionLinkComponent("link", e);
      }
  }

  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionGraphDefinitionLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionGraphDefinitionLinkComponentElements(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasSliceNameElement()) {
        composeString("sliceName", element.getSliceNameElement());
      }
      if (element.hasMinElement()) {
        composeInteger("min", element.getMinElement());
      }
      if (element.hasMaxElement()) {
        composeString("max", element.getMaxElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasTarget()) { 
        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
          composeGraphDefinitionGraphDefinitionLinkTargetComponent("target", e);
      }
  }

  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionGraphDefinitionLinkTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentElements(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasProfileElement()) {
        composeUri("profile", element.getProfileElement());
      }
      if (element.hasCompartment()) { 
        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent("compartment", e);
      }
      if (element.hasLink()) { 
        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
          composeGraphDefinitionGraphDefinitionLinkComponent("link", e);
      }
  }

  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentElements(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory());
      if (element.hasRuleElement())
        composeEnumeration("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory());
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
  }

  protected void composeGroup(String name, Group element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGroupElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGroupElements(Group element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Group.GroupTypeEnumFactory());
      if (element.hasActualElement()) {
        composeBoolean("actual", element.getActualElement());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasQuantityElement()) {
        composeUnsignedInt("quantity", element.getQuantityElement());
      }
      if (element.hasCharacteristic()) { 
        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
          composeGroupGroupCharacteristicComponent("characteristic", e);
      }
      if (element.hasMember()) { 
        for (Group.GroupMemberComponent e : element.getMember()) 
          composeGroupGroupMemberComponent("member", e);
      }
  }

  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGroupGroupCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGroupGroupCharacteristicComponentElements(Group.GroupCharacteristicComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }      if (element.hasExcludeElement()) {
        composeBoolean("exclude", element.getExcludeElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGroupGroupMemberComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGroupGroupMemberComponentElements(Group.GroupMemberComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasEntity()) {
        composeReference("entity", element.getEntity());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasInactiveElement()) {
        composeBoolean("inactive", element.getInactiveElement());
      }
  }

  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGuidanceResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGuidanceResponseElements(GuidanceResponse element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasRequestIdElement()) {
        composeId("requestId", element.getRequestIdElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasModule()) {
        composeReference("module", element.getModule());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory());
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOccurrenceDateTimeElement()) {
        composeDateTime("occurrenceDateTime", element.getOccurrenceDateTimeElement());
      }
      if (element.hasPerformer()) {
        composeReference("performer", element.getPerformer());
      }
      if (element.hasReason()) {
        composeType("reason", element.getReason());
      }      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasEvaluationMessage()) { 
        for (Reference e : element.getEvaluationMessage()) 
          composeReference("evaluationMessage", e);
      }
      if (element.hasOutputParameters()) {
        composeReference("outputParameters", element.getOutputParameters());
      }
      if (element.hasResult()) {
        composeReference("result", element.getResult());
      }
      if (element.hasDataRequirement()) { 
        for (DataRequirement e : element.getDataRequirement()) 
          composeDataRequirement("dataRequirement", e);
      }
  }

  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHealthcareServiceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHealthcareServiceElements(HealthcareService element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasProvidedBy()) {
        composeReference("providedBy", element.getProvidedBy());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasSpecialty()) { 
        for (CodeableConcept e : element.getSpecialty()) 
          composeCodeableConcept("specialty", e);
      }
      if (element.hasLocation()) { 
        for (Reference e : element.getLocation()) 
          composeReference("location", e);
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
      if (element.hasExtraDetailsElement()) {
        composeString("extraDetails", element.getExtraDetailsElement());
      }
      if (element.hasPhoto()) {
        composeAttachment("photo", element.getPhoto());
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasCoverageArea()) { 
        for (Reference e : element.getCoverageArea()) 
          composeReference("coverageArea", e);
      }
      if (element.hasServiceProvisionCode()) { 
        for (CodeableConcept e : element.getServiceProvisionCode()) 
          composeCodeableConcept("serviceProvisionCode", e);
      }
      if (element.hasEligibility()) {
        composeCodeableConcept("eligibility", element.getEligibility());
      }
      if (element.hasEligibilityNoteElement()) {
        composeString("eligibilityNote", element.getEligibilityNoteElement());
      }
      if (element.hasProgramName()) { 
        for (StringType e : element.getProgramName()) 
          composeString("programName", e);
      }
      if (element.hasCharacteristic()) { 
        for (CodeableConcept e : element.getCharacteristic()) 
          composeCodeableConcept("characteristic", e);
      }
      if (element.hasReferralMethod()) { 
        for (CodeableConcept e : element.getReferralMethod()) 
          composeCodeableConcept("referralMethod", e);
      }
      if (element.hasAppointmentRequiredElement()) {
        composeBoolean("appointmentRequired", element.getAppointmentRequiredElement());
      }
      if (element.hasAvailableTime()) { 
        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
          composeHealthcareServiceHealthcareServiceAvailableTimeComponent("availableTime", e);
      }
      if (element.hasNotAvailable()) { 
        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
          composeHealthcareServiceHealthcareServiceNotAvailableComponent("notAvailable", e);
      }
      if (element.hasAvailabilityExceptionsElement()) {
        composeString("availabilityExceptions", element.getAvailabilityExceptionsElement());
      }
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
  }

  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHealthcareServiceHealthcareServiceAvailableTimeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentElements(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
      composeBackboneElements(element);
        if (element.hasDaysOfWeek()) 
          for (Enumeration e : element.getDaysOfWeek()) 
            composeEnumeration("daysOfWeek", e, new HealthcareService.DaysOfWeekEnumFactory());
      if (element.hasAllDayElement()) {
        composeBoolean("allDay", element.getAllDayElement());
      }
      if (element.hasAvailableStartTimeElement()) {
        composeTime("availableStartTime", element.getAvailableStartTimeElement());
      }
      if (element.hasAvailableEndTimeElement()) {
        composeTime("availableEndTime", element.getAvailableEndTimeElement());
      }
  }

  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHealthcareServiceHealthcareServiceNotAvailableComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentElements(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasDuring()) {
        composePeriod("during", element.getDuring());
      }
  }

  protected void composeImagingManifest(String name, ImagingManifest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingManifestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingManifestElements(ImagingManifest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasAuthoringTimeElement()) {
        composeDateTime("authoringTime", element.getAuthoringTimeElement());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasStudy()) { 
        for (ImagingManifest.StudyComponent e : element.getStudy()) 
          composeImagingManifestStudyComponent("study", e);
      }
  }

  protected void composeImagingManifestStudyComponent(String name, ImagingManifest.StudyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingManifestStudyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingManifestStudyComponentElements(ImagingManifest.StudyComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasUidElement()) {
        composeOid("uid", element.getUidElement());
      }
      if (element.hasImagingStudy()) {
        composeReference("imagingStudy", element.getImagingStudy());
      }
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
      if (element.hasSeries()) { 
        for (ImagingManifest.SeriesComponent e : element.getSeries()) 
          composeImagingManifestSeriesComponent("series", e);
      }
  }

  protected void composeImagingManifestSeriesComponent(String name, ImagingManifest.SeriesComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingManifestSeriesComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingManifestSeriesComponentElements(ImagingManifest.SeriesComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasUidElement()) {
        composeOid("uid", element.getUidElement());
      }
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
      if (element.hasInstance()) { 
        for (ImagingManifest.InstanceComponent e : element.getInstance()) 
          composeImagingManifestInstanceComponent("instance", e);
      }
  }

  protected void composeImagingManifestInstanceComponent(String name, ImagingManifest.InstanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingManifestInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingManifestInstanceComponentElements(ImagingManifest.InstanceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSopClassElement()) {
        composeOid("sopClass", element.getSopClassElement());
      }
      if (element.hasUidElement()) {
        composeOid("uid", element.getUidElement());
      }
  }

  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingStudyElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingStudyElements(ImagingStudy element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUidElement()) {
        composeOid("uid", element.getUidElement());
      }
      if (element.hasAccession()) {
        composeIdentifier("accession", element.getAccession());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasAvailabilityElement())
        composeEnumeration("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory());
      if (element.hasModalityList()) { 
        for (Coding e : element.getModalityList()) 
          composeCoding("modalityList", e);
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasStartedElement()) {
        composeDateTime("started", element.getStartedElement());
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasReferrer()) {
        composeReference("referrer", element.getReferrer());
      }
      if (element.hasInterpreter()) { 
        for (Reference e : element.getInterpreter()) 
          composeReference("interpreter", e);
      }
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
      if (element.hasNumberOfSeriesElement()) {
        composeUnsignedInt("numberOfSeries", element.getNumberOfSeriesElement());
      }
      if (element.hasNumberOfInstancesElement()) {
        composeUnsignedInt("numberOfInstances", element.getNumberOfInstancesElement());
      }
      if (element.hasProcedureReference()) { 
        for (Reference e : element.getProcedureReference()) 
          composeReference("procedureReference", e);
      }
      if (element.hasProcedureCode()) { 
        for (CodeableConcept e : element.getProcedureCode()) 
          composeCodeableConcept("procedureCode", e);
      }
      if (element.hasReason()) {
        composeCodeableConcept("reason", element.getReason());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasSeries()) { 
        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
          composeImagingStudyImagingStudySeriesComponent("series", e);
      }
  }

  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingStudyImagingStudySeriesComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingStudyImagingStudySeriesComponentElements(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasUidElement()) {
        composeOid("uid", element.getUidElement());
      }
      if (element.hasNumberElement()) {
        composeUnsignedInt("number", element.getNumberElement());
      }
      if (element.hasModality()) {
        composeCoding("modality", element.getModality());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasNumberOfInstancesElement()) {
        composeUnsignedInt("numberOfInstances", element.getNumberOfInstancesElement());
      }
      if (element.hasAvailabilityElement())
        composeEnumeration("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory());
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
      if (element.hasBodySite()) {
        composeCoding("bodySite", element.getBodySite());
      }
      if (element.hasLaterality()) {
        composeCoding("laterality", element.getLaterality());
      }
      if (element.hasStartedElement()) {
        composeDateTime("started", element.getStartedElement());
      }
      if (element.hasPerformer()) { 
        for (Reference e : element.getPerformer()) 
          composeReference("performer", e);
      }
      if (element.hasInstance()) { 
        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
          composeImagingStudyImagingStudySeriesInstanceComponent("instance", e);
      }
  }

  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingStudyImagingStudySeriesInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingStudyImagingStudySeriesInstanceComponentElements(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasUidElement()) {
        composeOid("uid", element.getUidElement());
      }
      if (element.hasNumberElement()) {
        composeUnsignedInt("number", element.getNumberElement());
      }
      if (element.hasSopClassElement()) {
        composeOid("sopClass", element.getSopClassElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
  }

  protected void composeImmunization(String name, Immunization element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationElements(Immunization element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory());
      if (element.hasNotGivenElement()) {
        composeBoolean("notGiven", element.getNotGivenElement());
      }
      if (element.hasVaccineCode()) {
        composeCodeableConcept("vaccineCode", element.getVaccineCode());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasEncounter()) {
        composeReference("encounter", element.getEncounter());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPrimarySourceElement()) {
        composeBoolean("primarySource", element.getPrimarySourceElement());
      }
      if (element.hasReportOrigin()) {
        composeCodeableConcept("reportOrigin", element.getReportOrigin());
      }
      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasManufacturer()) {
        composeReference("manufacturer", element.getManufacturer());
      }
      if (element.hasLotNumberElement()) {
        composeString("lotNumber", element.getLotNumberElement());
      }
      if (element.hasExpirationDateElement()) {
        composeDate("expirationDate", element.getExpirationDateElement());
      }
      if (element.hasSite()) {
        composeCodeableConcept("site", element.getSite());
      }
      if (element.hasRoute()) {
        composeCodeableConcept("route", element.getRoute());
      }
      if (element.hasDoseQuantity()) {
        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
      }
      if (element.hasPractitioner()) { 
        for (Immunization.ImmunizationPractitionerComponent e : element.getPractitioner()) 
          composeImmunizationImmunizationPractitionerComponent("practitioner", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasExplanation()) {
        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
      }
      if (element.hasReaction()) { 
        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
          composeImmunizationImmunizationReactionComponent("reaction", e);
      }
      if (element.hasVaccinationProtocol()) { 
        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
          composeImmunizationImmunizationVaccinationProtocolComponent("vaccinationProtocol", e);
      }
  }

  protected void composeImmunizationImmunizationPractitionerComponent(String name, Immunization.ImmunizationPractitionerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationImmunizationPractitionerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationImmunizationPractitionerComponentElements(Immunization.ImmunizationPractitionerComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
  }

  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationImmunizationExplanationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationImmunizationExplanationComponentElements(Immunization.ImmunizationExplanationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasReason()) { 
        for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
      }
      if (element.hasReasonNotGiven()) { 
        for (CodeableConcept e : element.getReasonNotGiven()) 
          composeCodeableConcept("reasonNotGiven", e);
      }
  }

  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationImmunizationReactionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationImmunizationReactionComponentElements(Immunization.ImmunizationReactionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasDetail()) {
        composeReference("detail", element.getDetail());
      }
      if (element.hasReportedElement()) {
        composeBoolean("reported", element.getReportedElement());
      }
  }

  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationImmunizationVaccinationProtocolComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationImmunizationVaccinationProtocolComponentElements(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDoseSequenceElement()) {
        composePositiveInt("doseSequence", element.getDoseSequenceElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasAuthority()) {
        composeReference("authority", element.getAuthority());
      }
      if (element.hasSeriesElement()) {
        composeString("series", element.getSeriesElement());
      }
      if (element.hasSeriesDosesElement()) {
        composePositiveInt("seriesDoses", element.getSeriesDosesElement());
      }
      if (element.hasTargetDisease()) { 
        for (CodeableConcept e : element.getTargetDisease()) 
          composeCodeableConcept("targetDisease", e);
      }
      if (element.hasDoseStatus()) {
        composeCodeableConcept("doseStatus", element.getDoseStatus());
      }
      if (element.hasDoseStatusReason()) {
        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
      }
  }

  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationRecommendationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationRecommendationElements(ImmunizationRecommendation element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasRecommendation()) { 
        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent("recommendation", e);
      }
  }

  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentElements(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasVaccineCode()) {
        composeCodeableConcept("vaccineCode", element.getVaccineCode());
      }
      if (element.hasTargetDisease()) {
        composeCodeableConcept("targetDisease", element.getTargetDisease());
      }
      if (element.hasDoseNumberElement()) {
        composePositiveInt("doseNumber", element.getDoseNumberElement());
      }
      if (element.hasForecastStatus()) {
        composeCodeableConcept("forecastStatus", element.getForecastStatus());
      }
      if (element.hasDateCriterion()) { 
        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent("dateCriterion", e);
      }
      if (element.hasProtocol()) {
        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
      }
      if (element.hasSupportingImmunization()) { 
        for (Reference e : element.getSupportingImmunization()) 
          composeReference("supportingImmunization", e);
      }
      if (element.hasSupportingPatientInformation()) { 
        for (Reference e : element.getSupportingPatientInformation()) 
          composeReference("supportingPatientInformation", e);
      }
  }

  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentElements(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasValueElement()) {
        composeDateTime("value", element.getValueElement());
      }
  }

  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentElements(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDoseSequenceElement()) {
        composePositiveInt("doseSequence", element.getDoseSequenceElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasAuthority()) {
        composeReference("authority", element.getAuthority());
      }
      if (element.hasSeriesElement()) {
        composeString("series", element.getSeriesElement());
      }
  }

  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideElements(ImplementationGuide element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasFhirVersionElement()) {
        composeId("fhirVersion", element.getFhirVersionElement());
      }
      if (element.hasDependency()) { 
        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
          composeImplementationGuideImplementationGuideDependencyComponent("dependency", e);
      }
      if (element.hasPackage()) { 
        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
          composeImplementationGuideImplementationGuidePackageComponent("package", e);
      }
      if (element.hasGlobal()) { 
        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
          composeImplementationGuideImplementationGuideGlobalComponent("global", e);
      }
      if (element.hasBinary()) { 
        for (UriType e : element.getBinary()) 
          composeUri("binary", e);
      }
      if (element.hasPage()) {
        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
      }
  }

  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDependencyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDependencyComponentElements(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory());
      if (element.hasUriElement()) {
        composeUri("uri", element.getUriElement());
      }
  }

  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuidePackageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuidePackageComponentElements(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasResource()) { 
        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
          composeImplementationGuideImplementationGuidePackageResourceComponent("resource", e);
      }
  }

  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuidePackageResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuidePackageResourceComponentElements(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasExampleElement()) {
        composeBoolean("example", element.getExampleElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasAcronymElement()) {
        composeString("acronym", element.getAcronymElement());
      }
      if (element.hasSource()) {
        composeType("source", element.getSource());
      }      if (element.hasExampleFor()) {
        composeReference("exampleFor", element.getExampleFor());
      }
  }

  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideGlobalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideGlobalComponentElements(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasProfile()) {
        composeReference("profile", element.getProfile());
      }
  }

  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuidePageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuidePageComponentElements(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSourceElement()) {
        composeUri("source", element.getSourceElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory());
      if (element.hasType()) { 
        for (CodeType e : element.getType()) 
          composeCode("type", e);
      }
      if (element.hasPackage()) { 
        for (StringType e : element.getPackage()) 
          composeString("package", e);
      }
      if (element.hasFormatElement()) {
        composeCode("format", element.getFormatElement());
      }
      if (element.hasPage()) { 
        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
          composeImplementationGuideImplementationGuidePageComponent("page", e);
      }
  }

  protected void composeLibrary(String name, Library element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLibraryElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLibraryElements(Library element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasUsageElement()) {
        composeString("usage", element.getUsageElement());
      }
      if (element.hasApprovalDateElement()) {
        composeDate("approvalDate", element.getApprovalDateElement());
      }
      if (element.hasLastReviewDateElement()) {
        composeDate("lastReviewDate", element.getLastReviewDateElement());
      }
      if (element.hasEffectivePeriod()) {
        composePeriod("effectivePeriod", element.getEffectivePeriod());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasTopic()) { 
        for (CodeableConcept e : element.getTopic()) 
          composeCodeableConcept("topic", e);
      }
      if (element.hasContributor()) { 
        for (Contributor e : element.getContributor()) 
          composeContributor("contributor", e);
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasRelatedArtifact()) { 
        for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
      }
      if (element.hasParameter()) { 
        for (ParameterDefinition e : element.getParameter()) 
          composeParameterDefinition("parameter", e);
      }
      if (element.hasDataRequirement()) { 
        for (DataRequirement e : element.getDataRequirement()) 
          composeDataRequirement("dataRequirement", e);
      }
      if (element.hasContent()) { 
        for (Attachment e : element.getContent()) 
          composeAttachment("content", e);
      }
  }

  protected void composeLinkage(String name, Linkage element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLinkageElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLinkageElements(Linkage element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
      if (element.hasItem()) { 
        for (Linkage.LinkageItemComponent e : element.getItem()) 
          composeLinkageLinkageItemComponent("item", e);
      }
  }

  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLinkageLinkageItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLinkageLinkageItemComponentElements(Linkage.LinkageItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory());
      if (element.hasResource()) {
        composeReference("resource", element.getResource());
      }
  }

  protected void composeListResource(String name, ListResource element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeListResourceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeListResourceElements(ListResource element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory());
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new ListResource.ListModeEnumFactory());
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasEncounter()) {
        composeReference("encounter", element.getEncounter());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasSource()) {
        composeReference("source", element.getSource());
      }
      if (element.hasOrderedBy()) {
        composeCodeableConcept("orderedBy", element.getOrderedBy());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasEntry()) { 
        for (ListResource.ListEntryComponent e : element.getEntry()) 
          composeListResourceListEntryComponent("entry", e);
      }
      if (element.hasEmptyReason()) {
        composeCodeableConcept("emptyReason", element.getEmptyReason());
      }
  }

  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeListResourceListEntryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeListResourceListEntryComponentElements(ListResource.ListEntryComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasFlag()) {
        composeCodeableConcept("flag", element.getFlag());
      }
      if (element.hasDeletedElement()) {
        composeBoolean("deleted", element.getDeletedElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasItem()) {
        composeReference("item", element.getItem());
      }
  }

  protected void composeLocation(String name, Location element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLocationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLocationElements(Location element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Location.LocationStatusEnumFactory());
      if (element.hasOperationalStatus()) {
        composeCoding("operationalStatus", element.getOperationalStatus());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasAlias()) { 
        for (StringType e : element.getAlias()) 
          composeString("alias", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new Location.LocationModeEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasAddress()) {
        composeAddress("address", element.getAddress());
      }
      if (element.hasPhysicalType()) {
        composeCodeableConcept("physicalType", element.getPhysicalType());
      }
      if (element.hasPosition()) {
        composeLocationLocationPositionComponent("position", element.getPosition());
      }
      if (element.hasManagingOrganization()) {
        composeReference("managingOrganization", element.getManagingOrganization());
      }
      if (element.hasPartOf()) {
        composeReference("partOf", element.getPartOf());
      }
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
  }

  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLocationLocationPositionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLocationLocationPositionComponentElements(Location.LocationPositionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLongitudeElement()) {
        composeDecimal("longitude", element.getLongitudeElement());
      }
      if (element.hasLatitudeElement()) {
        composeDecimal("latitude", element.getLatitudeElement());
      }
      if (element.hasAltitudeElement()) {
        composeDecimal("altitude", element.getAltitudeElement());
      }
  }

  protected void composeMeasure(String name, Measure element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureElements(Measure element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasUsageElement()) {
        composeString("usage", element.getUsageElement());
      }
      if (element.hasApprovalDateElement()) {
        composeDate("approvalDate", element.getApprovalDateElement());
      }
      if (element.hasLastReviewDateElement()) {
        composeDate("lastReviewDate", element.getLastReviewDateElement());
      }
      if (element.hasEffectivePeriod()) {
        composePeriod("effectivePeriod", element.getEffectivePeriod());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasTopic()) { 
        for (CodeableConcept e : element.getTopic()) 
          composeCodeableConcept("topic", e);
      }
      if (element.hasContributor()) { 
        for (Contributor e : element.getContributor()) 
          composeContributor("contributor", e);
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasRelatedArtifact()) { 
        for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
      }
      if (element.hasLibrary()) { 
        for (Reference e : element.getLibrary()) 
          composeReference("library", e);
      }
      if (element.hasDisclaimerElement()) {
        composeMarkdown("disclaimer", element.getDisclaimerElement());
      }
      if (element.hasScoring()) {
        composeCodeableConcept("scoring", element.getScoring());
      }
      if (element.hasCompositeScoring()) {
        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
      }
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasRiskAdjustmentElement()) {
        composeString("riskAdjustment", element.getRiskAdjustmentElement());
      }
      if (element.hasRateAggregationElement()) {
        composeString("rateAggregation", element.getRateAggregationElement());
      }
      if (element.hasRationaleElement()) {
        composeMarkdown("rationale", element.getRationaleElement());
      }
      if (element.hasClinicalRecommendationStatementElement()) {
        composeMarkdown("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement());
      }
      if (element.hasImprovementNotationElement()) {
        composeString("improvementNotation", element.getImprovementNotationElement());
      }
      if (element.hasDefinition()) { 
        for (MarkdownType e : element.getDefinition()) 
          composeMarkdown("definition", e);
      }
      if (element.hasGuidanceElement()) {
        composeMarkdown("guidance", element.getGuidanceElement());
      }
      if (element.hasSetElement()) {
        composeString("set", element.getSetElement());
      }
      if (element.hasGroup()) { 
        for (Measure.MeasureGroupComponent e : element.getGroup()) 
          composeMeasureMeasureGroupComponent("group", e);
      }
      if (element.hasSupplementalData()) { 
        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
          composeMeasureMeasureSupplementalDataComponent("supplementalData", e);
      }
  }

  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureMeasureGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureMeasureGroupComponentElements(Measure.MeasureGroupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasPopulation()) { 
        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
          composeMeasureMeasureGroupPopulationComponent("population", e);
      }
      if (element.hasStratifier()) { 
        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
          composeMeasureMeasureGroupStratifierComponent("stratifier", e);
      }
  }

  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureMeasureGroupPopulationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureMeasureGroupPopulationComponentElements(Measure.MeasureGroupPopulationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasCriteriaElement()) {
        composeString("criteria", element.getCriteriaElement());
      }
  }

  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureMeasureGroupStratifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureMeasureGroupStratifierComponentElements(Measure.MeasureGroupStratifierComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasCriteriaElement()) {
        composeString("criteria", element.getCriteriaElement());
      }
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
  }

  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureMeasureSupplementalDataComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureMeasureSupplementalDataComponentElements(Measure.MeasureSupplementalDataComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasUsage()) { 
        for (CodeableConcept e : element.getUsage()) 
          composeCodeableConcept("usage", e);
      }
      if (element.hasCriteriaElement()) {
        composeString("criteria", element.getCriteriaElement());
      }
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
  }

  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportElements(MeasureReport element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory());
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory());
      if (element.hasMeasure()) {
        composeReference("measure", element.getMeasure());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasReportingOrganization()) {
        composeReference("reportingOrganization", element.getReportingOrganization());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasGroup()) { 
        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
          composeMeasureReportMeasureReportGroupComponent("group", e);
      }
      if (element.hasEvaluatedResources()) {
        composeReference("evaluatedResources", element.getEvaluatedResources());
      }
  }

  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportMeasureReportGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportMeasureReportGroupComponentElements(MeasureReport.MeasureReportGroupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasPopulation()) { 
        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
          composeMeasureReportMeasureReportGroupPopulationComponent("population", e);
      }
      if (element.hasMeasureScoreElement()) {
        composeDecimal("measureScore", element.getMeasureScoreElement());
      }
      if (element.hasStratifier()) { 
        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
          composeMeasureReportMeasureReportGroupStratifierComponent("stratifier", e);
      }
  }

  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportMeasureReportGroupPopulationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportMeasureReportGroupPopulationComponentElements(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasCountElement()) {
        composeInteger("count", element.getCountElement());
      }
      if (element.hasPatients()) {
        composeReference("patients", element.getPatients());
      }
  }

  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportMeasureReportGroupStratifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportMeasureReportGroupStratifierComponentElements(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStratum()) { 
        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
          composeMeasureReportStratifierGroupComponent("stratum", e);
      }
  }

  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportStratifierGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportStratifierGroupComponentElements(MeasureReport.StratifierGroupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
      if (element.hasPopulation()) { 
        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
          composeMeasureReportStratifierGroupPopulationComponent("population", e);
      }
      if (element.hasMeasureScoreElement()) {
        composeDecimal("measureScore", element.getMeasureScoreElement());
      }
  }

  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportStratifierGroupPopulationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportStratifierGroupPopulationComponentElements(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasCountElement()) {
        composeInteger("count", element.getCountElement());
      }
      if (element.hasPatients()) {
        composeReference("patients", element.getPatients());
      }
  }

  protected void composeMedia(String name, Media element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMediaElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMediaElements(Media element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory());
      if (element.hasSubtype()) {
        composeCodeableConcept("subtype", element.getSubtype());
      }
      if (element.hasView()) {
        composeCodeableConcept("view", element.getView());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasOperator()) {
        composeReference("operator", element.getOperator());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasBodySite()) {
        composeCodeableConcept("bodySite", element.getBodySite());
      }
      if (element.hasDevice()) {
        composeReference("device", element.getDevice());
      }
      if (element.hasHeightElement()) {
        composePositiveInt("height", element.getHeightElement());
      }
      if (element.hasWidthElement()) {
        composePositiveInt("width", element.getWidthElement());
      }
      if (element.hasFramesElement()) {
        composePositiveInt("frames", element.getFramesElement());
      }
      if (element.hasDurationElement()) {
        composeUnsignedInt("duration", element.getDurationElement());
      }
      if (element.hasContent()) {
        composeAttachment("content", element.getContent());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeMedication(String name, Medication element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationElements(Medication element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory());
      if (element.hasIsBrandElement()) {
        composeBoolean("isBrand", element.getIsBrandElement());
      }
      if (element.hasIsOverTheCounterElement()) {
        composeBoolean("isOverTheCounter", element.getIsOverTheCounterElement());
      }
      if (element.hasManufacturer()) {
        composeReference("manufacturer", element.getManufacturer());
      }
      if (element.hasForm()) {
        composeCodeableConcept("form", element.getForm());
      }
      if (element.hasIngredient()) { 
        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
          composeMedicationMedicationIngredientComponent("ingredient", e);
      }
      if (element.hasPackage()) {
        composeMedicationMedicationPackageComponent("package", element.getPackage());
      }
      if (element.hasImage()) { 
        for (Attachment e : element.getImage()) 
          composeAttachment("image", e);
      }
  }

  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationMedicationIngredientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationMedicationIngredientComponentElements(Medication.MedicationIngredientComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasItem()) {
        composeType("item", element.getItem());
      }      if (element.hasIsActiveElement()) {
        composeBoolean("isActive", element.getIsActiveElement());
      }
      if (element.hasAmount()) {
        composeRatio("amount", element.getAmount());
      }
  }

  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationMedicationPackageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationMedicationPackageComponentElements(Medication.MedicationPackageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContainer()) {
        composeCodeableConcept("container", element.getContainer());
      }
      if (element.hasContent()) { 
        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
          composeMedicationMedicationPackageContentComponent("content", e);
      }
      if (element.hasBatch()) { 
        for (Medication.MedicationPackageBatchComponent e : element.getBatch()) 
          composeMedicationMedicationPackageBatchComponent("batch", e);
      }
  }

  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationMedicationPackageContentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationMedicationPackageContentComponentElements(Medication.MedicationPackageContentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasItem()) {
        composeType("item", element.getItem());
      }      if (element.hasAmount()) {
        composeSimpleQuantity("amount", element.getAmount());
      }
  }

  protected void composeMedicationMedicationPackageBatchComponent(String name, Medication.MedicationPackageBatchComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationMedicationPackageBatchComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationMedicationPackageBatchComponentElements(Medication.MedicationPackageBatchComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLotNumberElement()) {
        composeString("lotNumber", element.getLotNumberElement());
      }
      if (element.hasExpirationDateElement()) {
        composeDateTime("expirationDate", element.getExpirationDateElement());
      }
  }

  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationAdministrationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationAdministrationElements(MedicationAdministration element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasMedication()) {
        composeType("medication", element.getMedication());
      }      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasSupportingInformation()) { 
        for (Reference e : element.getSupportingInformation()) 
          composeReference("supportingInformation", e);
      }
      if (element.hasEffective()) {
        composeType("effective", element.getEffective());
      }      if (element.hasPerformer()) { 
        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
          composeMedicationAdministrationMedicationAdministrationPerformerComponent("performer", e);
      }
      if (element.hasNotGivenElement()) {
        composeBoolean("notGiven", element.getNotGivenElement());
      }
      if (element.hasReasonNotGiven()) { 
        for (CodeableConcept e : element.getReasonNotGiven()) 
          composeCodeableConcept("reasonNotGiven", e);
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasPrescription()) {
        composeReference("prescription", element.getPrescription());
      }
      if (element.hasDevice()) { 
        for (Reference e : element.getDevice()) 
          composeReference("device", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasDosage()) {
        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
      }
      if (element.hasEventHistory()) { 
        for (Reference e : element.getEventHistory()) 
          composeReference("eventHistory", e);
      }
  }

  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationAdministrationMedicationAdministrationPerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentElements(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationAdministrationMedicationAdministrationDosageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentElements(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasSite()) {
        composeCodeableConcept("site", element.getSite());
      }
      if (element.hasRoute()) {
        composeCodeableConcept("route", element.getRoute());
      }
      if (element.hasMethod()) {
        composeCodeableConcept("method", element.getMethod());
      }
      if (element.hasDose()) {
        composeSimpleQuantity("dose", element.getDose());
      }
      if (element.hasRate()) {
        composeType("rate", element.getRate());
      }  }

  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationDispenseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationDispenseElements(MedicationDispense element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasMedication()) {
        composeType("medication", element.getMedication());
      }      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasSupportingInformation()) { 
        for (Reference e : element.getSupportingInformation()) 
          composeReference("supportingInformation", e);
      }
      if (element.hasPerformer()) { 
        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
          composeMedicationDispenseMedicationDispensePerformerComponent("performer", e);
      }
      if (element.hasAuthorizingPrescription()) { 
        for (Reference e : element.getAuthorizingPrescription()) 
          composeReference("authorizingPrescription", e);
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasDaysSupply()) {
        composeSimpleQuantity("daysSupply", element.getDaysSupply());
      }
      if (element.hasWhenPreparedElement()) {
        composeDateTime("whenPrepared", element.getWhenPreparedElement());
      }
      if (element.hasWhenHandedOverElement()) {
        composeDateTime("whenHandedOver", element.getWhenHandedOverElement());
      }
      if (element.hasDestination()) {
        composeReference("destination", element.getDestination());
      }
      if (element.hasReceiver()) { 
        for (Reference e : element.getReceiver()) 
          composeReference("receiver", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasDosageInstruction()) { 
        for (Dosage e : element.getDosageInstruction()) 
          composeDosage("dosageInstruction", e);
      }
      if (element.hasSubstitution()) {
        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
      }
      if (element.hasDetectedIssue()) { 
        for (Reference e : element.getDetectedIssue()) 
          composeReference("detectedIssue", e);
      }
      if (element.hasNotDoneElement()) {
        composeBoolean("notDone", element.getNotDoneElement());
      }
      if (element.hasNotDoneReason()) {
        composeType("notDoneReason", element.getNotDoneReason());
      }      if (element.hasEventHistory()) { 
        for (Reference e : element.getEventHistory()) 
          composeReference("eventHistory", e);
      }
  }

  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationDispenseMedicationDispensePerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationDispenseMedicationDispensePerformerComponentElements(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationDispenseMedicationDispenseSubstitutionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentElements(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasWasSubstitutedElement()) {
        composeBoolean("wasSubstituted", element.getWasSubstitutedElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasReason()) { 
        for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
      }
      if (element.hasResponsibleParty()) { 
        for (Reference e : element.getResponsibleParty()) 
          composeReference("responsibleParty", e);
      }
  }

  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestElements(MedicationRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasGroupIdentifier()) {
        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory());
      if (element.hasIntentElement())
        composeEnumeration("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory());
      if (element.hasMedication()) {
        composeType("medication", element.getMedication());
      }      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasSupportingInformation()) { 
        for (Reference e : element.getSupportingInformation()) 
          composeReference("supportingInformation", e);
      }
      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasRequester()) {
        composeMedicationRequestMedicationRequestRequesterComponent("requester", element.getRequester());
      }
      if (element.hasRecorder()) {
        composeReference("recorder", element.getRecorder());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasDosageInstruction()) { 
        for (Dosage e : element.getDosageInstruction()) 
          composeDosage("dosageInstruction", e);
      }
      if (element.hasDispenseRequest()) {
        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
      }
      if (element.hasSubstitution()) {
        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
      }
      if (element.hasPriorPrescription()) {
        composeReference("priorPrescription", element.getPriorPrescription());
      }
      if (element.hasDetectedIssue()) { 
        for (Reference e : element.getDetectedIssue()) 
          composeReference("detectedIssue", e);
      }
      if (element.hasEventHistory()) { 
        for (Reference e : element.getEventHistory()) 
          composeReference("eventHistory", e);
      }
  }

  protected void composeMedicationRequestMedicationRequestRequesterComponent(String name, MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestMedicationRequestRequesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestMedicationRequestRequesterComponentElements(MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAgent()) {
        composeReference("agent", element.getAgent());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestMedicationRequestDispenseRequestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentElements(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasValidityPeriod()) {
        composePeriod("validityPeriod", element.getValidityPeriod());
      }
      if (element.hasNumberOfRepeatsAllowedElement()) {
        composePositiveInt("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement());
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasExpectedSupplyDuration()) {
        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
      }
      if (element.hasPerformer()) {
        composeReference("performer", element.getPerformer());
      }
  }

  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestMedicationRequestSubstitutionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestMedicationRequestSubstitutionComponentElements(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAllowedElement()) {
        composeBoolean("allowed", element.getAllowedElement());
      }
      if (element.hasReason()) {
        composeCodeableConcept("reason", element.getReason());
      }
  }

  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationStatementElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationStatementElements(MedicationStatement element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasMedication()) {
        composeType("medication", element.getMedication());
      }      if (element.hasEffective()) {
        composeType("effective", element.getEffective());
      }      if (element.hasDateAssertedElement()) {
        composeDateTime("dateAsserted", element.getDateAssertedElement());
      }
      if (element.hasInformationSource()) {
        composeReference("informationSource", element.getInformationSource());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasDerivedFrom()) { 
        for (Reference e : element.getDerivedFrom()) 
          composeReference("derivedFrom", e);
      }
      if (element.hasTakenElement())
        composeEnumeration("taken", element.getTakenElement(), new MedicationStatement.MedicationStatementTakenEnumFactory());
      if (element.hasReasonNotTaken()) { 
        for (CodeableConcept e : element.getReasonNotTaken()) 
          composeCodeableConcept("reasonNotTaken", e);
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasDosage()) { 
        for (Dosage e : element.getDosage()) 
          composeDosage("dosage", e);
      }
  }

  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageDefinitionElements(MessageDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasBase()) {
        composeReference("base", element.getBase());
      }
      if (element.hasParent()) { 
        for (Reference e : element.getParent()) 
          composeReference("parent", e);
      }
      if (element.hasReplaces()) { 
        for (Reference e : element.getReplaces()) 
          composeReference("replaces", e);
      }
      if (element.hasEvent()) {
        composeCoding("event", element.getEvent());
      }
      if (element.hasCategoryElement())
        composeEnumeration("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory());
      if (element.hasFocus()) { 
        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
          composeMessageDefinitionMessageDefinitionFocusComponent("focus", e);
      }
      if (element.hasResponseRequiredElement()) {
        composeBoolean("responseRequired", element.getResponseRequiredElement());
      }
      if (element.hasAllowedResponse()) { 
        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
          composeMessageDefinitionMessageDefinitionAllowedResponseComponent("allowedResponse", e);
      }
  }

  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageDefinitionMessageDefinitionFocusComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageDefinitionMessageDefinitionFocusComponentElements(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasProfile()) {
        composeReference("profile", element.getProfile());
      }
      if (element.hasMinElement()) {
        composeUnsignedInt("min", element.getMinElement());
      }
      if (element.hasMaxElement()) {
        composeString("max", element.getMaxElement());
      }
  }

  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageDefinitionMessageDefinitionAllowedResponseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentElements(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasMessage()) {
        composeReference("message", element.getMessage());
      }
      if (element.hasSituationElement()) {
        composeMarkdown("situation", element.getSituationElement());
      }
  }

  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageHeaderElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageHeaderElements(MessageHeader element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasEvent()) {
        composeCoding("event", element.getEvent());
      }
      if (element.hasDestination()) { 
        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
          composeMessageHeaderMessageDestinationComponent("destination", e);
      }
      if (element.hasReceiver()) {
        composeReference("receiver", element.getReceiver());
      }
      if (element.hasSender()) {
        composeReference("sender", element.getSender());
      }
      if (element.hasTimestampElement()) {
        composeInstant("timestamp", element.getTimestampElement());
      }
      if (element.hasEnterer()) {
        composeReference("enterer", element.getEnterer());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
      if (element.hasSource()) {
        composeMessageHeaderMessageSourceComponent("source", element.getSource());
      }
      if (element.hasResponsible()) {
        composeReference("responsible", element.getResponsible());
      }
      if (element.hasReason()) {
        composeCodeableConcept("reason", element.getReason());
      }
      if (element.hasResponse()) {
        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
      }
      if (element.hasFocus()) { 
        for (Reference e : element.getFocus()) 
          composeReference("focus", e);
      }
  }

  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageHeaderMessageDestinationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageHeaderMessageDestinationComponentElements(MessageHeader.MessageDestinationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTarget()) {
        composeReference("target", element.getTarget());
      }
      if (element.hasEndpointElement()) {
        composeUri("endpoint", element.getEndpointElement());
      }
  }

  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageHeaderMessageSourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageHeaderMessageSourceComponentElements(MessageHeader.MessageSourceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasSoftwareElement()) {
        composeString("software", element.getSoftwareElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasContact()) {
        composeContactPoint("contact", element.getContact());
      }
      if (element.hasEndpointElement()) {
        composeUri("endpoint", element.getEndpointElement());
      }
  }

  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageHeaderMessageHeaderResponseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageHeaderMessageHeaderResponseComponentElements(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifierElement()) {
        composeId("identifier", element.getIdentifierElement());
      }
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory());
      if (element.hasDetails()) {
        composeReference("details", element.getDetails());
      }
  }

  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNamingSystemElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNamingSystemElements(NamingSystem element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory());
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasResponsibleElement()) {
        composeString("responsible", element.getResponsibleElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasUsageElement()) {
        composeString("usage", element.getUsageElement());
      }
      if (element.hasUniqueId()) { 
        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
          composeNamingSystemNamingSystemUniqueIdComponent("uniqueId", e);
      }
      if (element.hasReplacedBy()) {
        composeReference("replacedBy", element.getReplacedBy());
      }
  }

  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNamingSystemNamingSystemUniqueIdComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNamingSystemNamingSystemUniqueIdComponentElements(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory());
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
      if (element.hasPreferredElement()) {
        composeBoolean("preferred", element.getPreferredElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderElements(NutritionOrder element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory());
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasEncounter()) {
        composeReference("encounter", element.getEncounter());
      }
      if (element.hasDateTimeElement()) {
        composeDateTime("dateTime", element.getDateTimeElement());
      }
      if (element.hasOrderer()) {
        composeReference("orderer", element.getOrderer());
      }
      if (element.hasAllergyIntolerance()) { 
        for (Reference e : element.getAllergyIntolerance()) 
          composeReference("allergyIntolerance", e);
      }
      if (element.hasFoodPreferenceModifier()) { 
        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
          composeCodeableConcept("foodPreferenceModifier", e);
      }
      if (element.hasExcludeFoodModifier()) { 
        for (CodeableConcept e : element.getExcludeFoodModifier()) 
          composeCodeableConcept("excludeFoodModifier", e);
      }
      if (element.hasOralDiet()) {
        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
      }
      if (element.hasSupplement()) { 
        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
          composeNutritionOrderNutritionOrderSupplementComponent("supplement", e);
      }
      if (element.hasEnteralFormula()) {
        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
      }
  }

  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderNutritionOrderOralDietComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderNutritionOrderOralDietComponentElements(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasSchedule()) { 
        for (Timing e : element.getSchedule()) 
          composeTiming("schedule", e);
      }
      if (element.hasNutrient()) { 
        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
          composeNutritionOrderNutritionOrderOralDietNutrientComponent("nutrient", e);
      }
      if (element.hasTexture()) { 
        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
          composeNutritionOrderNutritionOrderOralDietTextureComponent("texture", e);
      }
      if (element.hasFluidConsistencyType()) { 
        for (CodeableConcept e : element.getFluidConsistencyType()) 
          composeCodeableConcept("fluidConsistencyType", e);
      }
      if (element.hasInstructionElement()) {
        composeString("instruction", element.getInstructionElement());
      }
  }

  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderNutritionOrderOralDietNutrientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentElements(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasModifier()) {
        composeCodeableConcept("modifier", element.getModifier());
      }
      if (element.hasAmount()) {
        composeSimpleQuantity("amount", element.getAmount());
      }
  }

  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderNutritionOrderOralDietTextureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentElements(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasModifier()) {
        composeCodeableConcept("modifier", element.getModifier());
      }
      if (element.hasFoodType()) {
        composeCodeableConcept("foodType", element.getFoodType());
      }
  }

  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderNutritionOrderSupplementComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderNutritionOrderSupplementComponentElements(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasProductNameElement()) {
        composeString("productName", element.getProductNameElement());
      }
      if (element.hasSchedule()) { 
        for (Timing e : element.getSchedule()) 
          composeTiming("schedule", e);
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasInstructionElement()) {
        composeString("instruction", element.getInstructionElement());
      }
  }

  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderNutritionOrderEnteralFormulaComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentElements(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasBaseFormulaType()) {
        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
      }
      if (element.hasBaseFormulaProductNameElement()) {
        composeString("baseFormulaProductName", element.getBaseFormulaProductNameElement());
      }
      if (element.hasAdditiveType()) {
        composeCodeableConcept("additiveType", element.getAdditiveType());
      }
      if (element.hasAdditiveProductNameElement()) {
        composeString("additiveProductName", element.getAdditiveProductNameElement());
      }
      if (element.hasCaloricDensity()) {
        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
      }
      if (element.hasRouteofAdministration()) {
        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
      }
      if (element.hasAdministration()) { 
        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent("administration", e);
      }
      if (element.hasMaxVolumeToDeliver()) {
        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
      }
      if (element.hasAdministrationInstructionElement()) {
        composeString("administrationInstruction", element.getAdministrationInstructionElement());
      }
  }

  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentElements(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSchedule()) {
        composeTiming("schedule", element.getSchedule());
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasRate()) {
        composeType("rate", element.getRate());
      }  }

  protected void composeObservation(String name, Observation element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationElements(Observation element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasEffective()) {
        composeType("effective", element.getEffective());
      }      if (element.hasIssuedElement()) {
        composeInstant("issued", element.getIssuedElement());
      }
      if (element.hasPerformer()) { 
        for (Reference e : element.getPerformer()) 
          composeReference("performer", e);
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }      if (element.hasDataAbsentReason()) {
        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
      }
      if (element.hasInterpretation()) {
        composeCodeableConcept("interpretation", element.getInterpretation());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
      if (element.hasBodySite()) {
        composeCodeableConcept("bodySite", element.getBodySite());
      }
      if (element.hasMethod()) {
        composeCodeableConcept("method", element.getMethod());
      }
      if (element.hasSpecimen()) {
        composeReference("specimen", element.getSpecimen());
      }
      if (element.hasDevice()) {
        composeReference("device", element.getDevice());
      }
      if (element.hasReferenceRange()) { 
        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
          composeObservationObservationReferenceRangeComponent("referenceRange", e);
      }
      if (element.hasRelated()) { 
        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
          composeObservationObservationRelatedComponent("related", e);
      }
      if (element.hasComponent()) { 
        for (Observation.ObservationComponentComponent e : element.getComponent()) 
          composeObservationObservationComponentComponent("component", e);
      }
  }

  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationObservationReferenceRangeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationObservationReferenceRangeComponentElements(Observation.ObservationReferenceRangeComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLow()) {
        composeSimpleQuantity("low", element.getLow());
      }
      if (element.hasHigh()) {
        composeSimpleQuantity("high", element.getHigh());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasAppliesTo()) { 
        for (CodeableConcept e : element.getAppliesTo()) 
          composeCodeableConcept("appliesTo", e);
      }
      if (element.hasAge()) {
        composeRange("age", element.getAge());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
  }

  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationObservationRelatedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationObservationRelatedComponentElements(Observation.ObservationRelatedComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory());
      if (element.hasTarget()) {
        composeReference("target", element.getTarget());
      }
  }

  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationObservationComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationObservationComponentComponentElements(Observation.ObservationComponentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }      if (element.hasDataAbsentReason()) {
        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
      }
      if (element.hasInterpretation()) {
        composeCodeableConcept("interpretation", element.getInterpretation());
      }
      if (element.hasReferenceRange()) { 
        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
          composeObservationObservationReferenceRangeComponent("referenceRange", e);
      }
  }

  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionElements(OperationDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasIdempotentElement()) {
        composeBoolean("idempotent", element.getIdempotentElement());
      }
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
      if (element.hasBase()) {
        composeReference("base", element.getBase());
      }
      if (element.hasResource()) { 
        for (CodeType e : element.getResource()) 
          composeCode("resource", e);
      }
      if (element.hasSystemElement()) {
        composeBoolean("system", element.getSystemElement());
      }
      if (element.hasTypeElement()) {
        composeBoolean("type", element.getTypeElement());
      }
      if (element.hasInstanceElement()) {
        composeBoolean("instance", element.getInstanceElement());
      }
      if (element.hasParameter()) { 
        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
          composeOperationDefinitionOperationDefinitionParameterComponent("parameter", e);
      }
      if (element.hasOverload()) { 
        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
          composeOperationDefinitionOperationDefinitionOverloadComponent("overload", e);
      }
  }

  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionOperationDefinitionParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionOperationDefinitionParameterComponentElements(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeCode("name", element.getNameElement());
      }
      if (element.hasUseElement())
        composeEnumeration("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory());
      if (element.hasMinElement()) {
        composeInteger("min", element.getMinElement());
      }
      if (element.hasMaxElement()) {
        composeString("max", element.getMaxElement());
      }
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasSearchTypeElement())
        composeEnumeration("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory());
      if (element.hasProfile()) {
        composeReference("profile", element.getProfile());
      }
      if (element.hasBinding()) {
        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
      }
      if (element.hasPart()) { 
        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
          composeOperationDefinitionOperationDefinitionParameterComponent("part", e);
      }
  }

  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionOperationDefinitionParameterBindingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentElements(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasStrengthElement())
        composeEnumeration("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory());
      if (element.hasValueSet()) {
        composeType("valueSet", element.getValueSet());
      }  }

  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionOperationDefinitionOverloadComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionOperationDefinitionOverloadComponentElements(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasParameterName()) { 
        for (StringType e : element.getParameterName()) 
          composeString("parameterName", e);
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationOutcomeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationOutcomeElements(OperationOutcome element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIssue()) { 
        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
          composeOperationOutcomeOperationOutcomeIssueComponent("issue", e);
      }
  }

  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationOutcomeOperationOutcomeIssueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationOutcomeOperationOutcomeIssueComponentElements(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSeverityElement())
        composeEnumeration("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory());
      if (element.hasCodeElement())
        composeEnumeration("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory());
      if (element.hasDetails()) {
        composeCodeableConcept("details", element.getDetails());
      }
      if (element.hasDiagnosticsElement()) {
        composeString("diagnostics", element.getDiagnosticsElement());
      }
      if (element.hasLocation()) { 
        for (StringType e : element.getLocation()) 
          composeString("location", e);
      }
      if (element.hasExpression()) { 
        for (StringType e : element.getExpression()) 
          composeString("expression", e);
      }
  }

  protected void composeOrganization(String name, Organization element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOrganizationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOrganizationElements(Organization element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasType()) { 
        for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasAlias()) { 
        for (StringType e : element.getAlias()) 
          composeString("alias", e);
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasAddress()) { 
        for (Address e : element.getAddress()) 
          composeAddress("address", e);
      }
      if (element.hasPartOf()) {
        composeReference("partOf", element.getPartOf());
      }
      if (element.hasContact()) { 
        for (Organization.OrganizationContactComponent e : element.getContact()) 
          composeOrganizationOrganizationContactComponent("contact", e);
      }
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
  }

  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOrganizationOrganizationContactComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOrganizationOrganizationContactComponentElements(Organization.OrganizationContactComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasPurpose()) {
        composeCodeableConcept("purpose", element.getPurpose());
      }
      if (element.hasName()) {
        composeHumanName("name", element.getName());
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasAddress()) {
        composeAddress("address", element.getAddress());
      }
  }

  protected void composePatient(String name, Patient element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePatientElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePatientElements(Patient element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasName()) { 
        for (HumanName e : element.getName()) 
          composeHumanName("name", e);
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasGenderElement())
        composeEnumeration("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory());
      if (element.hasBirthDateElement()) {
        composeDate("birthDate", element.getBirthDateElement());
      }
      if (element.hasDeceased()) {
        composeType("deceased", element.getDeceased());
      }      if (element.hasAddress()) { 
        for (Address e : element.getAddress()) 
          composeAddress("address", e);
      }
      if (element.hasMaritalStatus()) {
        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
      }
      if (element.hasMultipleBirth()) {
        composeType("multipleBirth", element.getMultipleBirth());
      }      if (element.hasPhoto()) { 
        for (Attachment e : element.getPhoto()) 
          composeAttachment("photo", e);
      }
      if (element.hasContact()) { 
        for (Patient.ContactComponent e : element.getContact()) 
          composePatientContactComponent("contact", e);
      }
      if (element.hasAnimal()) {
        composePatientAnimalComponent("animal", element.getAnimal());
      }
      if (element.hasCommunication()) { 
        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
          composePatientPatientCommunicationComponent("communication", e);
      }
      if (element.hasGeneralPractitioner()) { 
        for (Reference e : element.getGeneralPractitioner()) 
          composeReference("generalPractitioner", e);
      }
      if (element.hasManagingOrganization()) {
        composeReference("managingOrganization", element.getManagingOrganization());
      }
      if (element.hasLink()) { 
        for (Patient.PatientLinkComponent e : element.getLink()) 
          composePatientPatientLinkComponent("link", e);
      }
  }

  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePatientContactComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePatientContactComponentElements(Patient.ContactComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRelationship()) { 
        for (CodeableConcept e : element.getRelationship()) 
          composeCodeableConcept("relationship", e);
      }
      if (element.hasName()) {
        composeHumanName("name", element.getName());
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasAddress()) {
        composeAddress("address", element.getAddress());
      }
      if (element.hasGenderElement())
        composeEnumeration("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory());
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePatientAnimalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePatientAnimalComponentElements(Patient.AnimalComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSpecies()) {
        composeCodeableConcept("species", element.getSpecies());
      }
      if (element.hasBreed()) {
        composeCodeableConcept("breed", element.getBreed());
      }
      if (element.hasGenderStatus()) {
        composeCodeableConcept("genderStatus", element.getGenderStatus());
      }
  }

  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePatientPatientCommunicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePatientPatientCommunicationComponentElements(Patient.PatientCommunicationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLanguage()) {
        composeCodeableConcept("language", element.getLanguage());
      }
      if (element.hasPreferredElement()) {
        composeBoolean("preferred", element.getPreferredElement());
      }
  }

  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePatientPatientLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePatientPatientLinkComponentElements(Patient.PatientLinkComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOther()) {
        composeReference("other", element.getOther());
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory());
  }

  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePaymentNoticeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePaymentNoticeElements(PaymentNotice element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory());
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasResponse()) {
        composeReference("response", element.getResponse());
      }
      if (element.hasStatusDateElement()) {
        composeDate("statusDate", element.getStatusDateElement());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasTarget()) {
        composeReference("target", element.getTarget());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasPaymentStatus()) {
        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
      }
  }

  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePaymentReconciliationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePaymentReconciliationElements(PaymentReconciliation element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory());
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasDispositionElement()) {
        composeString("disposition", element.getDispositionElement());
      }
      if (element.hasRequestProvider()) {
        composeReference("requestProvider", element.getRequestProvider());
      }
      if (element.hasRequestOrganization()) {
        composeReference("requestOrganization", element.getRequestOrganization());
      }
      if (element.hasDetail()) { 
        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
          composePaymentReconciliationDetailsComponent("detail", e);
      }
      if (element.hasForm()) {
        composeCodeableConcept("form", element.getForm());
      }
      if (element.hasTotal()) {
        composeMoney("total", element.getTotal());
      }
      if (element.hasProcessNote()) { 
        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
          composePaymentReconciliationNotesComponent("processNote", e);
      }
  }

  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePaymentReconciliationDetailsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePaymentReconciliationDetailsComponentElements(PaymentReconciliation.DetailsComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasResponse()) {
        composeReference("response", element.getResponse());
      }
      if (element.hasSubmitter()) {
        composeReference("submitter", element.getSubmitter());
      }
      if (element.hasPayee()) {
        composeReference("payee", element.getPayee());
      }
      if (element.hasDateElement()) {
        composeDate("date", element.getDateElement());
      }
      if (element.hasAmount()) {
        composeMoney("amount", element.getAmount());
      }
  }

  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePaymentReconciliationNotesComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePaymentReconciliationNotesComponentElements(PaymentReconciliation.NotesComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
  }

  protected void composePerson(String name, Person element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePersonElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePersonElements(Person element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasName()) { 
        for (HumanName e : element.getName()) 
          composeHumanName("name", e);
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasGenderElement())
        composeEnumeration("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory());
      if (element.hasBirthDateElement()) {
        composeDate("birthDate", element.getBirthDateElement());
      }
      if (element.hasAddress()) { 
        for (Address e : element.getAddress()) 
          composeAddress("address", e);
      }
      if (element.hasPhoto()) {
        composeAttachment("photo", element.getPhoto());
      }
      if (element.hasManagingOrganization()) {
        composeReference("managingOrganization", element.getManagingOrganization());
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasLink()) { 
        for (Person.PersonLinkComponent e : element.getLink()) 
          composePersonPersonLinkComponent("link", e);
      }
  }

  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePersonPersonLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePersonPersonLinkComponentElements(Person.PersonLinkComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTarget()) {
        composeReference("target", element.getTarget());
      }
      if (element.hasAssuranceElement())
        composeEnumeration("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory());
  }

  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionElements(PlanDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasUsageElement()) {
        composeString("usage", element.getUsageElement());
      }
      if (element.hasApprovalDateElement()) {
        composeDate("approvalDate", element.getApprovalDateElement());
      }
      if (element.hasLastReviewDateElement()) {
        composeDate("lastReviewDate", element.getLastReviewDateElement());
      }
      if (element.hasEffectivePeriod()) {
        composePeriod("effectivePeriod", element.getEffectivePeriod());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasTopic()) { 
        for (CodeableConcept e : element.getTopic()) 
          composeCodeableConcept("topic", e);
      }
      if (element.hasContributor()) { 
        for (Contributor e : element.getContributor()) 
          composeContributor("contributor", e);
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasRelatedArtifact()) { 
        for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
      }
      if (element.hasLibrary()) { 
        for (Reference e : element.getLibrary()) 
          composeReference("library", e);
      }
      if (element.hasGoal()) { 
        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
          composePlanDefinitionPlanDefinitionGoalComponent("goal", e);
      }
      if (element.hasAction()) { 
        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
          composePlanDefinitionPlanDefinitionActionComponent("action", e);
      }
  }

  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionPlanDefinitionGoalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionPlanDefinitionGoalComponentElements(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasDescription()) {
        composeCodeableConcept("description", element.getDescription());
      }
      if (element.hasPriority()) {
        composeCodeableConcept("priority", element.getPriority());
      }
      if (element.hasStart()) {
        composeCodeableConcept("start", element.getStart());
      }
      if (element.hasAddresses()) { 
        for (CodeableConcept e : element.getAddresses()) 
          composeCodeableConcept("addresses", e);
      }
      if (element.hasDocumentation()) { 
        for (RelatedArtifact e : element.getDocumentation()) 
          composeRelatedArtifact("documentation", e);
      }
      if (element.hasTarget()) { 
        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
          composePlanDefinitionPlanDefinitionGoalTargetComponent("target", e);
      }
  }

  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionPlanDefinitionGoalTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentElements(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasMeasure()) {
        composeCodeableConcept("measure", element.getMeasure());
      }
      if (element.hasDetail()) {
        composeType("detail", element.getDetail());
      }      if (element.hasDue()) {
        composeDuration("due", element.getDue());
      }
  }

  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionPlanDefinitionActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionPlanDefinitionActionComponentElements(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLabelElement()) {
        composeString("label", element.getLabelElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasTextEquivalentElement()) {
        composeString("textEquivalent", element.getTextEquivalentElement());
      }
      if (element.hasCode()) { 
        for (CodeableConcept e : element.getCode()) 
          composeCodeableConcept("code", e);
      }
      if (element.hasReason()) { 
        for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
      }
      if (element.hasDocumentation()) { 
        for (RelatedArtifact e : element.getDocumentation()) 
          composeRelatedArtifact("documentation", e);
      }
      if (element.hasGoalId()) { 
        for (IdType e : element.getGoalId()) 
          composeId("goalId", e);
      }
      if (element.hasTriggerDefinition()) { 
        for (TriggerDefinition e : element.getTriggerDefinition()) 
          composeTriggerDefinition("triggerDefinition", e);
      }
      if (element.hasCondition()) { 
        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
          composePlanDefinitionPlanDefinitionActionConditionComponent("condition", e);
      }
      if (element.hasInput()) { 
        for (DataRequirement e : element.getInput()) 
          composeDataRequirement("input", e);
      }
      if (element.hasOutput()) { 
        for (DataRequirement e : element.getOutput()) 
          composeDataRequirement("output", e);
      }
      if (element.hasRelatedAction()) { 
        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
          composePlanDefinitionPlanDefinitionActionRelatedActionComponent("relatedAction", e);
      }
      if (element.hasTiming()) {
        composeType("timing", element.getTiming());
      }      if (element.hasParticipant()) { 
        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
          composePlanDefinitionPlanDefinitionActionParticipantComponent("participant", e);
      }
      if (element.hasType()) {
        composeCoding("type", element.getType());
      }
      if (element.hasGroupingBehaviorElement())
        composeEnumeration("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory());
      if (element.hasSelectionBehaviorElement())
        composeEnumeration("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory());
      if (element.hasRequiredBehaviorElement())
        composeEnumeration("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory());
      if (element.hasPrecheckBehaviorElement())
        composeEnumeration("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory());
      if (element.hasCardinalityBehaviorElement())
        composeEnumeration("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory());
      if (element.hasDefinition()) {
        composeReference("definition", element.getDefinition());
      }
      if (element.hasTransform()) {
        composeReference("transform", element.getTransform());
      }
      if (element.hasDynamicValue()) { 
        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
          composePlanDefinitionPlanDefinitionActionDynamicValueComponent("dynamicValue", e);
      }
      if (element.hasAction()) { 
        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
          composePlanDefinitionPlanDefinitionActionComponent("action", e);
      }
  }

  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionPlanDefinitionActionConditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionPlanDefinitionActionConditionComponentElements(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory());
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasLanguageElement()) {
        composeString("language", element.getLanguageElement());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
  }

  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionPlanDefinitionActionRelatedActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentElements(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasActionIdElement()) {
        composeId("actionId", element.getActionIdElement());
      }
      if (element.hasRelationshipElement())
        composeEnumeration("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory());
      if (element.hasOffset()) {
        composeType("offset", element.getOffset());
      }  }

  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionPlanDefinitionActionParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentElements(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory());
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
  }

  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionPlanDefinitionActionDynamicValueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentElements(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasLanguageElement()) {
        composeString("language", element.getLanguageElement());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
  }

  protected void composePractitioner(String name, Practitioner element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerElements(Practitioner element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasName()) { 
        for (HumanName e : element.getName()) 
          composeHumanName("name", e);
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasAddress()) { 
        for (Address e : element.getAddress()) 
          composeAddress("address", e);
      }
      if (element.hasGenderElement())
        composeEnumeration("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory());
      if (element.hasBirthDateElement()) {
        composeDate("birthDate", element.getBirthDateElement());
      }
      if (element.hasPhoto()) { 
        for (Attachment e : element.getPhoto()) 
          composeAttachment("photo", e);
      }
      if (element.hasQualification()) { 
        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
          composePractitionerPractitionerQualificationComponent("qualification", e);
      }
      if (element.hasCommunication()) { 
        for (CodeableConcept e : element.getCommunication()) 
          composeCodeableConcept("communication", e);
      }
  }

  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerPractitionerQualificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerPractitionerQualificationComponentElements(Practitioner.PractitionerQualificationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasIssuer()) {
        composeReference("issuer", element.getIssuer());
      }
  }

  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerRoleElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerRoleElements(PractitionerRole element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasPractitioner()) {
        composeReference("practitioner", element.getPractitioner());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasCode()) { 
        for (CodeableConcept e : element.getCode()) 
          composeCodeableConcept("code", e);
      }
      if (element.hasSpecialty()) { 
        for (CodeableConcept e : element.getSpecialty()) 
          composeCodeableConcept("specialty", e);
      }
      if (element.hasLocation()) { 
        for (Reference e : element.getLocation()) 
          composeReference("location", e);
      }
      if (element.hasHealthcareService()) { 
        for (Reference e : element.getHealthcareService()) 
          composeReference("healthcareService", e);
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasAvailableTime()) { 
        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
          composePractitionerRolePractitionerRoleAvailableTimeComponent("availableTime", e);
      }
      if (element.hasNotAvailable()) { 
        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
          composePractitionerRolePractitionerRoleNotAvailableComponent("notAvailable", e);
      }
      if (element.hasAvailabilityExceptionsElement()) {
        composeString("availabilityExceptions", element.getAvailabilityExceptionsElement());
      }
      if (element.hasEndpoint()) { 
        for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
      }
  }

  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerRolePractitionerRoleAvailableTimeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentElements(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
      composeBackboneElements(element);
        if (element.hasDaysOfWeek()) 
          for (Enumeration e : element.getDaysOfWeek()) 
            composeEnumeration("daysOfWeek", e, new PractitionerRole.DaysOfWeekEnumFactory());
      if (element.hasAllDayElement()) {
        composeBoolean("allDay", element.getAllDayElement());
      }
      if (element.hasAvailableStartTimeElement()) {
        composeTime("availableStartTime", element.getAvailableStartTimeElement());
      }
      if (element.hasAvailableEndTimeElement()) {
        composeTime("availableEndTime", element.getAvailableEndTimeElement());
      }
  }

  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerRolePractitionerRoleNotAvailableComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerRolePractitionerRoleNotAvailableComponentElements(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasDuring()) {
        composePeriod("during", element.getDuring());
      }
  }

  protected void composeProcedure(String name, Procedure element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcedureElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcedureElements(Procedure element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory());
      if (element.hasNotDoneElement()) {
        composeBoolean("notDone", element.getNotDoneElement());
      }
      if (element.hasNotDoneReason()) {
        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
      }
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasPerformed()) {
        composeType("performed", element.getPerformed());
      }      if (element.hasPerformer()) { 
        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
          composeProcedureProcedurePerformerComponent("performer", e);
      }
      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasBodySite()) { 
        for (CodeableConcept e : element.getBodySite()) 
          composeCodeableConcept("bodySite", e);
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasReport()) { 
        for (Reference e : element.getReport()) 
          composeReference("report", e);
      }
      if (element.hasComplication()) { 
        for (CodeableConcept e : element.getComplication()) 
          composeCodeableConcept("complication", e);
      }
      if (element.hasComplicationDetail()) { 
        for (Reference e : element.getComplicationDetail()) 
          composeReference("complicationDetail", e);
      }
      if (element.hasFollowUp()) { 
        for (CodeableConcept e : element.getFollowUp()) 
          composeCodeableConcept("followUp", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasFocalDevice()) { 
        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
          composeProcedureProcedureFocalDeviceComponent("focalDevice", e);
      }
      if (element.hasUsedReference()) { 
        for (Reference e : element.getUsedReference()) 
          composeReference("usedReference", e);
      }
      if (element.hasUsedCode()) { 
        for (CodeableConcept e : element.getUsedCode()) 
          composeCodeableConcept("usedCode", e);
      }
  }

  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcedureProcedurePerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcedureProcedurePerformerComponentElements(Procedure.ProcedurePerformerComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) {
        composeCodeableConcept("role", element.getRole());
      }
      if (element.hasActor()) {
        composeReference("actor", element.getActor());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcedureProcedureFocalDeviceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcedureProcedureFocalDeviceComponentElements(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAction()) {
        composeCodeableConcept("action", element.getAction());
      }
      if (element.hasManipulated()) {
        composeReference("manipulated", element.getManipulated());
      }
  }

  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcedureRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcedureRequestElements(ProcedureRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasReplaces()) { 
        for (Reference e : element.getReplaces()) 
          composeReference("replaces", e);
      }
      if (element.hasRequisition()) {
        composeIdentifier("requisition", element.getRequisition());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory());
      if (element.hasIntentElement())
        composeEnumeration("intent", element.getIntentElement(), new ProcedureRequest.ProcedureRequestIntentEnumFactory());
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory());
      if (element.hasDoNotPerformElement()) {
        composeBoolean("doNotPerform", element.getDoNotPerformElement());
      }
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasAsNeeded()) {
        composeType("asNeeded", element.getAsNeeded());
      }      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasRequester()) {
        composeProcedureRequestProcedureRequestRequesterComponent("requester", element.getRequester());
      }
      if (element.hasPerformerType()) {
        composeCodeableConcept("performerType", element.getPerformerType());
      }
      if (element.hasPerformer()) {
        composeReference("performer", element.getPerformer());
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasSupportingInfo()) { 
        for (Reference e : element.getSupportingInfo()) 
          composeReference("supportingInfo", e);
      }
      if (element.hasSpecimen()) { 
        for (Reference e : element.getSpecimen()) 
          composeReference("specimen", e);
      }
      if (element.hasBodySite()) { 
        for (CodeableConcept e : element.getBodySite()) 
          composeCodeableConcept("bodySite", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasRelevantHistory()) { 
        for (Reference e : element.getRelevantHistory()) 
          composeReference("relevantHistory", e);
      }
  }

  protected void composeProcedureRequestProcedureRequestRequesterComponent(String name, ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcedureRequestProcedureRequestRequesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcedureRequestProcedureRequestRequesterComponentElements(ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAgent()) {
        composeReference("agent", element.getAgent());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcessRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcessRequestElements(ProcessRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory());
      if (element.hasActionElement())
        composeEnumeration("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory());
      if (element.hasTarget()) {
        composeReference("target", element.getTarget());
      }
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasProvider()) {
        composeReference("provider", element.getProvider());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasResponse()) {
        composeReference("response", element.getResponse());
      }
      if (element.hasNullifyElement()) {
        composeBoolean("nullify", element.getNullifyElement());
      }
      if (element.hasReferenceElement()) {
        composeString("reference", element.getReferenceElement());
      }
      if (element.hasItem()) { 
        for (ProcessRequest.ItemsComponent e : element.getItem()) 
          composeProcessRequestItemsComponent("item", e);
      }
      if (element.hasInclude()) { 
        for (StringType e : element.getInclude()) 
          composeString("include", e);
      }
      if (element.hasExclude()) { 
        for (StringType e : element.getExclude()) 
          composeString("exclude", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcessRequestItemsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcessRequestItemsComponentElements(ProcessRequest.ItemsComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSequenceLinkIdElement()) {
        composeInteger("sequenceLinkId", element.getSequenceLinkIdElement());
      }
  }

  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcessResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcessResponseElements(ProcessResponse element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory());
      if (element.hasCreatedElement()) {
        composeDateTime("created", element.getCreatedElement());
      }
      if (element.hasOrganization()) {
        composeReference("organization", element.getOrganization());
      }
      if (element.hasRequest()) {
        composeReference("request", element.getRequest());
      }
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasDispositionElement()) {
        composeString("disposition", element.getDispositionElement());
      }
      if (element.hasRequestProvider()) {
        composeReference("requestProvider", element.getRequestProvider());
      }
      if (element.hasRequestOrganization()) {
        composeReference("requestOrganization", element.getRequestOrganization());
      }
      if (element.hasForm()) {
        composeCodeableConcept("form", element.getForm());
      }
      if (element.hasProcessNote()) { 
        for (ProcessResponse.ProcessResponseProcessNoteComponent e : element.getProcessNote()) 
          composeProcessResponseProcessResponseProcessNoteComponent("processNote", e);
      }
      if (element.hasError()) { 
        for (CodeableConcept e : element.getError()) 
          composeCodeableConcept("error", e);
      }
      if (element.hasCommunicationRequest()) { 
        for (Reference e : element.getCommunicationRequest()) 
          composeReference("communicationRequest", e);
      }
  }

  protected void composeProcessResponseProcessResponseProcessNoteComponent(String name, ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcessResponseProcessResponseProcessNoteComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcessResponseProcessResponseProcessNoteComponentElements(ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
  }

  protected void composeProvenance(String name, Provenance element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProvenanceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProvenanceElements(Provenance element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasTarget()) { 
        for (Reference e : element.getTarget()) 
          composeReference("target", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasRecordedElement()) {
        composeInstant("recorded", element.getRecordedElement());
      }
      if (element.hasPolicy()) { 
        for (UriType e : element.getPolicy()) 
          composeUri("policy", e);
      }
      if (element.hasLocation()) {
        composeReference("location", element.getLocation());
      }
      if (element.hasReason()) { 
        for (Coding e : element.getReason()) 
          composeCoding("reason", e);
      }
      if (element.hasActivity()) {
        composeCoding("activity", element.getActivity());
      }
      if (element.hasAgent()) { 
        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
          composeProvenanceProvenanceAgentComponent("agent", e);
      }
      if (element.hasEntity()) { 
        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
          composeProvenanceProvenanceEntityComponent("entity", e);
      }
      if (element.hasSignature()) { 
        for (Signature e : element.getSignature()) 
          composeSignature("signature", e);
      }
  }

  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProvenanceProvenanceAgentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProvenanceProvenanceAgentComponentElements(Provenance.ProvenanceAgentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRole()) { 
        for (CodeableConcept e : element.getRole()) 
          composeCodeableConcept("role", e);
      }
      if (element.hasWho()) {
        composeType("who", element.getWho());
      }      if (element.hasOnBehalfOf()) {
        composeType("onBehalfOf", element.getOnBehalfOf());
      }      if (element.hasRelatedAgentType()) {
        composeCodeableConcept("relatedAgentType", element.getRelatedAgentType());
      }
  }

  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProvenanceProvenanceEntityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProvenanceProvenanceEntityComponentElements(Provenance.ProvenanceEntityComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRoleElement())
        composeEnumeration("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory());
      if (element.hasWhat()) {
        composeType("what", element.getWhat());
      }      if (element.hasAgent()) { 
        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
          composeProvenanceProvenanceAgentComponent("agent", e);
      }
  }

  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireElements(Questionnaire element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasApprovalDateElement()) {
        composeDate("approvalDate", element.getApprovalDateElement());
      }
      if (element.hasLastReviewDateElement()) {
        composeDate("lastReviewDate", element.getLastReviewDateElement());
      }
      if (element.hasEffectivePeriod()) {
        composePeriod("effectivePeriod", element.getEffectivePeriod());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasCode()) { 
        for (Coding e : element.getCode()) 
          composeCoding("code", e);
      }
      if (element.hasSubjectType()) { 
        for (CodeType e : element.getSubjectType()) 
          composeCode("subjectType", e);
      }
      if (element.hasItem()) { 
        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
          composeQuestionnaireQuestionnaireItemComponent("item", e);
      }
  }

  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireQuestionnaireItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireQuestionnaireItemComponentElements(Questionnaire.QuestionnaireItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLinkIdElement()) {
        composeString("linkId", element.getLinkIdElement());
      }
      if (element.hasDefinitionElement()) {
        composeUri("definition", element.getDefinitionElement());
      }
      if (element.hasCode()) { 
        for (Coding e : element.getCode()) 
          composeCoding("code", e);
      }
      if (element.hasPrefixElement()) {
        composeString("prefix", element.getPrefixElement());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory());
      if (element.hasEnableWhen()) { 
        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
          composeQuestionnaireQuestionnaireItemEnableWhenComponent("enableWhen", e);
      }
      if (element.hasRequiredElement()) {
        composeBoolean("required", element.getRequiredElement());
      }
      if (element.hasRepeatsElement()) {
        composeBoolean("repeats", element.getRepeatsElement());
      }
      if (element.hasReadOnlyElement()) {
        composeBoolean("readOnly", element.getReadOnlyElement());
      }
      if (element.hasMaxLengthElement()) {
        composeInteger("maxLength", element.getMaxLengthElement());
      }
      if (element.hasOptions()) {
        composeReference("options", element.getOptions());
      }
      if (element.hasOption()) { 
        for (Questionnaire.QuestionnaireItemOptionComponent e : element.getOption()) 
          composeQuestionnaireQuestionnaireItemOptionComponent("option", e);
      }
      if (element.hasInitial()) {
        composeType("initial", element.getInitial());
      }      if (element.hasItem()) { 
        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
          composeQuestionnaireQuestionnaireItemComponent("item", e);
      }
  }

  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireQuestionnaireItemEnableWhenComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentElements(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasQuestionElement()) {
        composeString("question", element.getQuestionElement());
      }
      if (element.hasHasAnswerElement()) {
        composeBoolean("hasAnswer", element.getHasAnswerElement());
      }
      if (element.hasAnswer()) {
        composeType("answer", element.getAnswer());
      }  }

  protected void composeQuestionnaireQuestionnaireItemOptionComponent(String name, Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireQuestionnaireItemOptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireQuestionnaireItemOptionComponentElements(Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireResponseElements(QuestionnaireResponse element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasParent()) { 
        for (Reference e : element.getParent()) 
          composeReference("parent", e);
      }
      if (element.hasQuestionnaire()) {
        composeReference("questionnaire", element.getQuestionnaire());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory());
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasAuthoredElement()) {
        composeDateTime("authored", element.getAuthoredElement());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
      if (element.hasSource()) {
        composeReference("source", element.getSource());
      }
      if (element.hasItem()) { 
        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
          composeQuestionnaireResponseQuestionnaireResponseItemComponent("item", e);
      }
  }

  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireResponseQuestionnaireResponseItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentElements(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLinkIdElement()) {
        composeString("linkId", element.getLinkIdElement());
      }
      if (element.hasDefinitionElement()) {
        composeUri("definition", element.getDefinitionElement());
      }
      if (element.hasTextElement()) {
        composeString("text", element.getTextElement());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasAnswer()) { 
        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent("answer", e);
      }
      if (element.hasItem()) { 
        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
          composeQuestionnaireResponseQuestionnaireResponseItemComponent("item", e);
      }
  }

  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentElements(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }      if (element.hasItem()) { 
        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
          composeQuestionnaireResponseQuestionnaireResponseItemComponent("item", e);
      }
  }

  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeReferralRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeReferralRequestElements(ReferralRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasReplaces()) { 
        for (Reference e : element.getReplaces()) 
          composeReference("replaces", e);
      }
      if (element.hasGroupIdentifier()) {
        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ReferralRequest.ReferralRequestStatusEnumFactory());
      if (element.hasIntentElement())
        composeEnumeration("intent", element.getIntentElement(), new ReferralRequest.ReferralCategoryEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new ReferralRequest.ReferralPriorityEnumFactory());
      if (element.hasServiceRequested()) { 
        for (CodeableConcept e : element.getServiceRequested()) 
          composeCodeableConcept("serviceRequested", e);
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasRequester()) {
        composeReferralRequestReferralRequestRequesterComponent("requester", element.getRequester());
      }
      if (element.hasSpecialty()) {
        composeCodeableConcept("specialty", element.getSpecialty());
      }
      if (element.hasRecipient()) { 
        for (Reference e : element.getRecipient()) 
          composeReference("recipient", e);
      }
      if (element.hasReasonCode()) { 
        for (CodeableConcept e : element.getReasonCode()) 
          composeCodeableConcept("reasonCode", e);
      }
      if (element.hasReasonReference()) { 
        for (Reference e : element.getReasonReference()) 
          composeReference("reasonReference", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasSupportingInfo()) { 
        for (Reference e : element.getSupportingInfo()) 
          composeReference("supportingInfo", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasRelevantHistory()) { 
        for (Reference e : element.getRelevantHistory()) 
          composeReference("relevantHistory", e);
      }
  }

  protected void composeReferralRequestReferralRequestRequesterComponent(String name, ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeReferralRequestReferralRequestRequesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeReferralRequestReferralRequestRequesterComponentElements(ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAgent()) {
        composeReference("agent", element.getAgent());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRelatedPersonElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRelatedPersonElements(RelatedPerson element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasRelationship()) {
        composeCodeableConcept("relationship", element.getRelationship());
      }
      if (element.hasName()) { 
        for (HumanName e : element.getName()) 
          composeHumanName("name", e);
      }
      if (element.hasTelecom()) { 
        for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
      }
      if (element.hasGenderElement())
        composeEnumeration("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory());
      if (element.hasBirthDateElement()) {
        composeDate("birthDate", element.getBirthDateElement());
      }
      if (element.hasAddress()) { 
        for (Address e : element.getAddress()) 
          composeAddress("address", e);
      }
      if (element.hasPhoto()) { 
        for (Attachment e : element.getPhoto()) 
          composeAttachment("photo", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
  }

  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRequestGroupElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRequestGroupElements(RequestGroup element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) { 
        for (Reference e : element.getDefinition()) 
          composeReference("definition", e);
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasReplaces()) { 
        for (Reference e : element.getReplaces()) 
          composeReference("replaces", e);
      }
      if (element.hasGroupIdentifier()) {
        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory());
      if (element.hasIntentElement())
        composeEnumeration("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory());
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory());
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasAuthor()) {
        composeReference("author", element.getAuthor());
      }
      if (element.hasReason()) {
        composeType("reason", element.getReason());
      }      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasAction()) { 
        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
          composeRequestGroupRequestGroupActionComponent("action", e);
      }
  }

  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRequestGroupRequestGroupActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRequestGroupRequestGroupActionComponentElements(RequestGroup.RequestGroupActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLabelElement()) {
        composeString("label", element.getLabelElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasTextEquivalentElement()) {
        composeString("textEquivalent", element.getTextEquivalentElement());
      }
      if (element.hasCode()) { 
        for (CodeableConcept e : element.getCode()) 
          composeCodeableConcept("code", e);
      }
      if (element.hasDocumentation()) { 
        for (RelatedArtifact e : element.getDocumentation()) 
          composeRelatedArtifact("documentation", e);
      }
      if (element.hasCondition()) { 
        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
          composeRequestGroupRequestGroupActionConditionComponent("condition", e);
      }
      if (element.hasRelatedAction()) { 
        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
          composeRequestGroupRequestGroupActionRelatedActionComponent("relatedAction", e);
      }
      if (element.hasTiming()) {
        composeType("timing", element.getTiming());
      }      if (element.hasParticipant()) { 
        for (Reference e : element.getParticipant()) 
          composeReference("participant", e);
      }
      if (element.hasType()) {
        composeCoding("type", element.getType());
      }
      if (element.hasGroupingBehaviorElement())
        composeEnumeration("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory());
      if (element.hasSelectionBehaviorElement())
        composeEnumeration("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory());
      if (element.hasRequiredBehaviorElement())
        composeEnumeration("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory());
      if (element.hasPrecheckBehaviorElement())
        composeEnumeration("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory());
      if (element.hasCardinalityBehaviorElement())
        composeEnumeration("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory());
      if (element.hasResource()) {
        composeReference("resource", element.getResource());
      }
      if (element.hasAction()) { 
        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
          composeRequestGroupRequestGroupActionComponent("action", e);
      }
  }

  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRequestGroupRequestGroupActionConditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRequestGroupRequestGroupActionConditionComponentElements(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory());
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasLanguageElement()) {
        composeString("language", element.getLanguageElement());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
  }

  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRequestGroupRequestGroupActionRelatedActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRequestGroupRequestGroupActionRelatedActionComponentElements(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasActionIdElement()) {
        composeId("actionId", element.getActionIdElement());
      }
      if (element.hasRelationshipElement())
        composeEnumeration("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory());
      if (element.hasOffset()) {
        composeType("offset", element.getOffset());
      }  }

  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchStudyElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchStudyElements(ResearchStudy element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasProtocol()) { 
        for (Reference e : element.getProtocol()) 
          composeReference("protocol", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasFocus()) { 
        for (CodeableConcept e : element.getFocus()) 
          composeCodeableConcept("focus", e);
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasRelatedArtifact()) { 
        for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
      }
      if (element.hasKeyword()) { 
        for (CodeableConcept e : element.getKeyword()) 
          composeCodeableConcept("keyword", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasEnrollment()) { 
        for (Reference e : element.getEnrollment()) 
          composeReference("enrollment", e);
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasSponsor()) {
        composeReference("sponsor", element.getSponsor());
      }
      if (element.hasPrincipalInvestigator()) {
        composeReference("principalInvestigator", element.getPrincipalInvestigator());
      }
      if (element.hasSite()) { 
        for (Reference e : element.getSite()) 
          composeReference("site", e);
      }
      if (element.hasReasonStopped()) {
        composeCodeableConcept("reasonStopped", element.getReasonStopped());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasArm()) { 
        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
          composeResearchStudyResearchStudyArmComponent("arm", e);
      }
  }

  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchStudyResearchStudyArmComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchStudyResearchStudyArmComponentElements(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
  }

  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchSubjectElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchSubjectElements(ResearchSubject element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory());
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasStudy()) {
        composeReference("study", element.getStudy());
      }
      if (element.hasIndividual()) {
        composeReference("individual", element.getIndividual());
      }
      if (element.hasAssignedArmElement()) {
        composeString("assignedArm", element.getAssignedArmElement());
      }
      if (element.hasActualArmElement()) {
        composeString("actualArm", element.getActualArmElement());
      }
      if (element.hasConsent()) {
        composeReference("consent", element.getConsent());
      }
  }

  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskAssessmentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskAssessmentElements(RiskAssessment element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasBasedOn()) {
        composeReference("basedOn", element.getBasedOn());
      }
      if (element.hasParent()) {
        composeReference("parent", element.getParent());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory());
      if (element.hasMethod()) {
        composeCodeableConcept("method", element.getMethod());
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasCondition()) {
        composeReference("condition", element.getCondition());
      }
      if (element.hasPerformer()) {
        composeReference("performer", element.getPerformer());
      }
      if (element.hasReason()) {
        composeType("reason", element.getReason());
      }      if (element.hasBasis()) { 
        for (Reference e : element.getBasis()) 
          composeReference("basis", e);
      }
      if (element.hasPrediction()) { 
        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
          composeRiskAssessmentRiskAssessmentPredictionComponent("prediction", e);
      }
      if (element.hasMitigationElement()) {
        composeString("mitigation", element.getMitigationElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskAssessmentRiskAssessmentPredictionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskAssessmentRiskAssessmentPredictionComponentElements(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOutcome()) {
        composeCodeableConcept("outcome", element.getOutcome());
      }
      if (element.hasProbability()) {
        composeType("probability", element.getProbability());
      }      if (element.hasQualitativeRisk()) {
        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
      }
      if (element.hasRelativeRiskElement()) {
        composeDecimal("relativeRisk", element.getRelativeRiskElement());
      }
      if (element.hasWhen()) {
        composeType("when", element.getWhen());
      }      if (element.hasRationaleElement()) {
        composeString("rationale", element.getRationaleElement());
      }
  }

  protected void composeSchedule(String name, Schedule element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeScheduleElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeScheduleElements(Schedule element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasActiveElement()) {
        composeBoolean("active", element.getActiveElement());
      }
      if (element.hasServiceCategory()) {
        composeCodeableConcept("serviceCategory", element.getServiceCategory());
      }
      if (element.hasServiceType()) { 
        for (CodeableConcept e : element.getServiceType()) 
          composeCodeableConcept("serviceType", e);
      }
      if (element.hasSpecialty()) { 
        for (CodeableConcept e : element.getSpecialty()) 
          composeCodeableConcept("specialty", e);
      }
      if (element.hasActor()) { 
        for (Reference e : element.getActor()) 
          composeReference("actor", e);
      }
      if (element.hasPlanningHorizon()) {
        composePeriod("planningHorizon", element.getPlanningHorizon());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSearchParameterElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSearchParameterElements(SearchParameter element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasBase()) { 
        for (CodeType e : element.getBase()) 
          composeCode("base", e);
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory());
      if (element.hasDerivedFromElement()) {
        composeUri("derivedFrom", element.getDerivedFromElement());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
      if (element.hasXpathElement()) {
        composeString("xpath", element.getXpathElement());
      }
      if (element.hasXpathUsageElement())
        composeEnumeration("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory());
      if (element.hasTarget()) { 
        for (CodeType e : element.getTarget()) 
          composeCode("target", e);
      }
        if (element.hasComparator()) 
          for (Enumeration e : element.getComparator()) 
            composeEnumeration("comparator", e, new SearchParameter.SearchComparatorEnumFactory());
        if (element.hasModifier()) 
          for (Enumeration e : element.getModifier()) 
            composeEnumeration("modifier", e, new SearchParameter.SearchModifierCodeEnumFactory());
      if (element.hasChain()) { 
        for (StringType e : element.getChain()) 
          composeString("chain", e);
      }
      if (element.hasComponent()) { 
        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
          composeSearchParameterSearchParameterComponentComponent("component", e);
      }
  }

  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSearchParameterSearchParameterComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSearchParameterSearchParameterComponentComponentElements(SearchParameter.SearchParameterComponentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDefinition()) {
        composeReference("definition", element.getDefinition());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
  }

  protected void composeSequence(String name, Sequence element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSequenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSequenceElements(Sequence element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory());
      if (element.hasCoordinateSystemElement()) {
        composeInteger("coordinateSystem", element.getCoordinateSystemElement());
      }
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasSpecimen()) {
        composeReference("specimen", element.getSpecimen());
      }
      if (element.hasDevice()) {
        composeReference("device", element.getDevice());
      }
      if (element.hasPerformer()) {
        composeReference("performer", element.getPerformer());
      }
      if (element.hasQuantity()) {
        composeQuantity("quantity", element.getQuantity());
      }
      if (element.hasReferenceSeq()) {
        composeSequenceSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
      }
      if (element.hasVariant()) { 
        for (Sequence.SequenceVariantComponent e : element.getVariant()) 
          composeSequenceSequenceVariantComponent("variant", e);
      }
      if (element.hasObservedSeqElement()) {
        composeString("observedSeq", element.getObservedSeqElement());
      }
      if (element.hasQuality()) { 
        for (Sequence.SequenceQualityComponent e : element.getQuality()) 
          composeSequenceSequenceQualityComponent("quality", e);
      }
      if (element.hasReadCoverageElement()) {
        composeInteger("readCoverage", element.getReadCoverageElement());
      }
      if (element.hasRepository()) { 
        for (Sequence.SequenceRepositoryComponent e : element.getRepository()) 
          composeSequenceSequenceRepositoryComponent("repository", e);
      }
      if (element.hasPointer()) { 
        for (Reference e : element.getPointer()) 
          composeReference("pointer", e);
      }
  }

  protected void composeSequenceSequenceReferenceSeqComponent(String name, Sequence.SequenceReferenceSeqComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSequenceSequenceReferenceSeqComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSequenceSequenceReferenceSeqComponentElements(Sequence.SequenceReferenceSeqComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasChromosome()) {
        composeCodeableConcept("chromosome", element.getChromosome());
      }
      if (element.hasGenomeBuildElement()) {
        composeString("genomeBuild", element.getGenomeBuildElement());
      }
      if (element.hasReferenceSeqId()) {
        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
      }
      if (element.hasReferenceSeqPointer()) {
        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
      }
      if (element.hasReferenceSeqStringElement()) {
        composeString("referenceSeqString", element.getReferenceSeqStringElement());
      }
      if (element.hasStrandElement()) {
        composeInteger("strand", element.getStrandElement());
      }
      if (element.hasWindowStartElement()) {
        composeInteger("windowStart", element.getWindowStartElement());
      }
      if (element.hasWindowEndElement()) {
        composeInteger("windowEnd", element.getWindowEndElement());
      }
  }

  protected void composeSequenceSequenceVariantComponent(String name, Sequence.SequenceVariantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSequenceSequenceVariantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSequenceSequenceVariantComponentElements(Sequence.SequenceVariantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasStartElement()) {
        composeInteger("start", element.getStartElement());
      }
      if (element.hasEndElement()) {
        composeInteger("end", element.getEndElement());
      }
      if (element.hasObservedAlleleElement()) {
        composeString("observedAllele", element.getObservedAlleleElement());
      }
      if (element.hasReferenceAlleleElement()) {
        composeString("referenceAllele", element.getReferenceAlleleElement());
      }
      if (element.hasCigarElement()) {
        composeString("cigar", element.getCigarElement());
      }
      if (element.hasVariantPointer()) {
        composeReference("variantPointer", element.getVariantPointer());
      }
  }

  protected void composeSequenceSequenceQualityComponent(String name, Sequence.SequenceQualityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSequenceSequenceQualityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSequenceSequenceQualityComponentElements(Sequence.SequenceQualityComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory());
      if (element.hasStandardSequence()) {
        composeCodeableConcept("standardSequence", element.getStandardSequence());
      }
      if (element.hasStartElement()) {
        composeInteger("start", element.getStartElement());
      }
      if (element.hasEndElement()) {
        composeInteger("end", element.getEndElement());
      }
      if (element.hasScore()) {
        composeQuantity("score", element.getScore());
      }
      if (element.hasMethod()) {
        composeCodeableConcept("method", element.getMethod());
      }
      if (element.hasTruthTPElement()) {
        composeDecimal("truthTP", element.getTruthTPElement());
      }
      if (element.hasQueryTPElement()) {
        composeDecimal("queryTP", element.getQueryTPElement());
      }
      if (element.hasTruthFNElement()) {
        composeDecimal("truthFN", element.getTruthFNElement());
      }
      if (element.hasQueryFPElement()) {
        composeDecimal("queryFP", element.getQueryFPElement());
      }
      if (element.hasGtFPElement()) {
        composeDecimal("gtFP", element.getGtFPElement());
      }
      if (element.hasPrecisionElement()) {
        composeDecimal("precision", element.getPrecisionElement());
      }
      if (element.hasRecallElement()) {
        composeDecimal("recall", element.getRecallElement());
      }
      if (element.hasFScoreElement()) {
        composeDecimal("fScore", element.getFScoreElement());
      }
  }

  protected void composeSequenceSequenceRepositoryComponent(String name, Sequence.SequenceRepositoryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSequenceSequenceRepositoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSequenceSequenceRepositoryComponentElements(Sequence.SequenceRepositoryComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory());
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDatasetIdElement()) {
        composeString("datasetId", element.getDatasetIdElement());
      }
      if (element.hasVariantsetIdElement()) {
        composeString("variantsetId", element.getVariantsetIdElement());
      }
      if (element.hasReadsetIdElement()) {
        composeString("readsetId", element.getReadsetIdElement());
      }
  }

  protected void composeServiceDefinition(String name, ServiceDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeServiceDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeServiceDefinitionElements(ServiceDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasUsageElement()) {
        composeString("usage", element.getUsageElement());
      }
      if (element.hasApprovalDateElement()) {
        composeDate("approvalDate", element.getApprovalDateElement());
      }
      if (element.hasLastReviewDateElement()) {
        composeDate("lastReviewDate", element.getLastReviewDateElement());
      }
      if (element.hasEffectivePeriod()) {
        composePeriod("effectivePeriod", element.getEffectivePeriod());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasTopic()) { 
        for (CodeableConcept e : element.getTopic()) 
          composeCodeableConcept("topic", e);
      }
      if (element.hasContributor()) { 
        for (Contributor e : element.getContributor()) 
          composeContributor("contributor", e);
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasRelatedArtifact()) { 
        for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
      }
      if (element.hasTrigger()) { 
        for (TriggerDefinition e : element.getTrigger()) 
          composeTriggerDefinition("trigger", e);
      }
      if (element.hasDataRequirement()) { 
        for (DataRequirement e : element.getDataRequirement()) 
          composeDataRequirement("dataRequirement", e);
      }
      if (element.hasOperationDefinition()) {
        composeReference("operationDefinition", element.getOperationDefinition());
      }
  }

  protected void composeSlot(String name, Slot element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSlotElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSlotElements(Slot element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasServiceCategory()) {
        composeCodeableConcept("serviceCategory", element.getServiceCategory());
      }
      if (element.hasServiceType()) { 
        for (CodeableConcept e : element.getServiceType()) 
          composeCodeableConcept("serviceType", e);
      }
      if (element.hasSpecialty()) { 
        for (CodeableConcept e : element.getSpecialty()) 
          composeCodeableConcept("specialty", e);
      }
      if (element.hasAppointmentType()) {
        composeCodeableConcept("appointmentType", element.getAppointmentType());
      }
      if (element.hasSchedule()) {
        composeReference("schedule", element.getSchedule());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory());
      if (element.hasStartElement()) {
        composeInstant("start", element.getStartElement());
      }
      if (element.hasEndElement()) {
        composeInstant("end", element.getEndElement());
      }
      if (element.hasOverbookedElement()) {
        composeBoolean("overbooked", element.getOverbookedElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeSpecimen(String name, Specimen element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenElements(Specimen element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasAccessionIdentifier()) {
        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory());
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSubject()) {
        composeReference("subject", element.getSubject());
      }
      if (element.hasReceivedTimeElement()) {
        composeDateTime("receivedTime", element.getReceivedTimeElement());
      }
      if (element.hasParent()) { 
        for (Reference e : element.getParent()) 
          composeReference("parent", e);
      }
      if (element.hasRequest()) { 
        for (Reference e : element.getRequest()) 
          composeReference("request", e);
      }
      if (element.hasCollection()) {
        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
      }
      if (element.hasProcessing()) { 
        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
          composeSpecimenSpecimenProcessingComponent("processing", e);
      }
      if (element.hasContainer()) { 
        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
          composeSpecimenSpecimenContainerComponent("container", e);
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenSpecimenCollectionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenSpecimenCollectionComponentElements(Specimen.SpecimenCollectionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCollector()) {
        composeReference("collector", element.getCollector());
      }
      if (element.hasCollected()) {
        composeType("collected", element.getCollected());
      }      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasMethod()) {
        composeCodeableConcept("method", element.getMethod());
      }
      if (element.hasBodySite()) {
        composeCodeableConcept("bodySite", element.getBodySite());
      }
  }

  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenSpecimenProcessingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenSpecimenProcessingComponentElements(Specimen.SpecimenProcessingComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasProcedure()) {
        composeCodeableConcept("procedure", element.getProcedure());
      }
      if (element.hasAdditive()) { 
        for (Reference e : element.getAdditive()) 
          composeReference("additive", e);
      }
      if (element.hasTime()) {
        composeType("time", element.getTime());
      }  }

  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenSpecimenContainerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenSpecimenContainerComponentElements(Specimen.SpecimenContainerComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasCapacity()) {
        composeSimpleQuantity("capacity", element.getCapacity());
      }
      if (element.hasSpecimenQuantity()) {
        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
      }
      if (element.hasAdditive()) {
        composeType("additive", element.getAdditive());
      }  }

  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionElements(StructureDefinition element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasKeyword()) { 
        for (Coding e : element.getKeyword()) 
          composeCoding("keyword", e);
      }
      if (element.hasFhirVersionElement()) {
        composeId("fhirVersion", element.getFhirVersionElement());
      }
      if (element.hasMapping()) { 
        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
          composeStructureDefinitionStructureDefinitionMappingComponent("mapping", e);
      }
      if (element.hasKindElement())
        composeEnumeration("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory());
      if (element.hasAbstractElement()) {
        composeBoolean("abstract", element.getAbstractElement());
      }
      if (element.hasContextTypeElement())
        composeEnumeration("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory());
      if (element.hasContext()) { 
        for (StringType e : element.getContext()) 
          composeString("context", e);
      }
      if (element.hasContextInvariant()) { 
        for (StringType e : element.getContextInvariant()) 
          composeString("contextInvariant", e);
      }
      if (element.hasTypeElement()) {
        composeCode("type", element.getTypeElement());
      }
      if (element.hasBaseDefinitionElement()) {
        composeUri("baseDefinition", element.getBaseDefinitionElement());
      }
      if (element.hasDerivationElement())
        composeEnumeration("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory());
      if (element.hasSnapshot()) {
        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
      }
      if (element.hasDifferential()) {
        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
      }
  }

  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionStructureDefinitionMappingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionStructureDefinitionMappingComponentElements(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentityElement()) {
        composeId("identity", element.getIdentityElement());
      }
      if (element.hasUriElement()) {
        composeUri("uri", element.getUriElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasCommentElement()) {
        composeString("comment", element.getCommentElement());
      }
  }

  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionStructureDefinitionSnapshotComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentElements(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasElement()) { 
        for (ElementDefinition e : element.getElement()) 
          composeElementDefinition("element", e);
      }
  }

  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionStructureDefinitionDifferentialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentElements(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasElement()) { 
        for (ElementDefinition e : element.getElement()) 
          composeElementDefinition("element", e);
      }
  }

  protected void composeStructureMap(String name, StructureMap element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapElements(StructureMap element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasStructure()) { 
        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
          composeStructureMapStructureMapStructureComponent("structure", e);
      }
      if (element.hasImport()) { 
        for (UriType e : element.getImport()) 
          composeUri("import", e);
      }
      if (element.hasGroup()) { 
        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
          composeStructureMapStructureMapGroupComponent("group", e);
      }
  }

  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapStructureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapStructureComponentElements(StructureMap.StructureMapStructureComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory());
      if (element.hasAliasElement()) {
        composeString("alias", element.getAliasElement());
      }
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapGroupComponentElements(StructureMap.StructureMapGroupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeId("name", element.getNameElement());
      }
      if (element.hasExtendsElement()) {
        composeId("extends", element.getExtendsElement());
      }
      if (element.hasTypeModeElement())
        composeEnumeration("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory());
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
      if (element.hasInput()) { 
        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
          composeStructureMapStructureMapGroupInputComponent("input", e);
      }
      if (element.hasRule()) { 
        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
          composeStructureMapStructureMapGroupRuleComponent("rule", e);
      }
  }

  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapGroupInputComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapGroupInputComponentElements(StructureMap.StructureMapGroupInputComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeId("name", element.getNameElement());
      }
      if (element.hasTypeElement()) {
        composeString("type", element.getTypeElement());
      }
      if (element.hasModeElement())
        composeEnumeration("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory());
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapGroupRuleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapGroupRuleComponentElements(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeId("name", element.getNameElement());
      }
      if (element.hasSource()) { 
        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
          composeStructureMapStructureMapGroupRuleSourceComponent("source", e);
      }
      if (element.hasTarget()) { 
        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
          composeStructureMapStructureMapGroupRuleTargetComponent("target", e);
      }
      if (element.hasRule()) { 
        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
          composeStructureMapStructureMapGroupRuleComponent("rule", e);
      }
      if (element.hasDependent()) { 
        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
          composeStructureMapStructureMapGroupRuleDependentComponent("dependent", e);
      }
      if (element.hasDocumentationElement()) {
        composeString("documentation", element.getDocumentationElement());
      }
  }

  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapGroupRuleSourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapGroupRuleSourceComponentElements(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContextElement()) {
        composeId("context", element.getContextElement());
      }
      if (element.hasMinElement()) {
        composeInteger("min", element.getMinElement());
      }
      if (element.hasMaxElement()) {
        composeString("max", element.getMaxElement());
      }
      if (element.hasTypeElement()) {
        composeString("type", element.getTypeElement());
      }
      if (element.hasDefaultValue()) {
        composeType("defaultValue", element.getDefaultValue());
      }      if (element.hasElementElement()) {
        composeString("element", element.getElementElement());
      }
      if (element.hasListModeElement())
        composeEnumeration("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory());
      if (element.hasVariableElement()) {
        composeId("variable", element.getVariableElement());
      }
      if (element.hasConditionElement()) {
        composeString("condition", element.getConditionElement());
      }
      if (element.hasCheckElement()) {
        composeString("check", element.getCheckElement());
      }
  }

  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapGroupRuleTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapGroupRuleTargetComponentElements(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasContextElement()) {
        composeId("context", element.getContextElement());
      }
      if (element.hasContextTypeElement())
        composeEnumeration("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory());
      if (element.hasElementElement()) {
        composeString("element", element.getElementElement());
      }
      if (element.hasVariableElement()) {
        composeId("variable", element.getVariableElement());
      }
        if (element.hasListMode()) 
          for (Enumeration e : element.getListMode()) 
            composeEnumeration("listMode", e, new StructureMap.StructureMapTargetListModeEnumFactory());
      if (element.hasListRuleIdElement()) {
        composeId("listRuleId", element.getListRuleIdElement());
      }
      if (element.hasTransformElement())
        composeEnumeration("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory());
      if (element.hasParameter()) { 
        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
          composeStructureMapStructureMapGroupRuleTargetParameterComponent("parameter", e);
      }
  }

  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapGroupRuleTargetParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentElements(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureMapGroupRuleDependentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureMapGroupRuleDependentComponentElements(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeId("name", element.getNameElement());
      }
      if (element.hasVariable()) { 
        for (StringType e : element.getVariable()) 
          composeString("variable", e);
      }
  }

  protected void composeSubscription(String name, Subscription element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionElements(Subscription element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory());
      if (element.hasContact()) { 
        for (ContactPoint e : element.getContact()) 
          composeContactPoint("contact", e);
      }
      if (element.hasEndElement()) {
        composeInstant("end", element.getEndElement());
      }
      if (element.hasReasonElement()) {
        composeString("reason", element.getReasonElement());
      }
      if (element.hasCriteriaElement()) {
        composeString("criteria", element.getCriteriaElement());
      }
      if (element.hasErrorElement()) {
        composeString("error", element.getErrorElement());
      }
      if (element.hasChannel()) {
        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
      }
      if (element.hasTag()) { 
        for (Coding e : element.getTag()) 
          composeCoding("tag", e);
      }
  }

  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionSubscriptionChannelComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionSubscriptionChannelComponentElements(Subscription.SubscriptionChannelComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory());
      if (element.hasEndpointElement()) {
        composeUri("endpoint", element.getEndpointElement());
      }
      if (element.hasPayloadElement()) {
        composeString("payload", element.getPayloadElement());
      }
      if (element.hasHeader()) { 
        for (StringType e : element.getHeader()) 
          composeString("header", e);
      }
  }

  protected void composeSubstance(String name, Substance element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceElements(Substance element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory());
      if (element.hasCategory()) { 
        for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
      }
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasInstance()) { 
        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
          composeSubstanceSubstanceInstanceComponent("instance", e);
      }
      if (element.hasIngredient()) { 
        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
          composeSubstanceSubstanceIngredientComponent("ingredient", e);
      }
  }

  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSubstanceInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSubstanceInstanceComponentElements(Substance.SubstanceInstanceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasExpiryElement()) {
        composeDateTime("expiry", element.getExpiryElement());
      }
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
  }

  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSubstanceIngredientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSubstanceIngredientComponentElements(Substance.SubstanceIngredientComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasQuantity()) {
        composeRatio("quantity", element.getQuantity());
      }
      if (element.hasSubstance()) {
        composeType("substance", element.getSubstance());
      }  }

  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyDeliveryElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyDeliveryElements(SupplyDelivery element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory());
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasSuppliedItem()) {
        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasSupplier()) {
        composeReference("supplier", element.getSupplier());
      }
      if (element.hasDestination()) {
        composeReference("destination", element.getDestination());
      }
      if (element.hasReceiver()) { 
        for (Reference e : element.getReceiver()) 
          composeReference("receiver", e);
      }
  }

  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyDeliverySupplyDeliverySuppliedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentElements(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasQuantity()) {
        composeSimpleQuantity("quantity", element.getQuantity());
      }
      if (element.hasItem()) {
        composeType("item", element.getItem());
      }  }

  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyRequestElements(SupplyRequest element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory());
      if (element.hasCategory()) {
        composeCodeableConcept("category", element.getCategory());
      }
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory());
      if (element.hasOrderedItem()) {
        composeSupplyRequestSupplyRequestOrderedItemComponent("orderedItem", element.getOrderedItem());
      }
      if (element.hasOccurrence()) {
        composeType("occurrence", element.getOccurrence());
      }      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasRequester()) {
        composeSupplyRequestSupplyRequestRequesterComponent("requester", element.getRequester());
      }
      if (element.hasSupplier()) { 
        for (Reference e : element.getSupplier()) 
          composeReference("supplier", e);
      }
      if (element.hasReason()) {
        composeType("reason", element.getReason());
      }      if (element.hasDeliverFrom()) {
        composeReference("deliverFrom", element.getDeliverFrom());
      }
      if (element.hasDeliverTo()) {
        composeReference("deliverTo", element.getDeliverTo());
      }
  }

  protected void composeSupplyRequestSupplyRequestOrderedItemComponent(String name, SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyRequestSupplyRequestOrderedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyRequestSupplyRequestOrderedItemComponentElements(SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasQuantity()) {
        composeQuantity("quantity", element.getQuantity());
      }
      if (element.hasItem()) {
        composeType("item", element.getItem());
      }  }

  protected void composeSupplyRequestSupplyRequestRequesterComponent(String name, SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyRequestSupplyRequestRequesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyRequestSupplyRequestRequesterComponentElements(SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAgent()) {
        composeReference("agent", element.getAgent());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeTask(String name, Task element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTaskElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTaskElements(Task element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasDefinition()) {
        composeType("definition", element.getDefinition());
      }      if (element.hasBasedOn()) { 
        for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
      }
      if (element.hasGroupIdentifier()) {
        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
      }
      if (element.hasPartOf()) { 
        for (Reference e : element.getPartOf()) 
          composeReference("partOf", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Task.TaskStatusEnumFactory());
      if (element.hasStatusReason()) {
        composeCodeableConcept("statusReason", element.getStatusReason());
      }
      if (element.hasBusinessStatus()) {
        composeCodeableConcept("businessStatus", element.getBusinessStatus());
      }
      if (element.hasIntentElement())
        composeEnumeration("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory());
      if (element.hasPriorityElement())
        composeEnumeration("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory());
      if (element.hasCode()) {
        composeCodeableConcept("code", element.getCode());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasFocus()) {
        composeReference("focus", element.getFocus());
      }
      if (element.hasFor()) {
        composeReference("for", element.getFor());
      }
      if (element.hasContext()) {
        composeReference("context", element.getContext());
      }
      if (element.hasExecutionPeriod()) {
        composePeriod("executionPeriod", element.getExecutionPeriod());
      }
      if (element.hasAuthoredOnElement()) {
        composeDateTime("authoredOn", element.getAuthoredOnElement());
      }
      if (element.hasLastModifiedElement()) {
        composeDateTime("lastModified", element.getLastModifiedElement());
      }
      if (element.hasRequester()) {
        composeTaskTaskRequesterComponent("requester", element.getRequester());
      }
      if (element.hasPerformerType()) { 
        for (CodeableConcept e : element.getPerformerType()) 
          composeCodeableConcept("performerType", e);
      }
      if (element.hasOwner()) {
        composeReference("owner", element.getOwner());
      }
      if (element.hasReason()) {
        composeCodeableConcept("reason", element.getReason());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
      if (element.hasRelevantHistory()) { 
        for (Reference e : element.getRelevantHistory()) 
          composeReference("relevantHistory", e);
      }
      if (element.hasRestriction()) {
        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
      }
      if (element.hasInput()) { 
        for (Task.ParameterComponent e : element.getInput()) 
          composeTaskParameterComponent("input", e);
      }
      if (element.hasOutput()) { 
        for (Task.TaskOutputComponent e : element.getOutput()) 
          composeTaskTaskOutputComponent("output", e);
      }
  }

  protected void composeTaskTaskRequesterComponent(String name, Task.TaskRequesterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTaskTaskRequesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTaskTaskRequesterComponentElements(Task.TaskRequesterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAgent()) {
        composeReference("agent", element.getAgent());
      }
      if (element.hasOnBehalfOf()) {
        composeReference("onBehalfOf", element.getOnBehalfOf());
      }
  }

  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTaskTaskRestrictionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTaskTaskRestrictionComponentElements(Task.TaskRestrictionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRepetitionsElement()) {
        composePositiveInt("repetitions", element.getRepetitionsElement());
      }
      if (element.hasPeriod()) {
        composePeriod("period", element.getPeriod());
      }
      if (element.hasRecipient()) { 
        for (Reference e : element.getRecipient()) 
          composeReference("recipient", e);
      }
  }

  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTaskParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTaskParameterComponentElements(Task.ParameterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTaskTaskOutputComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTaskTaskOutputComponentElements(Task.TaskOutputComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCodeableConcept("type", element.getType());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeTestReport(String name, TestReport element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportElements(TestReport element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory());
      if (element.hasTestScript()) {
        composeReference("testScript", element.getTestScript());
      }
      if (element.hasResultElement())
        composeEnumeration("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory());
      if (element.hasScoreElement()) {
        composeDecimal("score", element.getScoreElement());
      }
      if (element.hasTesterElement()) {
        composeString("tester", element.getTesterElement());
      }
      if (element.hasIssuedElement()) {
        composeDateTime("issued", element.getIssuedElement());
      }
      if (element.hasParticipant()) { 
        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
          composeTestReportTestReportParticipantComponent("participant", e);
      }
      if (element.hasSetup()) {
        composeTestReportTestReportSetupComponent("setup", element.getSetup());
      }
      if (element.hasTest()) { 
        for (TestReport.TestReportTestComponent e : element.getTest()) 
          composeTestReportTestReportTestComponent("test", e);
      }
      if (element.hasTeardown()) {
        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
      }
  }

  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTestReportParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTestReportParticipantComponentElements(TestReport.TestReportParticipantComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasTypeElement())
        composeEnumeration("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory());
      if (element.hasUriElement()) {
        composeUri("uri", element.getUriElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
  }

  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTestReportSetupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTestReportSetupComponentElements(TestReport.TestReportSetupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAction()) { 
        for (TestReport.SetupActionComponent e : element.getAction()) 
          composeTestReportSetupActionComponent("action", e);
      }
  }

  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportSetupActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportSetupActionComponentElements(TestReport.SetupActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOperation()) {
        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
      }
      if (element.hasAssert()) {
        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
      }
  }

  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportSetupActionOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportSetupActionOperationComponentElements(TestReport.SetupActionOperationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasResultElement())
        composeEnumeration("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory());
      if (element.hasMessageElement()) {
        composeMarkdown("message", element.getMessageElement());
      }
      if (element.hasDetailElement()) {
        composeUri("detail", element.getDetailElement());
      }
  }

  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportSetupActionAssertComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportSetupActionAssertComponentElements(TestReport.SetupActionAssertComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasResultElement())
        composeEnumeration("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory());
      if (element.hasMessageElement()) {
        composeMarkdown("message", element.getMessageElement());
      }
      if (element.hasDetailElement()) {
        composeString("detail", element.getDetailElement());
      }
  }

  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTestReportTestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTestReportTestComponentElements(TestReport.TestReportTestComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasAction()) { 
        for (TestReport.TestActionComponent e : element.getAction()) 
          composeTestReportTestActionComponent("action", e);
      }
  }

  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTestActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTestActionComponentElements(TestReport.TestActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOperation()) {
        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
      }
      if (element.hasAssert()) {
        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
      }
  }

  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTestReportTeardownComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTestReportTeardownComponentElements(TestReport.TestReportTeardownComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAction()) { 
        for (TestReport.TeardownActionComponent e : element.getAction()) 
          composeTestReportTeardownActionComponent("action", e);
      }
  }

  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTeardownActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTeardownActionComponentElements(TestReport.TeardownActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOperation()) {
        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
      }
  }

  protected void composeTestScript(String name, TestScript element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptElements(TestScript element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) {
        composeIdentifier("identifier", element.getIdentifier());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasOrigin()) { 
        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
          composeTestScriptTestScriptOriginComponent("origin", e);
      }
      if (element.hasDestination()) { 
        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
          composeTestScriptTestScriptDestinationComponent("destination", e);
      }
      if (element.hasMetadata()) {
        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
      }
      if (element.hasFixture()) { 
        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
          composeTestScriptTestScriptFixtureComponent("fixture", e);
      }
      if (element.hasProfile()) { 
        for (Reference e : element.getProfile()) 
          composeReference("profile", e);
      }
      if (element.hasVariable()) { 
        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
          composeTestScriptTestScriptVariableComponent("variable", e);
      }
      if (element.hasRule()) { 
        for (TestScript.TestScriptRuleComponent e : element.getRule()) 
          composeTestScriptTestScriptRuleComponent("rule", e);
      }
      if (element.hasRuleset()) { 
        for (TestScript.TestScriptRulesetComponent e : element.getRuleset()) 
          composeTestScriptTestScriptRulesetComponent("ruleset", e);
      }
      if (element.hasSetup()) {
        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
      }
      if (element.hasTest()) { 
        for (TestScript.TestScriptTestComponent e : element.getTest()) 
          composeTestScriptTestScriptTestComponent("test", e);
      }
      if (element.hasTeardown()) {
        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
      }
  }

  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptOriginComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptOriginComponentElements(TestScript.TestScriptOriginComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIndexElement()) {
        composeInteger("index", element.getIndexElement());
      }
      if (element.hasProfile()) {
        composeCoding("profile", element.getProfile());
      }
  }

  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptDestinationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptDestinationComponentElements(TestScript.TestScriptDestinationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIndexElement()) {
        composeInteger("index", element.getIndexElement());
      }
      if (element.hasProfile()) {
        composeCoding("profile", element.getProfile());
      }
  }

  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptMetadataComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptMetadataComponentElements(TestScript.TestScriptMetadataComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLink()) { 
        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
          composeTestScriptTestScriptMetadataLinkComponent("link", e);
      }
      if (element.hasCapability()) { 
        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
          composeTestScriptTestScriptMetadataCapabilityComponent("capability", e);
      }
  }

  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptMetadataLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptMetadataLinkComponentElements(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
  }

  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptMetadataCapabilityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptMetadataCapabilityComponentElements(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRequiredElement()) {
        composeBoolean("required", element.getRequiredElement());
      }
      if (element.hasValidatedElement()) {
        composeBoolean("validated", element.getValidatedElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasOrigin()) { 
        for (IntegerType e : element.getOrigin()) 
          composeInteger("origin", e);
      }
      if (element.hasDestinationElement()) {
        composeInteger("destination", element.getDestinationElement());
      }
      if (element.hasLink()) { 
        for (UriType e : element.getLink()) 
          composeUri("link", e);
      }
      if (element.hasCapabilities()) {
        composeReference("capabilities", element.getCapabilities());
      }
  }

  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptFixtureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptFixtureComponentElements(TestScript.TestScriptFixtureComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAutocreateElement()) {
        composeBoolean("autocreate", element.getAutocreateElement());
      }
      if (element.hasAutodeleteElement()) {
        composeBoolean("autodelete", element.getAutodeleteElement());
      }
      if (element.hasResource()) {
        composeReference("resource", element.getResource());
      }
  }

  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptVariableComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptVariableComponentElements(TestScript.TestScriptVariableComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDefaultValueElement()) {
        composeString("defaultValue", element.getDefaultValueElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
      if (element.hasHeaderFieldElement()) {
        composeString("headerField", element.getHeaderFieldElement());
      }
      if (element.hasHintElement()) {
        composeString("hint", element.getHintElement());
      }
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasSourceIdElement()) {
        composeId("sourceId", element.getSourceIdElement());
      }
  }

  protected void composeTestScriptTestScriptRuleComponent(String name, TestScript.TestScriptRuleComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptRuleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptRuleComponentElements(TestScript.TestScriptRuleComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasResource()) {
        composeReference("resource", element.getResource());
      }
      if (element.hasParam()) { 
        for (TestScript.RuleParamComponent e : element.getParam()) 
          composeTestScriptRuleParamComponent("param", e);
      }
  }

  protected void composeTestScriptRuleParamComponent(String name, TestScript.RuleParamComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptRuleParamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptRuleParamComponentElements(TestScript.RuleParamComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeTestScriptTestScriptRulesetComponent(String name, TestScript.TestScriptRulesetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptRulesetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptRulesetComponentElements(TestScript.TestScriptRulesetComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasResource()) {
        composeReference("resource", element.getResource());
      }
      if (element.hasRule()) { 
        for (TestScript.RulesetRuleComponent e : element.getRule()) 
          composeTestScriptRulesetRuleComponent("rule", e);
      }
  }

  protected void composeTestScriptRulesetRuleComponent(String name, TestScript.RulesetRuleComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptRulesetRuleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptRulesetRuleComponentElements(TestScript.RulesetRuleComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRuleIdElement()) {
        composeId("ruleId", element.getRuleIdElement());
      }
      if (element.hasParam()) { 
        for (TestScript.RulesetRuleParamComponent e : element.getParam()) 
          composeTestScriptRulesetRuleParamComponent("param", e);
      }
  }

  protected void composeTestScriptRulesetRuleParamComponent(String name, TestScript.RulesetRuleParamComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptRulesetRuleParamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptRulesetRuleParamComponentElements(TestScript.RulesetRuleParamComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptSetupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptSetupComponentElements(TestScript.TestScriptSetupComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAction()) { 
        for (TestScript.SetupActionComponent e : element.getAction()) 
          composeTestScriptSetupActionComponent("action", e);
      }
  }

  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptSetupActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptSetupActionComponentElements(TestScript.SetupActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOperation()) {
        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
      }
      if (element.hasAssert()) {
        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
      }
  }

  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptSetupActionOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptSetupActionOperationComponentElements(TestScript.SetupActionOperationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasType()) {
        composeCoding("type", element.getType());
      }
      if (element.hasResourceElement()) {
        composeCode("resource", element.getResourceElement());
      }
      if (element.hasLabelElement()) {
        composeString("label", element.getLabelElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasAcceptElement())
        composeEnumeration("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory());
      if (element.hasContentTypeElement())
        composeEnumeration("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory());
      if (element.hasDestinationElement()) {
        composeInteger("destination", element.getDestinationElement());
      }
      if (element.hasEncodeRequestUrlElement()) {
        composeBoolean("encodeRequestUrl", element.getEncodeRequestUrlElement());
      }
      if (element.hasOriginElement()) {
        composeInteger("origin", element.getOriginElement());
      }
      if (element.hasParamsElement()) {
        composeString("params", element.getParamsElement());
      }
      if (element.hasRequestHeader()) { 
        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
          composeTestScriptSetupActionOperationRequestHeaderComponent("requestHeader", e);
      }
      if (element.hasRequestIdElement()) {
        composeId("requestId", element.getRequestIdElement());
      }
      if (element.hasResponseIdElement()) {
        composeId("responseId", element.getResponseIdElement());
      }
      if (element.hasSourceIdElement()) {
        composeId("sourceId", element.getSourceIdElement());
      }
      if (element.hasTargetIdElement()) {
        composeId("targetId", element.getTargetIdElement());
      }
      if (element.hasUrlElement()) {
        composeString("url", element.getUrlElement());
      }
  }

  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptSetupActionOperationRequestHeaderComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptSetupActionOperationRequestHeaderComponentElements(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasFieldElement()) {
        composeString("field", element.getFieldElement());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptSetupActionAssertComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptSetupActionAssertComponentElements(TestScript.SetupActionAssertComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLabelElement()) {
        composeString("label", element.getLabelElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasDirectionElement())
        composeEnumeration("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory());
      if (element.hasCompareToSourceIdElement()) {
        composeString("compareToSourceId", element.getCompareToSourceIdElement());
      }
      if (element.hasCompareToSourceExpressionElement()) {
        composeString("compareToSourceExpression", element.getCompareToSourceExpressionElement());
      }
      if (element.hasCompareToSourcePathElement()) {
        composeString("compareToSourcePath", element.getCompareToSourcePathElement());
      }
      if (element.hasContentTypeElement())
        composeEnumeration("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory());
      if (element.hasExpressionElement()) {
        composeString("expression", element.getExpressionElement());
      }
      if (element.hasHeaderFieldElement()) {
        composeString("headerField", element.getHeaderFieldElement());
      }
      if (element.hasMinimumIdElement()) {
        composeString("minimumId", element.getMinimumIdElement());
      }
      if (element.hasNavigationLinksElement()) {
        composeBoolean("navigationLinks", element.getNavigationLinksElement());
      }
      if (element.hasOperatorElement())
        composeEnumeration("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory());
      if (element.hasPathElement()) {
        composeString("path", element.getPathElement());
      }
      if (element.hasRequestMethodElement())
        composeEnumeration("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory());
      if (element.hasRequestURLElement()) {
        composeString("requestURL", element.getRequestURLElement());
      }
      if (element.hasResourceElement()) {
        composeCode("resource", element.getResourceElement());
      }
      if (element.hasResponseElement())
        composeEnumeration("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory());
      if (element.hasResponseCodeElement()) {
        composeString("responseCode", element.getResponseCodeElement());
      }
      if (element.hasRule()) {
        composeTestScriptActionAssertRuleComponent("rule", element.getRule());
      }
      if (element.hasRuleset()) {
        composeTestScriptActionAssertRulesetComponent("ruleset", element.getRuleset());
      }
      if (element.hasSourceIdElement()) {
        composeId("sourceId", element.getSourceIdElement());
      }
      if (element.hasValidateProfileIdElement()) {
        composeId("validateProfileId", element.getValidateProfileIdElement());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
      if (element.hasWarningOnlyElement()) {
        composeBoolean("warningOnly", element.getWarningOnlyElement());
      }
  }

  protected void composeTestScriptActionAssertRuleComponent(String name, TestScript.ActionAssertRuleComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptActionAssertRuleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptActionAssertRuleComponentElements(TestScript.ActionAssertRuleComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRuleIdElement()) {
        composeId("ruleId", element.getRuleIdElement());
      }
      if (element.hasParam()) { 
        for (TestScript.ActionAssertRuleParamComponent e : element.getParam()) 
          composeTestScriptActionAssertRuleParamComponent("param", e);
      }
  }

  protected void composeTestScriptActionAssertRuleParamComponent(String name, TestScript.ActionAssertRuleParamComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptActionAssertRuleParamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptActionAssertRuleParamComponentElements(TestScript.ActionAssertRuleParamComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeTestScriptActionAssertRulesetComponent(String name, TestScript.ActionAssertRulesetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptActionAssertRulesetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptActionAssertRulesetComponentElements(TestScript.ActionAssertRulesetComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRulesetIdElement()) {
        composeId("rulesetId", element.getRulesetIdElement());
      }
      if (element.hasRule()) { 
        for (TestScript.ActionAssertRulesetRuleComponent e : element.getRule()) 
          composeTestScriptActionAssertRulesetRuleComponent("rule", e);
      }
  }

  protected void composeTestScriptActionAssertRulesetRuleComponent(String name, TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptActionAssertRulesetRuleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptActionAssertRulesetRuleComponentElements(TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasRuleIdElement()) {
        composeId("ruleId", element.getRuleIdElement());
      }
      if (element.hasParam()) { 
        for (TestScript.ActionAssertRulesetRuleParamComponent e : element.getParam()) 
          composeTestScriptActionAssertRulesetRuleParamComponent("param", e);
      }
  }

  protected void composeTestScriptActionAssertRulesetRuleParamComponent(String name, TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptActionAssertRulesetRuleParamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptActionAssertRulesetRuleParamComponentElements(TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptTestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptTestComponentElements(TestScript.TestScriptTestComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasDescriptionElement()) {
        composeString("description", element.getDescriptionElement());
      }
      if (element.hasAction()) { 
        for (TestScript.TestActionComponent e : element.getAction()) 
          composeTestScriptTestActionComponent("action", e);
      }
  }

  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestActionComponentElements(TestScript.TestActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOperation()) {
        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
      }
      if (element.hasAssert()) {
        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
      }
  }

  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestScriptTeardownComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestScriptTeardownComponentElements(TestScript.TestScriptTeardownComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasAction()) { 
        for (TestScript.TeardownActionComponent e : element.getAction()) 
          composeTestScriptTeardownActionComponent("action", e);
      }
  }

  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTeardownActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTeardownActionComponentElements(TestScript.TeardownActionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasOperation()) {
        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
      }
  }

  protected void composeValueSet(String name, ValueSet element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetElements(ValueSet element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasUrlElement()) {
        composeUri("url", element.getUrlElement());
      }
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasTitleElement()) {
        composeString("title", element.getTitleElement());
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
      if (element.hasExperimentalElement()) {
        composeBoolean("experimental", element.getExperimentalElement());
      }
      if (element.hasDateElement()) {
        composeDateTime("date", element.getDateElement());
      }
      if (element.hasPublisherElement()) {
        composeString("publisher", element.getPublisherElement());
      }
      if (element.hasContact()) { 
        for (ContactDetail e : element.getContact()) 
          composeContactDetail("contact", e);
      }
      if (element.hasDescriptionElement()) {
        composeMarkdown("description", element.getDescriptionElement());
      }
      if (element.hasUseContext()) { 
        for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
      }
      if (element.hasJurisdiction()) { 
        for (CodeableConcept e : element.getJurisdiction()) 
          composeCodeableConcept("jurisdiction", e);
      }
      if (element.hasImmutableElement()) {
        composeBoolean("immutable", element.getImmutableElement());
      }
      if (element.hasPurposeElement()) {
        composeMarkdown("purpose", element.getPurposeElement());
      }
      if (element.hasCopyrightElement()) {
        composeMarkdown("copyright", element.getCopyrightElement());
      }
      if (element.hasExtensibleElement()) {
        composeBoolean("extensible", element.getExtensibleElement());
      }
      if (element.hasCompose()) {
        composeValueSetValueSetComposeComponent("compose", element.getCompose());
      }
      if (element.hasExpansion()) {
        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
      }
  }

  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetValueSetComposeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetValueSetComposeComponentElements(ValueSet.ValueSetComposeComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLockedDateElement()) {
        composeDate("lockedDate", element.getLockedDateElement());
      }
      if (element.hasInactiveElement()) {
        composeBoolean("inactive", element.getInactiveElement());
      }
      if (element.hasInclude()) { 
        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
          composeValueSetConceptSetComponent("include", e);
      }
      if (element.hasExclude()) { 
        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
          composeValueSetConceptSetComponent("exclude", e);
      }
  }

  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetConceptSetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetConceptSetComponentElements(ValueSet.ConceptSetComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasConcept()) { 
        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
          composeValueSetConceptReferenceComponent("concept", e);
      }
      if (element.hasFilter()) { 
        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
          composeValueSetConceptSetFilterComponent("filter", e);
      }
      if (element.hasValueSet()) { 
        for (UriType e : element.getValueSet()) 
          composeUri("valueSet", e);
      }
  }

  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetConceptReferenceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetConceptReferenceComponentElements(ValueSet.ConceptReferenceComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasDesignation()) { 
        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
          composeValueSetConceptReferenceDesignationComponent("designation", e);
      }
  }

  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetConceptReferenceDesignationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetConceptReferenceDesignationComponentElements(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasLanguageElement()) {
        composeCode("language", element.getLanguageElement());
      }
      if (element.hasUse()) {
        composeCoding("use", element.getUse());
      }
      if (element.hasValueElement()) {
        composeString("value", element.getValueElement());
      }
  }

  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetConceptSetFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetConceptSetFilterComponentElements(ValueSet.ConceptSetFilterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasPropertyElement()) {
        composeCode("property", element.getPropertyElement());
      }
      if (element.hasOpElement())
        composeEnumeration("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory());
      if (element.hasValueElement()) {
        composeCode("value", element.getValueElement());
      }
  }

  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetValueSetExpansionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetValueSetExpansionComponentElements(ValueSet.ValueSetExpansionComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasIdentifierElement()) {
        composeUri("identifier", element.getIdentifierElement());
      }
      if (element.hasTimestampElement()) {
        composeDateTime("timestamp", element.getTimestampElement());
      }
      if (element.hasTotalElement()) {
        composeInteger("total", element.getTotalElement());
      }
      if (element.hasOffsetElement()) {
        composeInteger("offset", element.getOffsetElement());
      }
      if (element.hasParameter()) { 
        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
          composeValueSetValueSetExpansionParameterComponent("parameter", e);
      }
      if (element.hasContains()) { 
        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
          composeValueSetValueSetExpansionContainsComponent("contains", e);
      }
  }

  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetValueSetExpansionParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetValueSetExpansionParameterComponentElements(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasNameElement()) {
        composeString("name", element.getNameElement());
      }
      if (element.hasValue()) {
        composeType("value", element.getValue());
      }  }

  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetValueSetExpansionContainsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetValueSetExpansionContainsComponentElements(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasSystemElement()) {
        composeUri("system", element.getSystemElement());
      }
      if (element.hasAbstractElement()) {
        composeBoolean("abstract", element.getAbstractElement());
      }
      if (element.hasInactiveElement()) {
        composeBoolean("inactive", element.getInactiveElement());
      }
      if (element.hasVersionElement()) {
        composeString("version", element.getVersionElement());
      }
      if (element.hasCodeElement()) {
        composeCode("code", element.getCodeElement());
      }
      if (element.hasDisplayElement()) {
        composeString("display", element.getDisplayElement());
      }
      if (element.hasDesignation()) { 
        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
          composeValueSetConceptReferenceDesignationComponent("designation", e);
      }
      if (element.hasContains()) { 
        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
          composeValueSetValueSetExpansionContainsComponent("contains", e);
      }
  }

  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVisionPrescriptionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVisionPrescriptionElements(VisionPrescription element) throws IOException {
      composeDomainResourceElements(element);
      if (element.hasIdentifier()) { 
        for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
      }
      if (element.hasStatusElement())
        composeEnumeration("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory());
      if (element.hasPatient()) {
        composeReference("patient", element.getPatient());
      }
      if (element.hasEncounter()) {
        composeReference("encounter", element.getEncounter());
      }
      if (element.hasDateWrittenElement()) {
        composeDateTime("dateWritten", element.getDateWrittenElement());
      }
      if (element.hasPrescriber()) {
        composeReference("prescriber", element.getPrescriber());
      }
      if (element.hasReason()) {
        composeType("reason", element.getReason());
      }      if (element.hasDispense()) { 
        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
          composeVisionPrescriptionVisionPrescriptionDispenseComponent("dispense", e);
      }
  }

  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVisionPrescriptionVisionPrescriptionDispenseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentElements(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
      composeBackboneElements(element);
      if (element.hasProduct()) {
        composeCodeableConcept("product", element.getProduct());
      }
      if (element.hasEyeElement())
        composeEnumeration("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory());
      if (element.hasSphereElement()) {
        composeDecimal("sphere", element.getSphereElement());
      }
      if (element.hasCylinderElement()) {
        composeDecimal("cylinder", element.getCylinderElement());
      }
      if (element.hasAxisElement()) {
        composeInteger("axis", element.getAxisElement());
      }
      if (element.hasPrismElement()) {
        composeDecimal("prism", element.getPrismElement());
      }
      if (element.hasBaseElement())
        composeEnumeration("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory());
      if (element.hasAddElement()) {
        composeDecimal("add", element.getAddElement());
      }
      if (element.hasPowerElement()) {
        composeDecimal("power", element.getPowerElement());
      }
      if (element.hasBackCurveElement()) {
        composeDecimal("backCurve", element.getBackCurveElement());
      }
      if (element.hasDiameterElement()) {
        composeDecimal("diameter", element.getDiameterElement());
      }
      if (element.hasDuration()) {
        composeSimpleQuantity("duration", element.getDuration());
      }
      if (element.hasColorElement()) {
        composeString("color", element.getColorElement());
      }
      if (element.hasBrandElement()) {
        composeString("brand", element.getBrandElement());
      }
      if (element.hasNote()) { 
        for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
      }
  }

  @Override
  protected void composeResource(Resource resource) throws IOException {
    if (resource instanceof Parameters)
      composeParameters("Parameters", (Parameters)resource);
    else if (resource instanceof Account)
      composeAccount("Account", (Account)resource);
    else if (resource instanceof ActivityDefinition)
      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
    else if (resource instanceof AdverseEvent)
      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
    else if (resource instanceof AllergyIntolerance)
      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
    else if (resource instanceof Appointment)
      composeAppointment("Appointment", (Appointment)resource);
    else if (resource instanceof AppointmentResponse)
      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
    else if (resource instanceof AuditEvent)
      composeAuditEvent("AuditEvent", (AuditEvent)resource);
    else if (resource instanceof Basic)
      composeBasic("Basic", (Basic)resource);
    else if (resource instanceof Binary)
      composeBinary("Binary", (Binary)resource);
    else if (resource instanceof BodySite)
      composeBodySite("BodySite", (BodySite)resource);
    else if (resource instanceof Bundle)
      composeBundle("Bundle", (Bundle)resource);
    else if (resource instanceof CapabilityStatement)
      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
    else if (resource instanceof CarePlan)
      composeCarePlan("CarePlan", (CarePlan)resource);
    else if (resource instanceof CareTeam)
      composeCareTeam("CareTeam", (CareTeam)resource);
    else if (resource instanceof ChargeItem)
      composeChargeItem("ChargeItem", (ChargeItem)resource);
    else if (resource instanceof Claim)
      composeClaim("Claim", (Claim)resource);
    else if (resource instanceof ClaimResponse)
      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
    else if (resource instanceof ClinicalImpression)
      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
    else if (resource instanceof CodeSystem)
      composeCodeSystem("CodeSystem", (CodeSystem)resource);
    else if (resource instanceof Communication)
      composeCommunication("Communication", (Communication)resource);
    else if (resource instanceof CommunicationRequest)
      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
    else if (resource instanceof CompartmentDefinition)
      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
    else if (resource instanceof Composition)
      composeComposition("Composition", (Composition)resource);
    else if (resource instanceof ConceptMap)
      composeConceptMap("ConceptMap", (ConceptMap)resource);
    else if (resource instanceof Condition)
      composeCondition("Condition", (Condition)resource);
    else if (resource instanceof Consent)
      composeConsent("Consent", (Consent)resource);
    else if (resource instanceof Contract)
      composeContract("Contract", (Contract)resource);
    else if (resource instanceof Coverage)
      composeCoverage("Coverage", (Coverage)resource);
    else if (resource instanceof DataElement)
      composeDataElement("DataElement", (DataElement)resource);
    else if (resource instanceof DetectedIssue)
      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
    else if (resource instanceof Device)
      composeDevice("Device", (Device)resource);
    else if (resource instanceof DeviceComponent)
      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
    else if (resource instanceof DeviceMetric)
      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
    else if (resource instanceof DeviceRequest)
      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
    else if (resource instanceof DeviceUseStatement)
      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
    else if (resource instanceof DiagnosticReport)
      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
    else if (resource instanceof DocumentManifest)
      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
    else if (resource instanceof DocumentReference)
      composeDocumentReference("DocumentReference", (DocumentReference)resource);
    else if (resource instanceof EligibilityRequest)
      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
    else if (resource instanceof EligibilityResponse)
      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
    else if (resource instanceof Encounter)
      composeEncounter("Encounter", (Encounter)resource);
    else if (resource instanceof Endpoint)
      composeEndpoint("Endpoint", (Endpoint)resource);
    else if (resource instanceof EnrollmentRequest)
      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
    else if (resource instanceof EnrollmentResponse)
      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
    else if (resource instanceof EpisodeOfCare)
      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
    else if (resource instanceof ExpansionProfile)
      composeExpansionProfile("ExpansionProfile", (ExpansionProfile)resource);
    else if (resource instanceof ExplanationOfBenefit)
      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
    else if (resource instanceof FamilyMemberHistory)
      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
    else if (resource instanceof Flag)
      composeFlag("Flag", (Flag)resource);
    else if (resource instanceof Goal)
      composeGoal("Goal", (Goal)resource);
    else if (resource instanceof GraphDefinition)
      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
    else if (resource instanceof Group)
      composeGroup("Group", (Group)resource);
    else if (resource instanceof GuidanceResponse)
      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
    else if (resource instanceof HealthcareService)
      composeHealthcareService("HealthcareService", (HealthcareService)resource);
    else if (resource instanceof ImagingManifest)
      composeImagingManifest("ImagingManifest", (ImagingManifest)resource);
    else if (resource instanceof ImagingStudy)
      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
    else if (resource instanceof Immunization)
      composeImmunization("Immunization", (Immunization)resource);
    else if (resource instanceof ImmunizationRecommendation)
      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
    else if (resource instanceof ImplementationGuide)
      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
    else if (resource instanceof Library)
      composeLibrary("Library", (Library)resource);
    else if (resource instanceof Linkage)
      composeLinkage("Linkage", (Linkage)resource);
    else if (resource instanceof ListResource)
      composeListResource("List", (ListResource)resource);
    else if (resource instanceof Location)
      composeLocation("Location", (Location)resource);
    else if (resource instanceof Measure)
      composeMeasure("Measure", (Measure)resource);
    else if (resource instanceof MeasureReport)
      composeMeasureReport("MeasureReport", (MeasureReport)resource);
    else if (resource instanceof Media)
      composeMedia("Media", (Media)resource);
    else if (resource instanceof Medication)
      composeMedication("Medication", (Medication)resource);
    else if (resource instanceof MedicationAdministration)
      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
    else if (resource instanceof MedicationDispense)
      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
    else if (resource instanceof MedicationRequest)
      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
    else if (resource instanceof MedicationStatement)
      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
    else if (resource instanceof MessageDefinition)
      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
    else if (resource instanceof MessageHeader)
      composeMessageHeader("MessageHeader", (MessageHeader)resource);
    else if (resource instanceof NamingSystem)
      composeNamingSystem("NamingSystem", (NamingSystem)resource);
    else if (resource instanceof NutritionOrder)
      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
    else if (resource instanceof Observation)
      composeObservation("Observation", (Observation)resource);
    else if (resource instanceof OperationDefinition)
      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
    else if (resource instanceof OperationOutcome)
      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
    else if (resource instanceof Organization)
      composeOrganization("Organization", (Organization)resource);
    else if (resource instanceof Patient)
      composePatient("Patient", (Patient)resource);
    else if (resource instanceof PaymentNotice)
      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
    else if (resource instanceof PaymentReconciliation)
      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
    else if (resource instanceof Person)
      composePerson("Person", (Person)resource);
    else if (resource instanceof PlanDefinition)
      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
    else if (resource instanceof Practitioner)
      composePractitioner("Practitioner", (Practitioner)resource);
    else if (resource instanceof PractitionerRole)
      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
    else if (resource instanceof Procedure)
      composeProcedure("Procedure", (Procedure)resource);
    else if (resource instanceof ProcedureRequest)
      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
    else if (resource instanceof ProcessRequest)
      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
    else if (resource instanceof ProcessResponse)
      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
    else if (resource instanceof Provenance)
      composeProvenance("Provenance", (Provenance)resource);
    else if (resource instanceof Questionnaire)
      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
    else if (resource instanceof QuestionnaireResponse)
      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
    else if (resource instanceof ReferralRequest)
      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
    else if (resource instanceof RelatedPerson)
      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
    else if (resource instanceof RequestGroup)
      composeRequestGroup("RequestGroup", (RequestGroup)resource);
    else if (resource instanceof ResearchStudy)
      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
    else if (resource instanceof ResearchSubject)
      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
    else if (resource instanceof RiskAssessment)
      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
    else if (resource instanceof Schedule)
      composeSchedule("Schedule", (Schedule)resource);
    else if (resource instanceof SearchParameter)
      composeSearchParameter("SearchParameter", (SearchParameter)resource);
    else if (resource instanceof Sequence)
      composeSequence("Sequence", (Sequence)resource);
    else if (resource instanceof ServiceDefinition)
      composeServiceDefinition("ServiceDefinition", (ServiceDefinition)resource);
    else if (resource instanceof Slot)
      composeSlot("Slot", (Slot)resource);
    else if (resource instanceof Specimen)
      composeSpecimen("Specimen", (Specimen)resource);
    else if (resource instanceof StructureDefinition)
      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
    else if (resource instanceof StructureMap)
      composeStructureMap("StructureMap", (StructureMap)resource);
    else if (resource instanceof Subscription)
      composeSubscription("Subscription", (Subscription)resource);
    else if (resource instanceof Substance)
      composeSubstance("Substance", (Substance)resource);
    else if (resource instanceof SupplyDelivery)
      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
    else if (resource instanceof SupplyRequest)
      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
    else if (resource instanceof Task)
      composeTask("Task", (Task)resource);
    else if (resource instanceof TestReport)
      composeTestReport("TestReport", (TestReport)resource);
    else if (resource instanceof TestScript)
      composeTestScript("TestScript", (TestScript)resource);
    else if (resource instanceof ValueSet)
      composeValueSet("ValueSet", (ValueSet)resource);
    else if (resource instanceof VisionPrescription)
      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
    else if (resource instanceof Binary)
      composeBinary("Binary", (Binary)resource);
    else
      throw new Error("Unhandled resource type "+resource.getClass().getName());
  }

  protected void composeResource(String name, Resource resource) throws IOException {
    if (resource instanceof Parameters)
      composeParameters(name, (Parameters)resource);
    else if (resource instanceof Account)
      composeAccount(name, (Account)resource);
    else if (resource instanceof ActivityDefinition)
      composeActivityDefinition(name, (ActivityDefinition)resource);
    else if (resource instanceof AdverseEvent)
      composeAdverseEvent(name, (AdverseEvent)resource);
    else if (resource instanceof AllergyIntolerance)
      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
    else if (resource instanceof Appointment)
      composeAppointment(name, (Appointment)resource);
    else if (resource instanceof AppointmentResponse)
      composeAppointmentResponse(name, (AppointmentResponse)resource);
    else if (resource instanceof AuditEvent)
      composeAuditEvent(name, (AuditEvent)resource);
    else if (resource instanceof Basic)
      composeBasic(name, (Basic)resource);
    else if (resource instanceof Binary)
      composeBinary(name, (Binary)resource);
    else if (resource instanceof BodySite)
      composeBodySite(name, (BodySite)resource);
    else if (resource instanceof Bundle)
      composeBundle(name, (Bundle)resource);
    else if (resource instanceof CapabilityStatement)
      composeCapabilityStatement(name, (CapabilityStatement)resource);
    else if (resource instanceof CarePlan)
      composeCarePlan(name, (CarePlan)resource);
    else if (resource instanceof CareTeam)
      composeCareTeam(name, (CareTeam)resource);
    else if (resource instanceof ChargeItem)
      composeChargeItem(name, (ChargeItem)resource);
    else if (resource instanceof Claim)
      composeClaim(name, (Claim)resource);
    else if (resource instanceof ClaimResponse)
      composeClaimResponse(name, (ClaimResponse)resource);
    else if (resource instanceof ClinicalImpression)
      composeClinicalImpression(name, (ClinicalImpression)resource);
    else if (resource instanceof CodeSystem)
      composeCodeSystem(name, (CodeSystem)resource);
    else if (resource instanceof Communication)
      composeCommunication(name, (Communication)resource);
    else if (resource instanceof CommunicationRequest)
      composeCommunicationRequest(name, (CommunicationRequest)resource);
    else if (resource instanceof CompartmentDefinition)
      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
    else if (resource instanceof Composition)
      composeComposition(name, (Composition)resource);
    else if (resource instanceof ConceptMap)
      composeConceptMap(name, (ConceptMap)resource);
    else if (resource instanceof Condition)
      composeCondition(name, (Condition)resource);
    else if (resource instanceof Consent)
      composeConsent(name, (Consent)resource);
    else if (resource instanceof Contract)
      composeContract(name, (Contract)resource);
    else if (resource instanceof Coverage)
      composeCoverage(name, (Coverage)resource);
    else if (resource instanceof DataElement)
      composeDataElement(name, (DataElement)resource);
    else if (resource instanceof DetectedIssue)
      composeDetectedIssue(name, (DetectedIssue)resource);
    else if (resource instanceof Device)
      composeDevice(name, (Device)resource);
    else if (resource instanceof DeviceComponent)
      composeDeviceComponent(name, (DeviceComponent)resource);
    else if (resource instanceof DeviceMetric)
      composeDeviceMetric(name, (DeviceMetric)resource);
    else if (resource instanceof DeviceRequest)
      composeDeviceRequest(name, (DeviceRequest)resource);
    else if (resource instanceof DeviceUseStatement)
      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
    else if (resource instanceof DiagnosticReport)
      composeDiagnosticReport(name, (DiagnosticReport)resource);
    else if (resource instanceof DocumentManifest)
      composeDocumentManifest(name, (DocumentManifest)resource);
    else if (resource instanceof DocumentReference)
      composeDocumentReference(name, (DocumentReference)resource);
    else if (resource instanceof EligibilityRequest)
      composeEligibilityRequest(name, (EligibilityRequest)resource);
    else if (resource instanceof EligibilityResponse)
      composeEligibilityResponse(name, (EligibilityResponse)resource);
    else if (resource instanceof Encounter)
      composeEncounter(name, (Encounter)resource);
    else if (resource instanceof Endpoint)
      composeEndpoint(name, (Endpoint)resource);
    else if (resource instanceof EnrollmentRequest)
      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
    else if (resource instanceof EnrollmentResponse)
      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
    else if (resource instanceof EpisodeOfCare)
      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
    else if (resource instanceof ExpansionProfile)
      composeExpansionProfile(name, (ExpansionProfile)resource);
    else if (resource instanceof ExplanationOfBenefit)
      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
    else if (resource instanceof FamilyMemberHistory)
      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
    else if (resource instanceof Flag)
      composeFlag(name, (Flag)resource);
    else if (resource instanceof Goal)
      composeGoal(name, (Goal)resource);
    else if (resource instanceof GraphDefinition)
      composeGraphDefinition(name, (GraphDefinition)resource);
    else if (resource instanceof Group)
      composeGroup(name, (Group)resource);
    else if (resource instanceof GuidanceResponse)
      composeGuidanceResponse(name, (GuidanceResponse)resource);
    else if (resource instanceof HealthcareService)
      composeHealthcareService(name, (HealthcareService)resource);
    else if (resource instanceof ImagingManifest)
      composeImagingManifest(name, (ImagingManifest)resource);
    else if (resource instanceof ImagingStudy)
      composeImagingStudy(name, (ImagingStudy)resource);
    else if (resource instanceof Immunization)
      composeImmunization(name, (Immunization)resource);
    else if (resource instanceof ImmunizationRecommendation)
      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
    else if (resource instanceof ImplementationGuide)
      composeImplementationGuide(name, (ImplementationGuide)resource);
    else if (resource instanceof Library)
      composeLibrary(name, (Library)resource);
    else if (resource instanceof Linkage)
      composeLinkage(name, (Linkage)resource);
    else if (resource instanceof ListResource)
      composeListResource(name, (ListResource)resource);
    else if (resource instanceof Location)
      composeLocation(name, (Location)resource);
    else if (resource instanceof Measure)
      composeMeasure(name, (Measure)resource);
    else if (resource instanceof MeasureReport)
      composeMeasureReport(name, (MeasureReport)resource);
    else if (resource instanceof Media)
      composeMedia(name, (Media)resource);
    else if (resource instanceof Medication)
      composeMedication(name, (Medication)resource);
    else if (resource instanceof MedicationAdministration)
      composeMedicationAdministration(name, (MedicationAdministration)resource);
    else if (resource instanceof MedicationDispense)
      composeMedicationDispense(name, (MedicationDispense)resource);
    else if (resource instanceof MedicationRequest)
      composeMedicationRequest(name, (MedicationRequest)resource);
    else if (resource instanceof MedicationStatement)
      composeMedicationStatement(name, (MedicationStatement)resource);
    else if (resource instanceof MessageDefinition)
      composeMessageDefinition(name, (MessageDefinition)resource);
    else if (resource instanceof MessageHeader)
      composeMessageHeader(name, (MessageHeader)resource);
    else if (resource instanceof NamingSystem)
      composeNamingSystem(name, (NamingSystem)resource);
    else if (resource instanceof NutritionOrder)
      composeNutritionOrder(name, (NutritionOrder)resource);
    else if (resource instanceof Observation)
      composeObservation(name, (Observation)resource);
    else if (resource instanceof OperationDefinition)
      composeOperationDefinition(name, (OperationDefinition)resource);
    else if (resource instanceof OperationOutcome)
      composeOperationOutcome(name, (OperationOutcome)resource);
    else if (resource instanceof Organization)
      composeOrganization(name, (Organization)resource);
    else if (resource instanceof Patient)
      composePatient(name, (Patient)resource);
    else if (resource instanceof PaymentNotice)
      composePaymentNotice(name, (PaymentNotice)resource);
    else if (resource instanceof PaymentReconciliation)
      composePaymentReconciliation(name, (PaymentReconciliation)resource);
    else if (resource instanceof Person)
      composePerson(name, (Person)resource);
    else if (resource instanceof PlanDefinition)
      composePlanDefinition(name, (PlanDefinition)resource);
    else if (resource instanceof Practitioner)
      composePractitioner(name, (Practitioner)resource);
    else if (resource instanceof PractitionerRole)
      composePractitionerRole(name, (PractitionerRole)resource);
    else if (resource instanceof Procedure)
      composeProcedure(name, (Procedure)resource);
    else if (resource instanceof ProcedureRequest)
      composeProcedureRequest(name, (ProcedureRequest)resource);
    else if (resource instanceof ProcessRequest)
      composeProcessRequest(name, (ProcessRequest)resource);
    else if (resource instanceof ProcessResponse)
      composeProcessResponse(name, (ProcessResponse)resource);
    else if (resource instanceof Provenance)
      composeProvenance(name, (Provenance)resource);
    else if (resource instanceof Questionnaire)
      composeQuestionnaire(name, (Questionnaire)resource);
    else if (resource instanceof QuestionnaireResponse)
      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
    else if (resource instanceof ReferralRequest)
      composeReferralRequest(name, (ReferralRequest)resource);
    else if (resource instanceof RelatedPerson)
      composeRelatedPerson(name, (RelatedPerson)resource);
    else if (resource instanceof RequestGroup)
      composeRequestGroup(name, (RequestGroup)resource);
    else if (resource instanceof ResearchStudy)
      composeResearchStudy(name, (ResearchStudy)resource);
    else if (resource instanceof ResearchSubject)
      composeResearchSubject(name, (ResearchSubject)resource);
    else if (resource instanceof RiskAssessment)
      composeRiskAssessment(name, (RiskAssessment)resource);
    else if (resource instanceof Schedule)
      composeSchedule(name, (Schedule)resource);
    else if (resource instanceof SearchParameter)
      composeSearchParameter(name, (SearchParameter)resource);
    else if (resource instanceof Sequence)
      composeSequence(name, (Sequence)resource);
    else if (resource instanceof ServiceDefinition)
      composeServiceDefinition(name, (ServiceDefinition)resource);
    else if (resource instanceof Slot)
      composeSlot(name, (Slot)resource);
    else if (resource instanceof Specimen)
      composeSpecimen(name, (Specimen)resource);
    else if (resource instanceof StructureDefinition)
      composeStructureDefinition(name, (StructureDefinition)resource);
    else if (resource instanceof StructureMap)
      composeStructureMap(name, (StructureMap)resource);
    else if (resource instanceof Subscription)
      composeSubscription(name, (Subscription)resource);
    else if (resource instanceof Substance)
      composeSubstance(name, (Substance)resource);
    else if (resource instanceof SupplyDelivery)
      composeSupplyDelivery(name, (SupplyDelivery)resource);
    else if (resource instanceof SupplyRequest)
      composeSupplyRequest(name, (SupplyRequest)resource);
    else if (resource instanceof Task)
      composeTask(name, (Task)resource);
    else if (resource instanceof TestReport)
      composeTestReport(name, (TestReport)resource);
    else if (resource instanceof TestScript)
      composeTestScript(name, (TestScript)resource);
    else if (resource instanceof ValueSet)
      composeValueSet(name, (ValueSet)resource);
    else if (resource instanceof VisionPrescription)
      composeVisionPrescription(name, (VisionPrescription)resource);
    else if (resource instanceof Binary)
      composeBinary(name, (Binary)resource);
    else
      throw new Error("Unhandled resource type "+resource.getClass().getName());
  }

  protected void composeType(String prefix, Type type) throws IOException {
    if (type == null)
      ;
    else if (type instanceof SimpleQuantity)
       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
    else if (type instanceof Duration)
       composeDuration(prefix+"Duration", (Duration) type);
    else if (type instanceof Count)
       composeCount(prefix+"Count", (Count) type);
    else if (type instanceof Money)
       composeMoney(prefix+"Money", (Money) type);
    else if (type instanceof Distance)
       composeDistance(prefix+"Distance", (Distance) type);
    else if (type instanceof Age)
       composeAge(prefix+"Age", (Age) type);
    else if (type instanceof Reference)
       composeReference(prefix+"Reference", (Reference) type);
    else if (type instanceof Quantity)
       composeQuantity(prefix+"Quantity", (Quantity) type);
    else if (type instanceof Period)
       composePeriod(prefix+"Period", (Period) type);
    else if (type instanceof Attachment)
       composeAttachment(prefix+"Attachment", (Attachment) type);
    else if (type instanceof Range)
       composeRange(prefix+"Range", (Range) type);
    else if (type instanceof Annotation)
       composeAnnotation(prefix+"Annotation", (Annotation) type);
    else if (type instanceof Identifier)
       composeIdentifier(prefix+"Identifier", (Identifier) type);
    else if (type instanceof Coding)
       composeCoding(prefix+"Coding", (Coding) type);
    else if (type instanceof Signature)
       composeSignature(prefix+"Signature", (Signature) type);
    else if (type instanceof SampledData)
       composeSampledData(prefix+"SampledData", (SampledData) type);
    else if (type instanceof Ratio)
       composeRatio(prefix+"Ratio", (Ratio) type);
    else if (type instanceof CodeableConcept)
       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
    else if (type instanceof Meta)
       composeMeta(prefix+"Meta", (Meta) type);
    else if (type instanceof Address)
       composeAddress(prefix+"Address", (Address) type);
    else if (type instanceof TriggerDefinition)
       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
    else if (type instanceof Contributor)
       composeContributor(prefix+"Contributor", (Contributor) type);
    else if (type instanceof DataRequirement)
       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
    else if (type instanceof Dosage)
       composeDosage(prefix+"Dosage", (Dosage) type);
    else if (type instanceof RelatedArtifact)
       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
    else if (type instanceof ContactDetail)
       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
    else if (type instanceof HumanName)
       composeHumanName(prefix+"HumanName", (HumanName) type);
    else if (type instanceof ContactPoint)
       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
    else if (type instanceof UsageContext)
       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
    else if (type instanceof Timing)
       composeTiming(prefix+"Timing", (Timing) type);
    else if (type instanceof ElementDefinition)
       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
    else if (type instanceof ParameterDefinition)
       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
    else if (type instanceof CodeType)
       composeCode(prefix+"Code", (CodeType) type);
    else if (type instanceof OidType)
       composeOid(prefix+"Oid", (OidType) type);
    else if (type instanceof UuidType)
       composeUuid(prefix+"Uuid", (UuidType) type);
    else if (type instanceof UnsignedIntType)
       composeUnsignedInt(prefix+"UnsignedInt", (UnsignedIntType) type);
    else if (type instanceof MarkdownType)
       composeMarkdown(prefix+"Markdown", (MarkdownType) type);
    else if (type instanceof IdType)
       composeId(prefix+"Id", (IdType) type);
    else if (type instanceof PositiveIntType)
       composePositiveInt(prefix+"PositiveInt", (PositiveIntType) type);
    else if (type instanceof DateType)
       composeDate(prefix+"Date", (DateType) type);
    else if (type instanceof DateTimeType)
       composeDateTime(prefix+"DateTime", (DateTimeType) type);
    else if (type instanceof StringType)
       composeString(prefix+"String", (StringType) type);
    else if (type instanceof IntegerType)
       composeInteger(prefix+"Integer", (IntegerType) type);
    else if (type instanceof UriType)
       composeUri(prefix+"Uri", (UriType) type);
    else if (type instanceof InstantType)
       composeInstant(prefix+"Instant", (InstantType) type);
    else if (type instanceof BooleanType)
       composeBoolean(prefix+"Boolean", (BooleanType) type);
    else if (type instanceof Base64BinaryType)
       composeBase64Binary(prefix+"Base64Binary", (Base64BinaryType) type);
    else if (type instanceof TimeType)
       composeTime(prefix+"Time", (TimeType) type);
    else if (type instanceof DecimalType)
       composeDecimal(prefix+"Decimal", (DecimalType) type);
    else
      throw new Error("Unhandled type");
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy