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

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

Go to download

Builds the hapi fhir r4. Requires hapi-fhir-base and hapi-fhir-utilities be built first and be excluded from any other poms requiring it.

The newest version!
package org.hl7.fhir.r4.formats;

import java.io.IOException;

import org.hl7.fhir.exceptions.FHIRFormatError;

/*
  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 Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.utilities.Utilities;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class XmlParser extends XmlParserBase {

  public XmlParser() {
    super();
  }

  public XmlParser(XmlVersion ver) {
    super(ver);
  }

  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 parseBackboneElementContent(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;
  }

  protected boolean parseBackboneElementContent(int eventType, XmlPullParser xpp, BackboneType 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 CanonicalType parseCanonical(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    CanonicalType res = new CanonicalType(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 UrlType parseUrl(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    UrlType res = new UrlType(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 Meta parseMeta(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Meta res = new Meta();
    parseTypeAttributes(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("source")) {
      res.setSourceElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
      res.getProfile().add(parseCanonical(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();
    parseTypeAttributes(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 Contributor parseContributor(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    Contributor res = new Contributor();
    parseTypeAttributes(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 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(parseUrl(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 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 DataRequirement parseDataRequirement(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    DataRequirement res = new DataRequirement();
    parseTypeAttributes(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(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("limit")) {
      res.setLimitElement(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sort")) {
      res.getSort().add(parseDataRequirementDataRequirementSortComponent(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 && xpp.getName().equals("searchParam")) {
      res.setSearchParamElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
      res.setValueSetElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.getCode().add(parseCoding(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 && xpp.getName().equals("searchParam")) {
      res.setSearchParamElement(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 DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(
      XmlPullParser xpp, DataRequirement owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDataRequirementDataRequirementSortComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementDataRequirementSortComponentContent(int eventType, XmlPullParser xpp,
      DataRequirement owner, DataRequirement.DataRequirementSortComponent 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("direction")) {
      res.setDirectionElement(
          parseEnumeration(xpp, DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
    } else if (!parseElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected Dosage parseDosage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Dosage res = new Dosage();
    parseTypeAttributes(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 && xpp.getName().equals("doseAndRate")) {
      res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(xpp, res));
    } 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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerLifetime")) {
      res.setMaxDosePerLifetime(parseQuantity(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseDosageDosageDoseAndRateComponentContent(int eventType, XmlPullParser xpp, Dosage owner,
      Dosage.DosageDoseAndRateComponent 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, "dose")) {
      res.setDose(parseType("dose", 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 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValueElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("currency")) {
      res.setCurrencyElement(parseCode(xpp));
    } else if (!parseElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected HumanName parseHumanName(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    HumanName res = new HumanName();
    parseTypeAttributes(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();
    parseTypeAttributes(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 MarketingStatus parseMarketingStatus(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MarketingStatus res = new MarketingStatus();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMarketingStatusContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMarketingStatusContent(int eventType, XmlPullParser xpp, MarketingStatus res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
      res.setCountry(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
      res.setJurisdiction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateRange")) {
      res.setDateRange(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("restoreDate")) {
      res.setRestoreDateElement(parseDateTime(xpp));
    } else if (!parseBackboneElementContent(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 SubstanceAmount parseSubstanceAmount(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceAmount res = new SubstanceAmount();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceAmountContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceAmountContent(int eventType, XmlPullParser xpp, SubstanceAmount res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "amount")) {
      res.setAmount(parseType("amount", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amountType")) {
      res.setAmountType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amountText")) {
      res.setAmountTextElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceRange")) {
      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(xpp, res));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(
      XmlPullParser xpp, SubstanceAmount owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceAmountSubstanceAmountReferenceRangeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceAmountSubstanceAmountReferenceRangeComponentContent(int eventType, XmlPullParser xpp,
      SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lowLimit")) {
      res.setLowLimit(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("highLimit")) {
      res.setHighLimit(parseQuantity(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 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(parseQuantity(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 Population parsePopulation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Population res = new Population();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parsePopulationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePopulationContent(int eventType, XmlPullParser xpp, Population res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "age")) {
      res.setAge(parseType("age", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
      res.setGender(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("race")) {
      res.setRace(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("physiologicalCondition")) {
      res.setPhysiologicalCondition(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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 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("type")) {
      res.setTypeElement(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("display")) {
      res.setDisplayElement(parseString(xpp));
    } else if (!parseElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TriggerDefinition parseTriggerDefinition(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    TriggerDefinition res = new TriggerDefinition();
    parseTypeAttributes(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("name")) {
      res.setNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
      res.setTiming(parseType("timing", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
      res.getData().add(parseDataRequirement(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
      res.setCondition(parseExpression(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 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 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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("high")) {
      res.setHigh(parseQuantity(xpp));
    } else if (!parseElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected RelatedArtifact parseRelatedArtifact(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    RelatedArtifact res = new RelatedArtifact();
    parseTypeAttributes(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("label")) {
      res.setLabelElement(parseString(xpp));
    } 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(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
      res.setUrlElement(parseUrl(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.setResourceElement(parseCanonical(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(parseMarkdown(xpp));
    } else if (!parseElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseProductShelfLifeContent(int eventType, XmlPullParser xpp, ProductShelfLife 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("period")) {
      res.setPeriod(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialPrecautionsForStorage")) {
      res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ContactDetail parseContactDetail(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    ContactDetail res = new ContactDetail();
    parseTypeAttributes(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 UsageContext parseUsageContext(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    UsageContext res = new UsageContext();
    parseTypeAttributes(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 Expression parseExpression(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Expression res = new Expression();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExpressionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExpressionContent(int eventType, XmlPullParser xpp, Expression 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("name")) {
      res.setNameElement(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("expression")) {
      res.setExpressionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.setReferenceElement(parseUri(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 && xpp.getName().equals("who")) {
      res.setWho(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("targetFormat")) {
      res.setTargetFormatElement(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sigFormat")) {
      res.setSigFormatElement(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
      res.setDataElement(parseBase64Binary(xpp));
    } else if (!parseElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected Timing parseTiming(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Timing res = new Timing();
    parseTypeAttributes(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 (!parseBackboneElementContent(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(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("countMax")) {
      res.setCountMaxElement(parsePositiveInt(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(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequencyMax")) {
      res.setFrequencyMaxElement(parsePositiveInt(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 ProdCharacteristic parseProdCharacteristic(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    ProdCharacteristic res = new ProdCharacteristic();
    parseTypeAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseProdCharacteristicContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProdCharacteristicContent(int eventType, XmlPullParser xpp, ProdCharacteristic res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("height")) {
      res.setHeight(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("width")) {
      res.setWidth(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("depth")) {
      res.setDepth(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("weight")) {
      res.setWeight(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nominalVolume")) {
      res.setNominalVolume(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("externalDiameter")) {
      res.setExternalDiameter(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("shape")) {
      res.setShapeElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("color")) {
      res.getColor().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("imprint")) {
      res.getImprint().add(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("scoring")) {
      res.setScoring(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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 ParameterDefinition parseParameterDefinition(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    ParameterDefinition res = new ParameterDefinition();
    parseTypeAttributes(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.setProfileElement(parseCanonical(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("sliceIsConstraining")) {
      res.setSliceIsConstrainingElement(parseBoolean(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("isModifierReason")) {
      res.setIsModifierReasonElement(parseString(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 (!parseBackboneElementContent(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.getProfile().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetProfile")) {
      res.getTargetProfile().add(parseCanonical(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(parseCanonical(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 && xpp.getName().equals("valueSet")) {
      res.setValueSetElement(parseCanonical(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 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 (!parseBackboneElementContent(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.getSubject().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("servicePeriod")) {
      res.setServicePeriod(parsePeriod(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
      res.setPartOf(parseReference(xpp));
    } 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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("subtitle")) {
      res.setSubtitleElement(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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("usage")) {
      res.setUsageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("library")) {
      res.getLibrary().add(parseCanonical(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("profile")) {
      res.setProfileElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntentElement(parseEnumeration(xpp, ActivityDefinition.RequestIntent.NULL,
          new ActivityDefinition.RequestIntentEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
      res.setPriorityElement(parseEnumeration(xpp, ActivityDefinition.RequestPriority.NULL,
          new ActivityDefinition.RequestPriorityEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
      res.setDoNotPerformElement(parseBoolean(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(parseQuantity(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("specimenRequirement")) {
      res.getSpecimenRequirement().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observationRequirement")) {
      res.getObservationRequirement().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observationResultRequirement")) {
      res.getObservationResultRequirement().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("transform")) {
      res.setTransformElement(parseCanonical(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 (!parseBackboneElementContent(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("path")) {
      res.setPathElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
      res.setExpression(parseExpression(xpp));
    } else if (!parseBackboneElementContent(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("actuality")) {
      res.setActualityElement(parseEnumeration(xpp, AdverseEvent.AdverseEventActuality.NULL,
          new AdverseEvent.AdverseEventActualityEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
      res.getCategory().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
      res.setEvent(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("detected")) {
      res.setDetectedElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recordedDate")) {
      res.setRecordedDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resultingCondition")) {
      res.getResultingCondition().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("severity")) {
      res.setSeverity(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("contributor")) {
      res.getContributor().add(parseReference(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.getCausality().add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseAdverseEventAdverseEventSuspectEntityCausalityComponentContent(int eventType,
      XmlPullParser xpp, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assessment")) {
      res.setAssessment(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productRelatedness")) {
      res.setProductRelatednessElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.setAuthor(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
      res.setMethod(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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.setClinicalStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verificationStatus")) {
      res.setVerificationStatus(parseCodeableConcept(xpp));
    } 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 && xpp.getName().equals("encounter")) {
      res.setEncounter(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("recordedDate")) {
      res.setRecordedDateElement(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 (!parseBackboneElementContent(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("cancelationReason")) {
      res.setCancelationReason(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceCategory")) {
      res.getServiceCategory().add(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("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("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("patientInstruction")) {
      res.setPatientInstructionElement(parseString(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("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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
      res.setPeriod(parsePeriod(xpp));
    } else if (!parseBackboneElementContent(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("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("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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
      res.getRole().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("who")) {
      res.setWho(parseReference(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("observer")) {
      res.setObserver(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.getType().add(parseCoding(xpp));
    } else if (!parseBackboneElementContent(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("what")) {
      res.setWhat(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 (!parseBackboneElementContent(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 && nameIsTypeName(xpp, "value")) {
      res.setValue(parseType("value", xpp));
    } else if (!parseBackboneElementContent(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("data")) {
      res.setDataElement(parseBase64Binary(xpp));
    } else if (!parseResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseBiologicallyDerivedProductContent(int eventType, XmlPullParser xpp,
      BiologicallyDerivedProduct 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("productCategory")) {
      res.setProductCategoryElement(
          parseEnumeration(xpp, BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL,
              new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productCode")) {
      res.setProductCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL,
          new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
      res.getRequest().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantityElement(parseInteger(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("collection")) {
      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processing")) {
      res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manipulation")) {
      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("storage")) {
      res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(
      XmlPullParser xpp, BiologicallyDerivedProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentContent(int eventType,
      XmlPullParser xpp, BiologicallyDerivedProduct owner,
      BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collector")) {
      res.setCollector(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.setSource(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "collected")) {
      res.setCollected(parseType("collected", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(
      XmlPullParser xpp, BiologicallyDerivedProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentContent(int eventType,
      XmlPullParser xpp, BiologicallyDerivedProduct owner,
      BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent 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.setAdditive(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "time")) {
      res.setTime(parseType("time", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(
      XmlPullParser xpp, BiologicallyDerivedProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentContent(int eventType,
      XmlPullParser xpp, BiologicallyDerivedProduct owner,
      BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
      res.setDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "time")) {
      res.setTime(parseType("time", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(
      XmlPullParser xpp, BiologicallyDerivedProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentContent(int eventType,
      XmlPullParser xpp, BiologicallyDerivedProduct owner,
      BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent 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("temperature")) {
      res.setTemperatureElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scale")) {
      res.setScaleElement(parseEnumeration(xpp, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL,
          new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
      res.setDuration(parsePeriod(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseBodyStructureContent(int eventType, XmlPullParser xpp, BodyStructure 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("morphology")) {
      res.setMorphology(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
      res.setLocation(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("locationQualifier")) {
      res.getLocationQualifier().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("timestamp")) {
      res.setTimestampElement(parseInstant(xpp));
    } 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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("imports")) {
      res.getImports().add(parseCanonical(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(
          parseEnumeration(xpp, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
    } 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(parseCanonical(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 (!parseBackboneElementContent(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(parseUrl(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian")) {
      res.setCustodian(parseReference(xpp));
    } else if (!parseBackboneElementContent(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(parseMarkdown(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(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compartment")) {
      res.getCompartment().add(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(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(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(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.setProfileElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportedProfile")) {
      res.getSupportedProfile().add(parseCanonical(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(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(parseCanonical(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(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCapabilityStatementCapabilityStatementRestResourceOperationComponentContent(int eventType,
      XmlPullParser xpp, CapabilityStatement owner,
      CapabilityStatement.CapabilityStatementRestResourceOperationComponent 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(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
      res.setDocumentationElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(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(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(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(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportedMessage")) {
      res.getSupportedMessage()
          .add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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(parseUrl(xpp));
    } else if (!parseBackboneElementContent(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.setDefinitionElement(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(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(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
      res.setProfileElement(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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("encounter")) {
      res.setEncounter(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("created")) {
      res.setCreatedElement(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("contributor")) {
      res.getContributor().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 (!parseBackboneElementContent(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("kind")) {
      res.setKindElement(
          parseEnumeration(xpp, CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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.setStatusReason(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
      res.setDoNotPerformElement(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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
      res.setDescriptionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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("encounter")) {
      res.setEncounter(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("telecom")) {
      res.getTelecom().add(parseContactPoint(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.getRole().add(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCatalogEntryContent(int eventType, XmlPullParser xpp, CatalogEntry 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.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderable")) {
      res.setOrderableElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referencedItem")) {
      res.setReferencedItem(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalIdentifier")) {
      res.getAdditionalIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
      res.getClassification().add(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("validityPeriod")) {
      res.setValidityPeriod(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validTo")) {
      res.setValidToElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastUpdated")) {
      res.setLastUpdatedElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalCharacteristic")) {
      res.getAdditionalCharacteristic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalClassification")) {
      res.getAdditionalClassification().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedEntry")) {
      res.getRelatedEntry().add(parseCatalogEntryCatalogEntryRelatedEntryComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(
      XmlPullParser xpp, CatalogEntry owner) throws XmlPullParserException, IOException, FHIRFormatError {
    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseCatalogEntryCatalogEntryRelatedEntryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCatalogEntryCatalogEntryRelatedEntryComponentContent(int eventType, XmlPullParser xpp,
      CatalogEntry owner, CatalogEntry.CatalogEntryRelatedEntryComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationtype")) {
      res.setRelationtypeElement(parseEnumeration(xpp, CatalogEntry.CatalogEntryRelationType.NULL,
          new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.setItem(parseReference(xpp));
    } else if (!parseBackboneElementContent(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.getIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definitionUri")) {
      res.getDefinitionUri().add(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definitionCanonical")) {
      res.getDefinitionCanonical().add(parseCanonical(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("performer")) {
      res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(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("costCenter")) {
      res.setCostCenter(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 && nameIsTypeName(xpp, "product")) {
      res.setProduct(parseType("product", 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.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(XmlPullParser xpp,
      ChargeItem owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseChargeItemChargeItemPerformerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseChargeItemChargeItemPerformerComponentContent(int eventType, XmlPullParser xpp,
      ChargeItem owner, ChargeItem.ChargeItemPerformerComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
      res.setFunction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
      res.setActor(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseChargeItemDefinitionContent(int eventType, XmlPullParser xpp, ChargeItemDefinition 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("title")) {
      res.setTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivedFromUri")) {
      res.getDerivedFromUri().add(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
      res.getPartOf().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
      res.getReplaces().add(parseCanonical(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("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("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
      res.getInstance().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("applicability")) {
      res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("propertyGroup")) {
      res.getPropertyGroup().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(
      XmlPullParser xpp, ChargeItemDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentContent(int eventType,
      XmlPullParser xpp, ChargeItemDefinition owner,
      ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent 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("language")) {
      res.setLanguageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
      res.setExpressionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(
      XmlPullParser xpp, ChargeItemDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentContent(int eventType,
      XmlPullParser xpp, ChargeItemDefinition owner,
      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("applicability")) {
      res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priceComponent")) {
      res.getPriceComponent()
          .add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(
      XmlPullParser xpp, ChargeItemDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentContent(
      int eventType, XmlPullParser xpp, ChargeItemDefinition owner,
      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL,
          new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
      res.setFactorElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseMoney(xpp));
    } else if (!parseBackboneElementContent(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.setSubType(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("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("supportingInfo")) {
      res.getSupportingInfo().add(parseClaimSupportingInformationComponent(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("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 (!parseBackboneElementContent(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("party")) {
      res.setParty(parseReference(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseClaimSupportingInformationComponentContent(int eventType, XmlPullParser xpp, Claim owner,
      Claim.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(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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("onAdmission")) {
      res.setOnAdmission(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageCode")) {
      res.setPackageCode(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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("type")) {
      res.getType().add(parseCodeableConcept(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
      res.getUdi().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(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("identifier")) {
      res.setIdentifier(parseIdentifier(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("careTeamSequence")) {
      res.getCareTeamSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosisSequence")) {
      res.getDiagnosisSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedureSequence")) {
      res.getProcedureSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationSequence")) {
      res.getInformationSequence().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("productOrService")) {
      res.setProductOrService(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(parseQuantity(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 (!parseBackboneElementContent(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("productOrService")) {
      res.setProductOrService(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(parseQuantity(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 (!parseBackboneElementContent(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("productOrService")) {
      res.setProductOrService(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(parseQuantity(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 (!parseBackboneElementContent(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("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("use")) {
      res.setUseElement(parseEnumeration(xpp, ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
    } 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("requestor")) {
      res.setRequestor(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.setOutcomeElement(parseEnumeration(xpp, ClaimResponse.RemittanceOutcome.NULL,
          new ClaimResponse.RemittanceOutcomeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
      res.setDispositionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthRef")) {
      res.setPreAuthRefElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthPeriod")) {
      res.setPreAuthPeriod(parsePeriod(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("adjudication")) {
      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
      res.getTotal().add(parseClaimResponseTotalComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
      res.setPayment(parseClaimResponsePaymentComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fundsReserve")) {
      res.setFundsReserve(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("formCode")) {
      res.setFormCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
      res.setForm(parseAttachment(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
      res.getError().add(parseClaimResponseErrorComponent(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("itemSequence")) {
      res.setItemSequenceElement(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("detailSequence")) {
      res.setDetailSequenceElement(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 (!parseBackboneElementContent(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("subDetailSequence")) {
      res.setSubDetailSequenceElement(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 (!parseBackboneElementContent(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("itemSequence")) {
      res.getItemSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detailSequence")) {
      res.getDetailSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subdetailSequence")) {
      res.getSubdetailSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
      res.getProvider().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
      res.setProductOrService(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(parseQuantity(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("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("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(parseClaimResponseAddedItemDetailComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseClaimResponseAddedItemDetailComponentContent(int eventType, XmlPullParser xpp,
      ClaimResponse owner, ClaimResponse.AddedItemDetailComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
      res.setProductOrService(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("quantity")) {
      res.setQuantity(parseQuantity(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("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(parseClaimResponseAddedItemSubDetailComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseClaimResponseAddedItemSubDetailComponentContent(int eventType, XmlPullParser xpp,
      ClaimResponse owner, ClaimResponse.AddedItemSubDetailComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
      res.setProductOrService(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("quantity")) {
      res.setQuantity(parseQuantity(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("noteNumber")) {
      res.getNoteNumber().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseClaimResponseTotalComponentContent(int eventType, XmlPullParser xpp, ClaimResponse owner,
      ClaimResponse.TotalComponent 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("amount")) {
      res.setAmount(parseMoney(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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.setTypeElement(parseEnumeration(xpp, Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
    } 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 (!parseBackboneElementContent(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("claimResponse")) {
      res.setClaimResponse(parseReference(xpp));
    } else if (!parseBackboneElementContent(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("itemSequence")) {
      res.setItemSequenceElement(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detailSequence")) {
      res.setDetailSequenceElement(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetailSequence")) {
      res.setSubDetailSequenceElement(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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("statusReason")) {
      res.setStatusReason(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("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 && 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("supportingInfo")) {
      res.getSupportingInfo().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 (!parseBackboneElementContent(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 && xpp.getName().equals("itemCodeableConcept")) {
      res.setItemCodeableConcept(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("itemReference")) {
      res.setItemReference(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basis")) {
      res.setBasisElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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.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("caseSensitive")) {
      res.setCaseSensitiveElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
      res.setValueSetElement(parseCanonical(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("supplements")) {
      res.setSupplementsElement(parseCanonical(xpp));
    } 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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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("inResponseTo")) {
      res.getInResponseTo().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("statusReason")) {
      res.setStatusReason(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("priority")) {
      res.setPriorityElement(parseEnumeration(xpp, Communication.CommunicationPriority.NULL,
          new Communication.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("topic")) {
      res.setTopic(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("about")) {
      res.getAbout().add(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("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("recipient")) {
      res.getRecipient().add(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("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 (!parseBackboneElementContent(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("statusReason")) {
      res.setStatusReason(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("priority")) {
      res.setPriorityElement(parseEnumeration(xpp, CommunicationRequest.CommunicationPriority.NULL,
          new CommunicationRequest.CommunicationPriorityEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
      res.setDoNotPerformElement(parseBoolean(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("about")) {
      res.getAbout().add(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("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("requester")) {
      res.setRequester(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("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("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 (!parseBackboneElementContent(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("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("purpose")) {
      res.setPurposeElement(parseMarkdown(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 (!parseBackboneElementContent(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("category")) {
      res.getCategory().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("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.setModeElement(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("author")) {
      res.getAuthor().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focus")) {
      res.setFocus(parseReference(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValueElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
      res.setDisplayElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(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.setClinicalStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verificationStatus")) {
      res.setVerificationStatus(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("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("encounter")) {
      res.setEncounter(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("recordedDate")) {
      res.setRecordedDateElement(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("stage")) {
      res.getStage().add(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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.getIdentifier().add(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("scope")) {
      res.setScope(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("patient")) {
      res.setPatient(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("performer")) {
      res.getPerformer().add(parseReference(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.setPolicyRule(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verification")) {
      res.getVerification().add(parseConsentConsentVerificationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provision")) {
      res.setProvision(parseConsentprovisionComponent(xpp, res));
    } else if (!parseDomainResourceContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseConsentConsentVerificationComponentContent(int eventType, XmlPullParser xpp, Consent owner,
      Consent.ConsentVerificationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verified")) {
      res.setVerifiedElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verifiedWith")) {
      res.setVerifiedWith(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verificationDate")) {
      res.setVerificationDateElement(parseDateTime(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseConsentprovisionComponentContent(int eventType, XmlPullParser xpp, Consent owner,
      Consent.provisionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(
          parseEnumeration(xpp, Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
    } 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(parseConsentprovisionActorComponent(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(parseCodeableConcept(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(parseConsentprovisionDataComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provision")) {
      res.getProvision().add(parseConsentprovisionComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseConsentprovisionActorComponentContent(int eventType, XmlPullParser xpp, Consent owner,
      Consent.provisionActorComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseConsentprovisionDataComponentContent(int eventType, XmlPullParser xpp, Consent owner,
      Consent.provisionDataComponent 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 (!parseBackboneElementContent(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.getIdentifier().add(parseIdentifier(xpp));
    } else 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("status")) {
      res.setStatusElement(
          parseEnumeration(xpp, Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("legalState")) {
      res.setLegalState(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesCanonical")) {
      res.setInstantiatesCanonical(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.setInstantiatesUriElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentDerivative")) {
      res.setContentDerivative(parseCodeableConcept(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("expirationType")) {
      res.setExpirationType(parseCodeableConcept(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("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("site")) {
      res.getSite().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("title")) {
      res.setTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtitle")) {
      res.setSubtitleElement(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("author")) {
      res.setAuthor(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scope")) {
      res.setScope(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "topic")) {
      res.setTopic(parseType("topic", 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("contentDefinition")) {
      res.setContentDefinition(parseContractContentDefinitionComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("term")) {
      res.getTerm().add(parseContractTermComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
      res.getSupportingInfo().add(parseReference(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("signer")) {
      res.getSigner().add(parseContractSignatoryComponent(xpp, res));
    } 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 (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "legallyBinding")) {
      res.setLegallyBinding(parseType("legallyBinding", xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseContractContentDefinitionComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.ContentDefinitionComponent 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("subType")) {
      res.setSubType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
      res.setPublisher(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDate")) {
      res.setPublicationDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationStatus")) {
      res.setPublicationStatusElement(parseEnumeration(xpp, Contract.ContractPublicationStatus.NULL,
          new Contract.ContractPublicationStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(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 && nameIsTypeName(xpp, "topic")) {
      res.setTopic(parseType("topic", 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("text")) {
      res.setTextElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
      res.getSecurityLabel().add(parseContractSecurityLabelComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("offer")) {
      res.setOffer(parseContractContractOfferComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("asset")) {
      res.getAsset().add(parseContractContractAssetComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parseContractActionComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
      res.getGroup().add(parseContractTermComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseContractSecurityLabelComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.SecurityLabelComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
      res.getNumber().add(parseUnsignedInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
      res.setClassification(parseCoding(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
      res.getCategory().add(parseCoding(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("control")) {
      res.getControl().add(parseCoding(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseContractContractOfferComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.ContractOfferComponent 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("party")) {
      res.getParty().add(parseContractContractPartyComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
      res.setTopic(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("decision")) {
      res.setDecision(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decisionMode")) {
      res.getDecisionMode().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("answer")) {
      res.getAnswer().add(parseContractAnswerComponent(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("linkId")) {
      res.getLinkId().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabelNumber")) {
      res.getSecurityLabelNumber().add(parseUnsignedInt(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseContractContractPartyComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.ContractPartyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.getReference().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
      res.setRole(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

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

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

  protected boolean parseContractContractAssetComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.ContractAssetComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scope")) {
      res.setScope(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("typeReference")) {
      res.getTypeReference().add(parseReference(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("relationship")) {
      res.setRelationship(parseCoding(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
      res.getContext().add(parseContractAssetContextComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
      res.setConditionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("periodType")) {
      res.getPeriodType().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
      res.getPeriod().add(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usePeriod")) {
      res.getUsePeriod().add(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
      res.setTextElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("linkId")) {
      res.getLinkId().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("answer")) {
      res.getAnswer().add(parseContractAnswerComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabelNumber")) {
      res.getSecurityLabelNumber().add(parseUnsignedInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valuedItem")) {
      res.getValuedItem().add(parseContractValuedItemComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseContractAssetContextComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.AssetContextComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.setReference(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("text")) {
      res.setTextElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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(parseQuantity(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
      res.setPaymentElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paymentDate")) {
      res.setPaymentDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responsible")) {
      res.setResponsible(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
      res.setRecipient(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("linkId")) {
      res.getLinkId().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabelNumber")) {
      res.getSecurityLabelNumber().add(parseUnsignedInt(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseContractActionComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.ActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
      res.setDoNotPerformElement(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("subject")) {
      res.getSubject().add(parseContractActionSubjectComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntent(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("linkId")) {
      res.getLinkId().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
      res.setContext(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contextLinkId")) {
      res.getContextLinkId().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
      res.setOccurrence(parseType("occurrence", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
      res.getRequester().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requesterLinkId")) {
      res.getRequesterLinkId().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performerType")) {
      res.getPerformerType().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performerRole")) {
      res.setPerformerRole(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("performerLinkId")) {
      res.getPerformerLinkId().add(parseString(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("reason")) {
      res.getReason().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonLinkId")) {
      res.getReasonLinkId().add(parseString(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("securityLabelNumber")) {
      res.getSecurityLabelNumber().add(parseUnsignedInt(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseContractActionSubjectComponentContent(int eventType, XmlPullParser xpp, Contract owner,
      Contract.ActionSubjectComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.getReference().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
      res.setRole(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("dependent")) {
      res.setDependentElement(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("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("class")) {
      res.getClass_().add(parseCoverageClassComponent(xpp, res));
    } 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("costToBeneficiary")) {
      res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subrogation")) {
      res.setSubrogationElement(parseBoolean(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.ClassComponent parseCoverageClassComponent(XmlPullParser xpp, Coverage owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    Coverage.ClassComponent res = new Coverage.ClassComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseCoverageClassComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageClassComponentContent(int eventType, XmlPullParser xpp, Coverage owner,
      Coverage.ClassComponent 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("value")) {
      res.setValueElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
      res.setNameElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageCostToBeneficiaryComponentContent(int eventType, XmlPullParser xpp, Coverage owner,
      Coverage.CostToBeneficiaryComponent 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exception")) {
      res.getException().add(parseCoverageExemptionComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageExemptionComponentContent(int eventType, XmlPullParser xpp, Coverage owner,
      Coverage.ExemptionComponent 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("period")) {
      res.setPeriod(parsePeriod(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityRequestContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityRequest 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, CoverageEligibilityRequest.EligibilityRequestStatus.NULL,
          new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
      res.setPriority(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
      res.getPurpose().add(parseEnumeration(xpp, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL,
          new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
    } 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("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("supportingInfo")) {
      res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
      res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityRequestSupportingInformationComponentContent(int eventType,
      XmlPullParser xpp, CoverageEligibilityRequest owner,
      CoverageEligibilityRequest.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("information")) {
      res.setInformation(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appliesToAll")) {
      res.setAppliesToAllElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityRequestInsuranceComponentContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityRequestDetailsComponentContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfoSequence")) {
      res.getSupportingInfoSequence().add(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("productOrService")) {
      res.setProductOrService(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("provider")) {
      res.setProvider(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("unitPrice")) {
      res.setUnitPrice(parseMoney(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("facility")) {
      res.setFacility(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
      res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
      res.getDetail().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityRequestDiagnosisComponentContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "diagnosis")) {
      res.setDiagnosis(parseType("diagnosis", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityResponseContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityResponse 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, CoverageEligibilityResponse.EligibilityResponseStatus.NULL,
          new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
      res.getPurpose().add(parseEnumeration(xpp, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL,
          new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
    } 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("requestor")) {
      res.setRequestor(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.setOutcomeElement(
          parseEnumeration(xpp, Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
    } 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("insurance")) {
      res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthRef")) {
      res.setPreAuthRefElement(parseString(xpp));
    } 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(parseCoverageEligibilityResponseErrorsComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityResponseInsuranceComponentContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityResponse owner, CoverageEligibilityResponse.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("inforce")) {
      res.setInforceElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("benefitPeriod")) {
      res.setBenefitPeriod(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseCoverageEligibilityResponseItemsComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityResponseItemsComponentContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent 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("productOrService")) {
      res.setProductOrService(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("provider")) {
      res.setProvider(parseReference(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("benefit")) {
      res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorizationRequired")) {
      res.setAuthorizationRequiredElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorizationSupporting")) {
      res.getAuthorizationSupporting().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorizationUrl")) {
      res.setAuthorizationUrlElement(parseUri(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityResponseBenefitComponentContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityResponse owner, CoverageEligibilityResponse.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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseCoverageEligibilityResponseErrorsComponentContent(int eventType, XmlPullParser xpp,
      CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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.getIdentifier().add(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("code")) {
      res.setCode(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 && nameIsTypeName(xpp, "identified")) {
      res.setIdentified(parseType("identified", 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("evidence")) {
      res.getEvidence().add(parseDetectedIssueDetectedIssueEvidenceComponent(xpp, res));
    } 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.DetectedIssueEvidenceComponent parseDetectedIssueDetectedIssueEvidenceComponent(
      XmlPullParser xpp, DetectedIssue owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDetectedIssueDetectedIssueEvidenceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDetectedIssueDetectedIssueEvidenceComponentContent(int eventType, XmlPullParser xpp,
      DetectedIssue owner, DetectedIssue.DetectedIssueEvidenceComponent 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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("definition")) {
      res.setDefinition(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udiCarrier")) {
      res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(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("statusReason")) {
      res.getStatusReason().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("distinctIdentifier")) {
      res.setDistinctIdentifierElement(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("lotNumber")) {
      res.setLotNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serialNumber")) {
      res.setSerialNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("deviceName")) {
      res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modelNumber")) {
      res.setModelNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partNumber")) {
      res.setPartNumberElement(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("specialization")) {
      res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.getVersion().add(parseDeviceDeviceVersionComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseDeviceDevicePropertyComponent(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("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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
      res.setParent(parseReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseDeviceDeviceUdiCarrierComponentContent(int eventType, XmlPullParser xpp, Device owner,
      Device.DeviceUdiCarrierComponent 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("issuer")) {
      res.setIssuerElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
      res.setJurisdictionElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("carrierAIDC")) {
      res.setCarrierAIDCElement(parseBase64Binary(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("carrierHRF")) {
      res.setCarrierHRFElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entryType")) {
      res.setEntryTypeElement(parseEnumeration(xpp, Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseDeviceDeviceDeviceNameComponentContent(int eventType, XmlPullParser xpp, Device owner,
      Device.DeviceDeviceNameComponent 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("type")) {
      res.setTypeElement(parseEnumeration(xpp, Device.DeviceNameType.NULL, new Device.DeviceNameTypeEnumFactory()));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseDeviceDeviceSpecializationComponentContent(int eventType, XmlPullParser xpp, Device owner,
      Device.DeviceSpecializationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("systemType")) {
      res.setSystemType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.setVersionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseDeviceDeviceVersionComponentContent(int eventType, XmlPullParser xpp, Device owner,
      Device.DeviceVersionComponent 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("component")) {
      res.setComponent(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValueElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseDeviceDevicePropertyComponentContent(int eventType, XmlPullParser xpp, Device owner,
      Device.DevicePropertyComponent 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("valueQuantity")) {
      res.getValueQuantity().add(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueCode")) {
      res.getValueCode().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseDeviceDefinitionContent(int eventType, XmlPullParser xpp, DeviceDefinition 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("udiDeviceIdentifier")) {
      res.getUdiDeviceIdentifier().add(parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "manufacturer")) {
      res.setManufacturer(parseType("manufacturer", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("deviceName")) {
      res.getDeviceName().add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modelNumber")) {
      res.setModelNumberElement(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("specialization")) {
      res.getSpecialization().add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.getVersion().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("safety")) {
      res.getSafety().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("shelfLifeStorage")) {
      res.getShelfLifeStorage().add(parseProductShelfLife(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("physicalCharacteristics")) {
      res.setPhysicalCharacteristics(parseProdCharacteristic(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("languageCode")) {
      res.getLanguageCode().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("capability")) {
      res.getCapability().add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(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("contact")) {
      res.getContact().add(parseContactPoint(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
      res.setUrlElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onlineInformation")) {
      res.setOnlineInformationElement(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("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parentDevice")) {
      res.setParentDevice(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("material")) {
      res.getMaterial().add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(
      XmlPullParser xpp, DeviceDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentContent(int eventType,
      XmlPullParser xpp, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent 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("issuer")) {
      res.setIssuerElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
      res.setJurisdictionElement(parseUri(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(
      XmlPullParser xpp, DeviceDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDeviceDefinitionDeviceDefinitionDeviceNameComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionDeviceDefinitionDeviceNameComponentContent(int eventType, XmlPullParser xpp,
      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent 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("type")) {
      res.setTypeElement(parseEnumeration(xpp, DeviceDefinition.DeviceNameType.NULL,
          new DeviceDefinition.DeviceNameTypeEnumFactory()));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(
      XmlPullParser xpp, DeviceDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDeviceDefinitionDeviceDefinitionSpecializationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionDeviceDefinitionSpecializationComponentContent(int eventType,
      XmlPullParser xpp, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("systemType")) {
      res.setSystemTypeElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.setVersionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(
      XmlPullParser xpp, DeviceDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDeviceDefinitionDeviceDefinitionCapabilityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionDeviceDefinitionCapabilityComponentContent(int eventType, XmlPullParser xpp,
      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent 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("description")) {
      res.getDescription().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(
      XmlPullParser xpp, DeviceDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDeviceDefinitionDeviceDefinitionPropertyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionDeviceDefinitionPropertyComponentContent(int eventType, XmlPullParser xpp,
      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent 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("valueQuantity")) {
      res.getValueQuantity().add(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueCode")) {
      res.getValueCode().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(
      XmlPullParser xpp, DeviceDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDeviceDefinitionDeviceDefinitionMaterialComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionDeviceDefinitionMaterialComponentContent(int eventType, XmlPullParser xpp,
      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent 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("alternate")) {
      res.setAlternateElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allergenicIndicator")) {
      res.setAllergenicIndicatorElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(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.getIdentifier().add(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 (!parseBackboneElementContent(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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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.setIntentElement(
          parseEnumeration(xpp, DeviceRequest.RequestIntent.NULL, new DeviceRequest.RequestIntentEnumFactory()));
    } 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("parameter")) {
      res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(xpp, res));
    } 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 && 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(parseReference(xpp));
    } 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("insurance")) {
      res.getInsurance().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.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(
      XmlPullParser xpp, DeviceRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDeviceRequestDeviceRequestParameterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceRequestDeviceRequestParameterComponentContent(int eventType, XmlPullParser xpp,
      DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent 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 (!parseBackboneElementContent(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("basedOn")) {
      res.getBasedOn().add(parseReference(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("derivedFrom")) {
      res.getDerivedFrom().add(parseReference(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("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.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.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("encounter")) {
      res.setEncounter(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 && xpp.getName().equals("resultsInterpreter")) {
      res.getResultsInterpreter().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("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("media")) {
      res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(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("conclusionCode")) {
      res.getConclusionCode().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.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(
      XmlPullParser xpp, DiagnosticReport owner) throws XmlPullParserException, IOException, FHIRFormatError {
    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseDiagnosticReportDiagnosticReportMediaComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDiagnosticReportDiagnosticReportMediaComponentContent(int eventType, XmlPullParser xpp,
      DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent 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 (!parseBackboneElementContent(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(parseReference(xpp));
    } 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.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 (!parseBackboneElementContent(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("category")) {
      res.getCategory().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("date")) {
      res.setDateElement(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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.getEncounter().add(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(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseEffectEvidenceSynthesisContent(int eventType, XmlPullParser xpp, EffectEvidenceSynthesis 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("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("note")) {
      res.getNote().add(parseAnnotation(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("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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("synthesisType")) {
      res.setSynthesisType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("studyType")) {
      res.setStudyType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.setPopulation(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposure")) {
      res.setExposure(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposureAlternative")) {
      res.setExposureAlternative(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
      res.setOutcome(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sampleSize")) {
      res.setSampleSize(parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resultsByExposure")) {
      res.getResultsByExposure()
          .add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectEstimate")) {
      res.getEffectEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("certainty")) {
      res.getCertainty().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(
      XmlPullParser xpp, EffectEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentContent(int eventType,
      XmlPullParser xpp, EffectEvidenceSynthesis owner,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent 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("numberOfStudies")) {
      res.setNumberOfStudiesElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfParticipants")) {
      res.setNumberOfParticipantsElement(parseInteger(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(
      XmlPullParser xpp, EffectEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentContent(int eventType,
      XmlPullParser xpp, EffectEvidenceSynthesis owner,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent 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("exposureState")) {
      res.setExposureStateElement(parseEnumeration(xpp, EffectEvidenceSynthesis.ExposureState.NULL,
          new EffectEvidenceSynthesis.ExposureStateEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variantState")) {
      res.setVariantState(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("riskEvidenceSynthesis")) {
      res.setRiskEvidenceSynthesis(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(
      XmlPullParser xpp, EffectEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentContent(int eventType,
      XmlPullParser xpp, EffectEvidenceSynthesis owner,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent 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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variantState")) {
      res.setVariantState(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValueElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitOfMeasure")) {
      res.setUnitOfMeasure(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precisionEstimate")) {
      res.getPrecisionEstimate()
          .add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(
      XmlPullParser xpp, EffectEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentContent(eventType,
          xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentContent(
      int eventType, XmlPullParser xpp, EffectEvidenceSynthesis owner,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent 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("level")) {
      res.setLevelElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("from")) {
      res.setFromElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("to")) {
      res.setToElement(parseDecimal(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(
      XmlPullParser xpp, EffectEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentContent(int eventType,
      XmlPullParser xpp, EffectEvidenceSynthesis owner,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rating")) {
      res.getRating().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("certaintySubcomponent")) {
      res.getCertaintySubcomponent()
          .add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
      XmlPullParser xpp, EffectEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentContent(eventType,
          xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentContent(
      int eventType, XmlPullParser xpp, EffectEvidenceSynthesis owner,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent 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("rating")) {
      res.getRating().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
      res.getNote().add(parseAnnotation(xpp));
    } else if (!parseBackboneElementContent(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("serviceType")) {
      res.setServiceType(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("basedOn")) {
      res.getBasedOn().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.getAppointment().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("length")) {
      res.setLength(parseDuration(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("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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("use")) {
      res.setUse(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rank")) {
      res.setRankElement(parsePositiveInt(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("physicalType")) {
      res.setPhysicalType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
      res.setPeriod(parsePeriod(xpp));
    } else if (!parseBackboneElementContent(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(parseUrl(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("candidate")) {
      res.setCandidate(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.setOutcomeElement(
          parseEnumeration(xpp, Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
    } 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 (!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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseEventDefinitionContent(int eventType, XmlPullParser xpp, EventDefinition 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("subtitle")) {
      res.setSubtitleElement(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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("usage")) {
      res.setUsageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("trigger")) {
      res.getTrigger().add(parseTriggerDefinition(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseEvidenceContent(int eventType, XmlPullParser xpp, Evidence 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("shortTitle")) {
      res.setShortTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtitle")) {
      res.setSubtitleElement(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("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("note")) {
      res.getNote().add(parseAnnotation(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("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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("exposureBackground")) {
      res.setExposureBackground(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposureVariant")) {
      res.getExposureVariant().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
      res.getOutcome().add(parseReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseEvidenceVariableContent(int eventType, XmlPullParser xpp, EvidenceVariable 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("shortTitle")) {
      res.setShortTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtitle")) {
      res.setSubtitleElement(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("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("note")) {
      res.getNote().add(parseAnnotation(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("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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("type")) {
      res.setTypeElement(parseEnumeration(xpp, EvidenceVariable.EvidenceVariableType.NULL,
          new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("characteristic")) {
      res.getCharacteristic().add(parseEvidenceVariableEvidenceVariableCharacteristicComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableEvidenceVariableCharacteristicComponent(
      XmlPullParser xpp, EvidenceVariable owner) throws XmlPullParserException, IOException, FHIRFormatError {
    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseEvidenceVariableEvidenceVariableCharacteristicComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEvidenceVariableEvidenceVariableCharacteristicComponentContent(int eventType,
      XmlPullParser xpp, EvidenceVariable owner, EvidenceVariable.EvidenceVariableCharacteristicComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
      res.setDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "definition")) {
      res.setDefinition(parseType("definition", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usageContext")) {
      res.getUsageContext().add(parseUsageContext(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
      res.setExcludeElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "participantEffective")) {
      res.setParticipantEffective(parseType("participantEffective", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timeFromStart")) {
      res.setTimeFromStart(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupMeasure")) {
      res.setGroupMeasureElement(
          parseEnumeration(xpp, EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseExampleScenarioContent(int eventType, XmlPullParser xpp, ExampleScenario 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("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("copyright")) {
      res.setCopyrightElement(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("actor")) {
      res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
      res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("process")) {
      res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("workflow")) {
      res.getWorkflow().add(parseCanonical(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioActorComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioActorComponentContent(int eventType, XmlPullParser xpp,
      ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actorId")) {
      res.setActorIdElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, ExampleScenario.ExampleScenarioActorType.NULL,
          new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
    } 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(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioInstanceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioInstanceComponentContent(int eventType, XmlPullParser xpp,
      ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceId")) {
      res.setResourceIdElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceType")) {
      res.setResourceTypeElement(parseEnumeration(xpp, ExampleScenario.FHIRResourceType.NULL,
          new ExampleScenario.FHIRResourceTypeEnumFactory()));
    } 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(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("containedInstance")) {
      res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioInstanceVersionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioInstanceVersionComponentContent(int eventType, XmlPullParser xpp,
      ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versionId")) {
      res.setVersionIdElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
      res.setDescriptionElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentContent(int eventType,
      XmlPullParser xpp, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceId")) {
      res.setResourceIdElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versionId")) {
      res.setVersionIdElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioProcessComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioProcessComponentContent(int eventType, XmlPullParser xpp,
      ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent 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("description")) {
      res.setDescriptionElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preConditions")) {
      res.setPreConditionsElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("postConditions")) {
      res.setPostConditionsElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("step")) {
      res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioProcessStepComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioProcessStepComponentContent(int eventType, XmlPullParser xpp,
      ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("process")) {
      res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pause")) {
      res.setPauseElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alternative")) {
      res.getAlternative().add(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioProcessStepOperationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioProcessStepOperationComponentContent(int eventType,
      XmlPullParser xpp, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
      res.setNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(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("initiator")) {
      res.setInitiatorElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("receiver")) {
      res.setReceiverElement(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("initiatorActive")) {
      res.setInitiatorActiveElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("receiverActive")) {
      res.setReceiverActiveElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(
      XmlPullParser xpp, ExampleScenario owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseExampleScenarioExampleScenarioProcessStepAlternativeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioExampleScenarioProcessStepAlternativeComponentContent(int eventType,
      XmlPullParser xpp, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent 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("description")) {
      res.setDescriptionElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("step")) {
      res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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.setSubType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
      res.setUseElement(
          parseEnumeration(xpp, ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.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("priority")) {
      res.setPriority(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fundsReserveRequested")) {
      res.setFundsReserveRequested(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(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("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.setOutcomeElement(parseEnumeration(xpp, ExplanationOfBenefit.RemittanceOutcome.NULL,
          new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
      res.setDispositionElement(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("preAuthRefPeriod")) {
      res.getPreAuthRefPeriod().add(parsePeriod(xpp));
    } 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("supportingInfo")) {
      res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(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.getInsurance().add(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("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("adjudication")) {
      res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
      res.getTotal().add(parseExplanationOfBenefitTotalComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
      res.setPayment(parseExplanationOfBenefitPaymentComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("formCode")) {
      res.setFormCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
      res.setForm(parseAttachment(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("benefitPeriod")) {
      res.setBenefitPeriod(parsePeriod(xpp));
    } 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 (!parseBackboneElementContent(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("party")) {
      res.setParty(parseReference(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("onAdmission")) {
      res.setOnAdmission(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageCode")) {
      res.setPackageCode(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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("type")) {
      res.getType().add(parseCodeableConcept(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
      res.getUdi().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(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("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("preAuthRef")) {
      res.getPreAuthRef().add(parseString(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("careTeamSequence")) {
      res.getCareTeamSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosisSequence")) {
      res.getDiagnosisSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedureSequence")) {
      res.getProcedureSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationSequence")) {
      res.getInformationSequence().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("productOrService")) {
      res.setProductOrService(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(parseQuantity(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("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("productOrService")) {
      res.setProductOrService(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(parseQuantity(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 (!parseBackboneElementContent(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("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("productOrService")) {
      res.setProductOrService(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(parseQuantity(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 (!parseBackboneElementContent(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("itemSequence")) {
      res.getItemSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detailSequence")) {
      res.getDetailSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetailSequence")) {
      res.getSubDetailSequence().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
      res.getProvider().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
      res.setProductOrService(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(parseQuantity(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("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("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(parseExplanationOfBenefitAddedItemDetailComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseExplanationOfBenefitAddedItemDetailComponentContent(int eventType, XmlPullParser xpp,
      ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
      res.setProductOrService(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("quantity")) {
      res.setQuantity(parseQuantity(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("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(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseExplanationOfBenefitAddedItemDetailSubDetailComponentContent(int eventType, XmlPullParser xpp,
      ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
      res.setProductOrService(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("quantity")) {
      res.setQuantity(parseQuantity(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("noteNumber")) {
      res.getNoteNumber().add(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
      res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseExplanationOfBenefitTotalComponentContent(int eventType, XmlPullParser xpp,
      ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent 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("amount")) {
      res.setAmount(parseMoney(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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.setTypeElement(parseEnumeration(xpp, Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
    } 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 (!parseBackboneElementContent(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("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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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("dataAbsentReason")) {
      res.setDataAbsentReason(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("sex")) {
      res.setSex(parseCodeableConcept(xpp));
    } 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 && xpp.getName().equals("contributedToDeath")) {
      res.setContributedToDeathElement(parseBoolean(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 (!parseBackboneElementContent(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.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("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("lifecycleStatus")) {
      res.setLifecycleStatusElement(
          parseEnumeration(xpp, Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("achievementStatus")) {
      res.setAchievementStatus(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("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.getTarget().add(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 (!parseBackboneElementContent(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(parseCanonical(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 (!parseBackboneElementContent(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("params")) {
      res.setParamsElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
      res.setProfileElement(parseCanonical(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 (!parseBackboneElementContent(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("use")) {
      res.setUseElement(parseEnumeration(xpp, GraphDefinition.GraphCompartmentUse.NULL,
          new GraphDefinition.GraphCompartmentUseEnumFactory()));
    } else 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 (!parseBackboneElementContent(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("managingEntity")) {
      res.setManagingEntity(parseReference(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("requestIdentifier")) {
      res.setRequestIdentifier(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
      res.getIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "module")) {
      res.setModule(parseType("module", 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("encounter")) {
      res.setEncounter(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 && 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("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.getCategory().add(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(parseMarkdown(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.getEligibility().add(parseHealthcareServiceHealthcareServiceEligibilityComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("program")) {
      res.getProgram().add(parseCodeableConcept(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("communication")) {
      res.getCommunication().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.HealthcareServiceEligibilityComponent parseHealthcareServiceHealthcareServiceEligibilityComponent(
      XmlPullParser xpp, HealthcareService owner) throws XmlPullParserException, IOException, FHIRFormatError {
    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseHealthcareServiceHealthcareServiceEligibilityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHealthcareServiceHealthcareServiceEligibilityComponentContent(int eventType, XmlPullParser xpp,
      HealthcareService owner, HealthcareService.HealthcareServiceEligibilityComponent 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("comment")) {
      res.setCommentElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("identifier")) {
      res.getIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, ImagingStudy.ImagingStudyStatus.NULL,
          new ImagingStudy.ImagingStudyStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modality")) {
      res.getModality().add(parseCoding(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("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.setProcedureReference(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("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("note")) {
      res.getNote().add(parseAnnotation(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(parseId(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("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("specimen")) {
      res.getSpecimen().add(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("performer")) {
      res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
      res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImagingStudyImagingStudySeriesPerformerComponentContent(int eventType, XmlPullParser xpp,
      ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
      res.setFunction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
      res.setActor(parseReference(xpp));
    } else if (!parseBackboneElementContent(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(parseId(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sopClass")) {
      res.setSopClass(parseCoding(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
      res.setNumberElement(parseUnsignedInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
      res.setTitleElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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("statusReason")) {
      res.setStatusReason(parseCodeableConcept(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 && nameIsTypeName(xpp, "occurrence")) {
      res.setOccurrence(parseType("occurrence", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorded")) {
      res.setRecordedElement(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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
      res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(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("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("isSubpotent")) {
      res.setIsSubpotentElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subpotentReason")) {
      res.getSubpotentReason().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("education")) {
      res.getEducation().add(parseImmunizationImmunizationEducationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programEligibility")) {
      res.getProgramEligibility().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fundingSource")) {
      res.setFundingSource(parseCodeableConcept(xpp));
    } 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("protocolApplied")) {
      res.getProtocolApplied().add(parseImmunizationImmunizationProtocolAppliedComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImmunizationImmunizationPerformerComponentContent(int eventType, XmlPullParser xpp,
      Immunization owner, Immunization.ImmunizationPerformerComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
      res.setFunction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
      res.setActor(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImmunizationImmunizationEducationComponentContent(int eventType, XmlPullParser xpp,
      Immunization owner, Immunization.ImmunizationEducationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentType")) {
      res.setDocumentTypeElement(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("publicationDate")) {
      res.setPublicationDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("presentationDate")) {
      res.setPresentationDateElement(parseDateTime(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImmunizationImmunizationProtocolAppliedComponentContent(int eventType, XmlPullParser xpp,
      Immunization owner, Immunization.ImmunizationProtocolAppliedComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("series")) {
      res.setSeriesElement(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("targetDisease")) {
      res.getTargetDisease().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "doseNumber")) {
      res.setDoseNumber(parseType("doseNumber", xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "seriesDoses")) {
      res.setSeriesDoses(parseType("seriesDoses", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImmunizationEvaluationContent(int eventType, XmlPullParser xpp, ImmunizationEvaluation 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, ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL,
          new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
    } 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("authority")) {
      res.setAuthority(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetDisease")) {
      res.setTargetDisease(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("immunizationEvent")) {
      res.setImmunizationEvent(parseReference(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.getDoseStatusReason().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("series")) {
      res.setSeriesElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "doseNumber")) {
      res.setDoseNumber(parseType("doseNumber", xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "seriesDoses")) {
      res.setSeriesDoses(parseType("seriesDoses", xpp));
    } else if (!parseDomainResourceContent(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("date")) {
      res.setDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authority")) {
      res.setAuthority(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("vaccineCode")) {
      res.getVaccineCode().add(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("contraindicatedVaccineCode")) {
      res.getContraindicatedVaccineCode().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("forecastStatus")) {
      res.setForecastStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("forecastReason")) {
      res.getForecastReason().add(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("description")) {
      res.setDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("series")) {
      res.setSeriesElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "doseNumber")) {
      res.setDoseNumber(parseType("doseNumber", xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "seriesDoses")) {
      res.setSeriesDoses(parseType("seriesDoses", xpp));
    } 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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("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("copyright")) {
      res.setCopyrightElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageId")) {
      res.setPackageIdElement(parseId(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("license")) {
      res.setLicenseElement(parseEnumeration(xpp, ImplementationGuide.SPDXLicense.NULL,
          new ImplementationGuide.SPDXLicenseEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirVersion")) {
      res.getFhirVersion()
          .add(parseEnumeration(xpp, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependsOn")) {
      res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(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("definition")) {
      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manifest")) {
      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideDependsOnComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
      res.setUriElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageId")) {
      res.setPackageIdElement(parseId(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.setVersionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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.setProfileElement(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideDefinitionComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("grouping")) {
      res.getGrouping().add(parseImplementationGuideImplementationGuideDefinitionGroupingComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
      res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("page")) {
      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
      res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("template")) {
      res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideDefinitionGroupingComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner,
      ImplementationGuide.ImplementationGuideDefinitionGroupingComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideDefinitionResourceComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner,
      ImplementationGuide.ImplementationGuideDefinitionResourceComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.setReference(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirVersion")) {
      res.getFhirVersion()
          .add(parseEnumeration(xpp, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
    } 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 && nameIsTypeName(xpp, "example")) {
      res.setExample(parseType("example", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupingId")) {
      res.setGroupingIdElement(parseId(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideDefinitionPageComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "name")) {
      res.setName(parseType("name", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
      res.setTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("generation")) {
      res.setGenerationElement(parseEnumeration(xpp, ImplementationGuide.GuidePageGeneration.NULL,
          new ImplementationGuide.GuidePageGenerationEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("page")) {
      res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideDefinitionParameterComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner,
      ImplementationGuide.ImplementationGuideDefinitionParameterComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCodeElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValueElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideDefinitionTemplateComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner,
      ImplementationGuide.ImplementationGuideDefinitionTemplateComponent 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("source")) {
      res.setSourceElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scope")) {
      res.setScopeElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideImplementationGuideManifestComponentContent(int eventType,
      XmlPullParser xpp, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rendering")) {
      res.setRenderingElement(parseUrl(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
      res.getResource().add(parseImplementationGuideManifestResourceComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("page")) {
      res.getPage().add(parseImplementationGuideManifestPageComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("image")) {
      res.getImage().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other")) {
      res.getOther().add(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideManifestResourceComponentContent(int eventType, XmlPullParser xpp,
      ImplementationGuide owner, ImplementationGuide.ManifestResourceComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.setReference(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "example")) {
      res.setExample(parseType("example", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relativePath")) {
      res.setRelativePathElement(parseUrl(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseImplementationGuideManifestPageComponentContent(int eventType, XmlPullParser xpp,
      ImplementationGuide owner, ImplementationGuide.ManifestPageComponent 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("title")) {
      res.setTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("anchor")) {
      res.getAnchor().add(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseInsurancePlanContent(int eventType, XmlPullParser xpp, InsurancePlan 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, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
    } 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("period")) {
      res.setPeriod(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ownedBy")) {
      res.setOwnedBy(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("administeredBy")) {
      res.setAdministeredBy(parseReference(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("contact")) {
      res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
      res.getEndpoint().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("network")) {
      res.getNetwork().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
      res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("plan")) {
      res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(
      XmlPullParser xpp, InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanInsurancePlanContactComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanInsurancePlanContactComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.InsurancePlanContactComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(
      XmlPullParser xpp, InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanInsurancePlanCoverageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanInsurancePlanCoverageComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.InsurancePlanCoverageComponent 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("network")) {
      res.getNetwork().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("benefit")) {
      res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(XmlPullParser xpp,
      InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanCoverageBenefitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanCoverageBenefitComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.CoverageBenefitComponent 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("requirement")) {
      res.setRequirementElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("limit")) {
      res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(
      XmlPullParser xpp, InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanCoverageBenefitLimitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanCoverageBenefitLimitComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.CoverageBenefitLimitComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValue(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(XmlPullParser xpp,
      InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanInsurancePlanPlanComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanInsurancePlanPlanComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.InsurancePlanPlanComponent 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.setType(parseCodeableConcept(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("network")) {
      res.getNetwork().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("generalCost")) {
      res.getGeneralCost().add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specificCost")) {
      res.getSpecificCost().add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(
      XmlPullParser xpp, InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanInsurancePlanPlanGeneralCostComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanInsurancePlanPlanGeneralCostComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.InsurancePlanPlanGeneralCostComponent 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("groupSize")) {
      res.setGroupSizeElement(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cost")) {
      res.setCost(parseMoney(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
      res.setCommentElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(
      XmlPullParser xpp, InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanInsurancePlanPlanSpecificCostComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanInsurancePlanPlanSpecificCostComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent 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("benefit")) {
      res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(XmlPullParser xpp,
      InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanPlanBenefitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanPlanBenefitComponentContent(int eventType, XmlPullParser xpp, InsurancePlan owner,
      InsurancePlan.PlanBenefitComponent 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("cost")) {
      res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(XmlPullParser xpp,
      InsurancePlan owner) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInsurancePlanPlanBenefitCostComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanPlanBenefitCostComponentContent(int eventType, XmlPullParser xpp,
      InsurancePlan owner, InsurancePlan.PlanBenefitCostComponent 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("applicability")) {
      res.setApplicability(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualifiers")) {
      res.getQualifiers().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValue(parseQuantity(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseInvoiceContent(int eventType, XmlPullParser xpp, Invoice 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, Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cancelledReason")) {
      res.setCancelledReasonElement(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("subject")) {
      res.setSubject(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
      res.setRecipient(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("participant")) {
      res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issuer")) {
      res.setIssuer(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("account")) {
      res.setAccount(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lineItem")) {
      res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalPriceComponent")) {
      res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalNet")) {
      res.setTotalNet(parseMoney(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalGross")) {
      res.setTotalGross(parseMoney(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paymentTerms")) {
      res.setPaymentTermsElement(parseMarkdown(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 Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(XmlPullParser xpp,
      Invoice owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInvoiceInvoiceParticipantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInvoiceInvoiceParticipantComponentContent(int eventType, XmlPullParser xpp, Invoice owner,
      Invoice.InvoiceParticipantComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(XmlPullParser xpp, Invoice owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInvoiceInvoiceLineItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInvoiceInvoiceLineItemComponentContent(int eventType, XmlPullParser xpp, Invoice owner,
      Invoice.InvoiceLineItemComponent 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, "chargeItem")) {
      res.setChargeItem(parseType("chargeItem", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priceComponent")) {
      res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(
      XmlPullParser xpp, Invoice owner) throws XmlPullParserException, IOException, FHIRFormatError {
    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseInvoiceInvoiceLineItemPriceComponentComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInvoiceInvoiceLineItemPriceComponentComponentContent(int eventType, XmlPullParser xpp,
      Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, Invoice.InvoicePriceComponentType.NULL,
          new Invoice.InvoicePriceComponentTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
      res.setFactorElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseMoney(xpp));
    } else if (!parseBackboneElementContent(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("subtitle")) {
      res.setSubtitleElement(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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("usage")) {
      res.setUsageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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.getType().add(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("hoursOfOperation")) {
      res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(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 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseLocationLocationHoursOfOperationComponentContent(int eventType, XmlPullParser xpp,
      Location owner, Location.LocationHoursOfOperationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysOfWeek")) {
      res.getDaysOfWeek().add(parseEnumeration(xpp, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allDay")) {
      res.setAllDayElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("openingTime")) {
      res.setOpeningTimeElement(parseTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("closingTime")) {
      res.setClosingTimeElement(parseTime(xpp));
    } else if (!parseBackboneElementContent(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("subtitle")) {
      res.setSubtitleElement(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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("usage")) {
      res.setUsageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("library")) {
      res.getLibrary().add(parseCanonical(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.setImprovementNotation(parseCodeableConcept(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("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("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("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 (!parseBackboneElementContent(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("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("criteria")) {
      res.setCriteria(parseExpression(xpp));
    } else if (!parseBackboneElementContent(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("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("criteria")) {
      res.setCriteria(parseExpression(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("component")) {
      res.getComponent().add(parseMeasureMeasureGroupStratifierComponentComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMeasureMeasureGroupStratifierComponentComponentContent(int eventType, XmlPullParser xpp,
      Measure owner, Measure.MeasureGroupStratifierComponentComponent 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("description")) {
      res.setDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criteria")) {
      res.setCriteria(parseExpression(xpp));
    } else if (!parseBackboneElementContent(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("code")) {
      res.setCode(parseCodeableConcept(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("description")) {
      res.setDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criteria")) {
      res.setCriteria(parseExpression(xpp));
    } else if (!parseBackboneElementContent(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.getIdentifier().add(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.setMeasureElement(parseCanonical(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("reporter")) {
      res.setReporter(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("improvementNotation")) {
      res.setImprovementNotation(parseCodeableConcept(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("evaluatedResource")) {
      res.getEvaluatedResource().add(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("code")) {
      res.setCode(parseCodeableConcept(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.setMeasureScore(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stratifier")) {
      res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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("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("subjectResults")) {
      res.setSubjectResults(parseReference(xpp));
    } else if (!parseBackboneElementContent(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("code")) {
      res.getCode().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stratum")) {
      res.getStratum().add(parseMeasureReportStratifierGroupComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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.setValue(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("component")) {
      res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(xpp, owner));
    } 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.setMeasureScore(parseQuantity(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMeasureReportStratifierGroupComponentComponentContent(int eventType, XmlPullParser xpp,
      MeasureReport owner, MeasureReport.StratifierGroupComponentComponent 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.setValue(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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("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("subjectResults")) {
      res.setSubjectResults(parseReference(xpp));
    } else if (!parseBackboneElementContent(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("partOf")) {
      res.getPartOf().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, Media.MediaStatus.NULL, new Media.MediaStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modality")) {
      res.setModality(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("encounter")) {
      res.setEncounter(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "created")) {
      res.setCreated(parseType("created", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issued")) {
      res.setIssuedElement(parseInstant(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("deviceName")) {
      res.setDeviceNameElement(parseString(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(parseDecimal(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("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("status")) {
      res.setStatusElement(
          parseEnumeration(xpp, Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
    } 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("amount")) {
      res.setAmount(parseRatio(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("batch")) {
      res.setBatch(parseMedicationMedicationBatchComponent(xpp, res));
    } 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("strength")) {
      res.setStrength(parseRatio(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicationMedicationBatchComponentContent(int eventType, XmlPullParser xpp, Medication owner,
      Medication.MedicationBatchComponent 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 (!parseBackboneElementContent(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("instantiates")) {
      res.getInstantiates().add(parseUri(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("statusReason")) {
      res.getStatusReason().add(parseCodeableConcept(xpp));
    } 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("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("request")) {
      res.setRequest(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("function")) {
      res.setFunction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
      res.setActor(parseReference(xpp));
    } else if (!parseBackboneElementContent(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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "rate")) {
      res.setRate(parseType("rate", xpp));
    } else if (!parseBackboneElementContent(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 && nameIsTypeName(xpp, "statusReason")) {
      res.setStatusReason(parseType("statusReason", xpp));
    } 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("location")) {
      res.setLocation(parseReference(xpp));
    } 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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysSupply")) {
      res.setDaysSupply(parseQuantity(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("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("function")) {
      res.setFunction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
      res.setActor(parseReference(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicationKnowledgeContent(int eventType, XmlPullParser xpp, MedicationKnowledge 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, MedicationKnowledge.MedicationKnowledgeStatus.NULL,
          new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
      res.setManufacturer(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseForm")) {
      res.setDoseForm(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("synonym")) {
      res.getSynonym().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedMedicationKnowledge")) {
      res.getRelatedMedicationKnowledge()
          .add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("associatedMedication")) {
      res.getAssociatedMedication().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productType")) {
      res.getProductType().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monograph")) {
      res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
      res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preparationInstruction")) {
      res.setPreparationInstructionElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intendedRoute")) {
      res.getIntendedRoute().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cost")) {
      res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monitoringProgram")) {
      res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("administrationGuidelines")) {
      res.getAdministrationGuidelines()
          .add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medicineClassification")) {
      res.getMedicineClassification()
          .add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packaging")) {
      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("drugCharacteristic")) {
      res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contraindication")) {
      res.getContraindication().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("regulatory")) {
      res.getRegulatory().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kinetics")) {
      res.getKinetics().add(parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent 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("reference")) {
      res.getReference().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeMonographComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeMonographComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent 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("source")) {
      res.setSource(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeIngredientComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeIngredientComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent 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("strength")) {
      res.setStrength(parseRatio(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeCostComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeCostComponentContent(int eventType, XmlPullParser xpp,
      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent 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("source")) {
      res.setSourceElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cost")) {
      res.setCost(parseMoney(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent 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("name")) {
      res.setNameElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosage")) {
      res.getDosage()
          .add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "indication")) {
      res.setIndication(parseType("indication", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientCharacteristics")) {
      res.getPatientCharacteristics()
          .add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(xpp,
              owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentContent(
      int eventType, XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent 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("dosage")) {
      res.getDosage().add(parseDosage(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentContent(
          eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentContent(
      int eventType, XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "characteristic")) {
      res.setCharacteristic(parseType("characteristic", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.getValue().add(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent 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("classification")) {
      res.getClassification().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgePackagingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgePackagingComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent 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("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("regulatoryAuthority")) {
      res.setRegulatoryAuthority(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substitution")) {
      res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
      res.getSchedule().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDispense")) {
      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent 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("allowed")) {
      res.setAllowedElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
      res.setSchedule(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner,
      MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
      res.setPeriod(parseDuration(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(
      XmlPullParser xpp, MedicationKnowledge owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicationKnowledgeMedicationKnowledgeKineticsComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicationKnowledgeKineticsComponentContent(int eventType,
      XmlPullParser xpp, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticsComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("areaUnderCurve")) {
      res.getAreaUnderCurve().add(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lethalDose50")) {
      res.getLethalDose50().add(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("halfLifePeriod")) {
      res.setHalfLifePeriod(parseDuration(xpp));
    } else if (!parseBackboneElementContent(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("status")) {
      res.setStatusElement(parseEnumeration(xpp, MedicationRequest.MedicationRequestStatus.NULL,
          new MedicationRequest.MedicationRequestStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
      res.setStatusReason(parseCodeableConcept(xpp));
    } 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.getCategory().add(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 && xpp.getName().equals("doNotPerform")) {
      res.setDoNotPerformElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reported")) {
      res.setReported(parseType("reported", 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("encounter")) {
      res.setEncounter(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(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("performerType")) {
      res.setPerformerType(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("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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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("courseOfTherapyType")) {
      res.setCourseOfTherapyType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
      res.getInsurance().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.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("initialFill")) {
      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dispenseInterval")) {
      res.setDispenseInterval(parseDuration(xpp));
    } else 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(parseUnsignedInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(parseQuantity(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentContent(int eventType,
      XmlPullParser xpp, MedicationRequest owner,
      MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
      res.setDuration(parseDuration(xpp));
    } else if (!parseBackboneElementContent(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 && nameIsTypeName(xpp, "allowed")) {
      res.setAllowed(parseType("allowed", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
      res.setReason(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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("status")) {
      res.setStatusElement(parseEnumeration(xpp, MedicationStatement.MedicationStatementStatus.NULL,
          new MedicationStatement.MedicationStatementStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
      res.getStatusReason().add(parseCodeableConcept(xpp));
    } 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 && 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("derivedFrom")) {
      res.getDerivedFrom().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("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 MedicinalProduct parseMedicinalProduct(XmlPullParser xpp)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProduct res = new MedicinalProduct();
    parseDomainResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductContent(int eventType, XmlPullParser xpp, MedicinalProduct 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.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("domain")) {
      res.setDomain(parseCoding(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("combinedPharmaceuticalDoseForm")) {
      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("legalStatusOfSupply")) {
      res.setLegalStatusOfSupply(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalMonitoringIndicator")) {
      res.setAdditionalMonitoringIndicator(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialMeasures")) {
      res.getSpecialMeasures().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paediatricUseIndicator")) {
      res.setPaediatricUseIndicator(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productClassification")) {
      res.getProductClassification().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("marketingStatus")) {
      res.getMarketingStatus().add(parseMarketingStatus(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pharmaceuticalProduct")) {
      res.getPharmaceuticalProduct().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packagedMedicinalProduct")) {
      res.getPackagedMedicinalProduct().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attachedDocument")) {
      res.getAttachedDocument().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("masterFile")) {
      res.getMasterFile().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
      res.getContact().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("clinicalTrial")) {
      res.getClinicalTrial().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
      res.getName().add(parseMedicinalProductMedicinalProductNameComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("crossReference")) {
      res.getCrossReference().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturingBusinessOperation")) {
      res.getManufacturingBusinessOperation()
          .add(parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialDesignation")) {
      res.getSpecialDesignation().add(parseMedicinalProductMedicinalProductSpecialDesignationComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(
      XmlPullParser xpp, MedicinalProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductMedicinalProductNameComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductMedicinalProductNameComponentContent(int eventType, XmlPullParser xpp,
      MedicinalProduct owner, MedicinalProduct.MedicinalProductNameComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productName")) {
      res.setProductNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("namePart")) {
      res.getNamePart().add(parseMedicinalProductMedicinalProductNameNamePartComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("countryLanguage")) {
      res.getCountryLanguage().add(parseMedicinalProductMedicinalProductNameCountryLanguageComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(
      XmlPullParser xpp, MedicinalProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductMedicinalProductNameNamePartComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductMedicinalProductNameNamePartComponentContent(int eventType, XmlPullParser xpp,
      MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("part")) {
      res.setPartElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCoding(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(
      XmlPullParser xpp, MedicinalProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductMedicinalProductNameCountryLanguageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductMedicinalProductNameCountryLanguageComponentContent(int eventType,
      XmlPullParser xpp, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
      res.setCountry(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
      res.setJurisdiction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
      res.setLanguage(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(
      XmlPullParser xpp, MedicinalProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentContent(int eventType,
      XmlPullParser xpp, MedicinalProduct owner,
      MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operationType")) {
      res.setOperationType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorisationReferenceNumber")) {
      res.setAuthorisationReferenceNumber(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectiveDate")) {
      res.setEffectiveDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("confidentialityIndicator")) {
      res.setConfidentialityIndicator(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
      res.getManufacturer().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("regulator")) {
      res.setRegulator(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProduct.MedicinalProductSpecialDesignationComponent parseMedicinalProductMedicinalProductSpecialDesignationComponent(
      XmlPullParser xpp, MedicinalProduct owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProduct.MedicinalProductSpecialDesignationComponent res = new MedicinalProduct.MedicinalProductSpecialDesignationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductMedicinalProductSpecialDesignationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductMedicinalProductSpecialDesignationComponentContent(int eventType,
      XmlPullParser xpp, MedicinalProduct owner, MedicinalProduct.MedicinalProductSpecialDesignationComponent 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.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intendedUse")) {
      res.setIntendedUse(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "indication")) {
      res.setIndication(parseType("indication", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatus(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("species")) {
      res.setSpecies(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductAuthorizationContent(int eventType, XmlPullParser xpp,
      MedicinalProductAuthorization 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("subject")) {
      res.setSubject(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
      res.getCountry().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("status")) {
      res.setStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusDate")) {
      res.setStatusDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("restoreDate")) {
      res.setRestoreDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validityPeriod")) {
      res.setValidityPeriod(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataExclusivityPeriod")) {
      res.setDataExclusivityPeriod(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateOfFirstAuthorization")) {
      res.setDateOfFirstAuthorizationElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("internationalBirthDate")) {
      res.setInternationalBirthDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("legalBasis")) {
      res.setLegalBasis(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdictionalAuthorization")) {
      res.getJurisdictionalAuthorization()
          .add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(xpp,
              res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("holder")) {
      res.setHolder(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("regulator")) {
      res.setRegulator(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(
      XmlPullParser xpp, MedicinalProductAuthorization owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentContent(
          eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductAuthorization owner,
      MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent 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("country")) {
      res.setCountry(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("legalStatusOfSupply")) {
      res.setLegalStatusOfSupply(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validityPeriod")) {
      res.setValidityPeriod(parsePeriod(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(
      XmlPullParser xpp, MedicinalProductAuthorization owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductAuthorization owner,
      MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent 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 && nameIsTypeName(xpp, "date")) {
      res.setDate(parseType("date", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("application")) {
      res.getApplication()
          .add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductContraindicationContent(int eventType, XmlPullParser xpp,
      MedicinalProductContraindication res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
      res.getSubject().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disease")) {
      res.setDisease(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diseaseStatus")) {
      res.setDiseaseStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comorbidity")) {
      res.getComorbidity().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("therapeuticIndication")) {
      res.getTherapeuticIndication().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherTherapy")) {
      res.getOtherTherapy()
          .add(parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.getPopulation().add(parsePopulation(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(
      XmlPullParser xpp, MedicinalProductContraindication owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentContent(eventType,
          xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductContraindication owner,
      MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("therapyRelationshipType")) {
      res.setTherapyRelationshipType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "medication")) {
      res.setMedication(parseType("medication", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductIndicationContent(int eventType, XmlPullParser xpp,
      MedicinalProductIndication res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
      res.getSubject().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diseaseSymptomProcedure")) {
      res.setDiseaseSymptomProcedure(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diseaseStatus")) {
      res.setDiseaseStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comorbidity")) {
      res.getComorbidity().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intendedEffect")) {
      res.setIntendedEffect(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
      res.setDuration(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherTherapy")) {
      res.getOtherTherapy()
          .add(parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("undesirableEffect")) {
      res.getUndesirableEffect().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.getPopulation().add(parsePopulation(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(
      XmlPullParser xpp, MedicinalProductIndication owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res = new MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentContent(int eventType,
      XmlPullParser xpp, MedicinalProductIndication owner,
      MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("therapyRelationshipType")) {
      res.setTherapyRelationshipType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "medication")) {
      res.setMedication(parseType("medication", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductIngredientContent(int eventType, XmlPullParser xpp,
      MedicinalProductIngredient 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("role")) {
      res.setRole(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allergenicIndicator")) {
      res.setAllergenicIndicatorElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
      res.getManufacturer().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specifiedSubstance")) {
      res.getSpecifiedSubstance()
          .add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substance")) {
      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(
      XmlPullParser xpp, MedicinalProductIngredient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductIngredient owner,
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent 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("group")) {
      res.setGroup(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("confidentiality")) {
      res.setConfidentiality(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strength")) {
      res.getStrength().add(
          parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(
      XmlPullParser xpp, MedicinalProductIngredient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentContent(
          eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductIngredient owner,
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("presentation")) {
      res.setPresentation(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("presentationLowLimit")) {
      res.setPresentationLowLimit(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concentration")) {
      res.setConcentration(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concentrationLowLimit")) {
      res.setConcentrationLowLimit(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measurementPoint")) {
      res.setMeasurementPointElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
      res.getCountry().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceStrength")) {
      res.getReferenceStrength().add(
          parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
              xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
      XmlPullParser xpp, MedicinalProductIngredient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentContent(
          eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductIngredient owner,
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent 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("strength")) {
      res.setStrength(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strengthLowLimit")) {
      res.setStrengthLowLimit(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("measurementPoint")) {
      res.setMeasurementPointElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
      res.getCountry().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(
      XmlPullParser xpp, MedicinalProductIngredient owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentContent(int eventType,
      XmlPullParser xpp, MedicinalProductIngredient owner,
      MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent 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("strength")) {
      res.getStrength().add(
          parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductInteractionContent(int eventType, XmlPullParser xpp,
      MedicinalProductInteraction res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
      res.getSubject().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("interactant")) {
      res.getInteractant()
          .add(parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effect")) {
      res.setEffect(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("incidence")) {
      res.setIncidence(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("management")) {
      res.setManagement(parseCodeableConcept(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(
      XmlPullParser xpp, MedicinalProductInteraction owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res = new MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductInteraction owner,
      MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
      res.setItem(parseType("item", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductManufacturedContent(int eventType, XmlPullParser xpp,
      MedicinalProductManufactured res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturedDoseForm")) {
      res.setManufacturedDoseForm(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitOfPresentation")) {
      res.setUnitOfPresentation(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
      res.getManufacturer().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
      res.getIngredient().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("physicalCharacteristics")) {
      res.setPhysicalCharacteristics(parseProdCharacteristic(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherCharacteristics")) {
      res.getOtherCharacteristics().add(parseCodeableConcept(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductPackagedContent(int eventType, XmlPullParser xpp, MedicinalProductPackaged 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("subject")) {
      res.getSubject().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("legalStatusOfSupply")) {
      res.setLegalStatusOfSupply(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("marketingStatus")) {
      res.getMarketingStatus().add(parseMarketingStatus(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("marketingAuthorization")) {
      res.setMarketingAuthorization(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
      res.getManufacturer().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("batchIdentifier")) {
      res.getBatchIdentifier()
          .add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageItem")) {
      res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(
      XmlPullParser xpp, MedicinalProductPackaged owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentContent(int eventType,
      XmlPullParser xpp, MedicinalProductPackaged owner,
      MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outerPackaging")) {
      res.setOuterPackaging(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("immediatePackaging")) {
      res.setImmediatePackaging(parseIdentifier(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(
      XmlPullParser xpp, MedicinalProductPackaged owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentContent(int eventType,
      XmlPullParser xpp, MedicinalProductPackaged owner,
      MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent 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.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("material")) {
      res.getMaterial().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alternateMaterial")) {
      res.getAlternateMaterial().add(parseCodeableConcept(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("manufacturedItem")) {
      res.getManufacturedItem().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packageItem")) {
      res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("physicalCharacteristics")) {
      res.setPhysicalCharacteristics(parseProdCharacteristic(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherCharacteristics")) {
      res.getOtherCharacteristics().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("shelfLifeStorage")) {
      res.getShelfLifeStorage().add(parseProductShelfLife(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturer")) {
      res.getManufacturer().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductPharmaceuticalContent(int eventType, XmlPullParser xpp,
      MedicinalProductPharmaceutical 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("administrableDoseForm")) {
      res.setAdministrableDoseForm(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitOfPresentation")) {
      res.setUnitOfPresentation(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
      res.getIngredient().add(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("characteristics")) {
      res.getCharacteristics()
          .add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("routeOfAdministration")) {
      res.getRouteOfAdministration().add(
          parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(
      XmlPullParser xpp, MedicinalProductPharmaceutical owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentContent(eventType,
          xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductPharmaceutical owner,
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent 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.setStatus(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(
      XmlPullParser xpp, MedicinalProductPharmaceutical owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentContent(
          eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductPharmaceutical owner,
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent 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("firstDose")) {
      res.setFirstDose(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxSingleDose")) {
      res.setMaxSingleDose(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerDay")) {
      res.setMaxDosePerDay(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerTreatmentPeriod")) {
      res.setMaxDosePerTreatmentPeriod(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxTreatmentPeriod")) {
      res.setMaxTreatmentPeriod(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetSpecies")) {
      res.getTargetSpecies().add(
          parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
              xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
      XmlPullParser xpp, MedicinalProductPharmaceutical owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentContent(
          eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductPharmaceutical owner,
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent 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("withdrawalPeriod")) {
      res.getWithdrawalPeriod().add(
          parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
              xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
      XmlPullParser xpp, MedicinalProductPharmaceutical owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentContent(
          eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentContent(
      int eventType, XmlPullParser xpp, MedicinalProductPharmaceutical owner,
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tissue")) {
      res.setTissue(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValue(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
      res.setSupportingInformationElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMedicinalProductUndesirableEffectContent(int eventType, XmlPullParser xpp,
      MedicinalProductUndesirableEffect res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
      res.getSubject().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("symptomConditionEffect")) {
      res.setSymptomConditionEffect(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
      res.setClassification(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequencyOfOccurrence")) {
      res.setFrequencyOfOccurrence(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.getPopulation().add(parsePopulation(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.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("replaces")) {
      res.getReplaces().add(parseCanonical(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.setBaseElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
      res.getParent().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "event")) {
      res.setEvent(parseType("event", 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(parseEnumeration(xpp, MessageDefinition.MessageheaderResponseRequest.NULL,
          new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allowedResponse")) {
      res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("graph")) {
      res.getGraph().add(parseCanonical(xpp));
    } 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.setProfileElement(parseCanonical(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 (!parseBackboneElementContent(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.setMessageElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("situation")) {
      res.setSituationElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(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 && nameIsTypeName(xpp, "event")) {
      res.setEvent(parseType("event", 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("sender")) {
      res.setSender(parseReference(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
      res.setDefinitionElement(parseCanonical(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(parseUrl(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("receiver")) {
      res.setReceiver(parseReference(xpp));
    } else if (!parseBackboneElementContent(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(parseUrl(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseMolecularSequenceContent(int eventType, XmlPullParser xpp, MolecularSequence 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, MolecularSequence.SequenceType.NULL, new MolecularSequence.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(parseMolecularSequenceMolecularSequenceReferenceSeqComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variant")) {
      res.getVariant().add(parseMolecularSequenceMolecularSequenceVariantComponent(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(parseMolecularSequenceMolecularSequenceQualityComponent(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(parseMolecularSequenceMolecularSequenceRepositoryComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pointer")) {
      res.getPointer().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("structureVariant")) {
      res.getStructureVariant().add(parseMolecularSequenceMolecularSequenceStructureVariantComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceMolecularSequenceReferenceSeqComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceReferenceSeqComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceReferenceSeqComponentContent(int eventType,
      XmlPullParser xpp, MolecularSequence owner, MolecularSequence.MolecularSequenceReferenceSeqComponent 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("orientation")) {
      res.setOrientationElement(parseEnumeration(xpp, MolecularSequence.OrientationType.NULL,
          new MolecularSequence.OrientationTypeEnumFactory()));
    } 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(
          parseEnumeration(xpp, MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
    } 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceMolecularSequenceVariantComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceVariantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceVariantComponentContent(int eventType, XmlPullParser xpp,
      MolecularSequence owner, MolecularSequence.MolecularSequenceVariantComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceMolecularSequenceQualityComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceQualityComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceQualityComponentContent(int eventType, XmlPullParser xpp,
      MolecularSequence owner, MolecularSequence.MolecularSequenceQualityComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(
          parseEnumeration(xpp, MolecularSequence.QualityType.NULL, new MolecularSequence.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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("roc")) {
      res.setRoc(parseMolecularSequenceMolecularSequenceQualityRocComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceMolecularSequenceQualityRocComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceQualityRocComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceQualityRocComponentContent(int eventType, XmlPullParser xpp,
      MolecularSequence owner, MolecularSequence.MolecularSequenceQualityRocComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("score")) {
      res.getScore().add(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numTP")) {
      res.getNumTP().add(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numFP")) {
      res.getNumFP().add(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numFN")) {
      res.getNumFN().add(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precision")) {
      res.getPrecision().add(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sensitivity")) {
      res.getSensitivity().add(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fMeasure")) {
      res.getFMeasure().add(parseDecimal(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceMolecularSequenceRepositoryComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceRepositoryComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceRepositoryComponentContent(int eventType, XmlPullParser xpp,
      MolecularSequence owner, MolecularSequence.MolecularSequenceRepositoryComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, MolecularSequence.RepositoryType.NULL,
          new MolecularSequence.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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceMolecularSequenceStructureVariantComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceStructureVariantComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceStructureVariantComponentContent(int eventType,
      XmlPullParser xpp, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variantType")) {
      res.setVariantType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exact")) {
      res.setExactElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("length")) {
      res.setLengthElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outer")) {
      res.setOuter(parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inner")) {
      res.setInner(parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentContent(int eventType,
      XmlPullParser xpp, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantOuterComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(
      XmlPullParser xpp, MolecularSequence owner) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentContent(int eventType,
      XmlPullParser xpp, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantInnerComponent 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 (!parseBackboneElementContent(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 (!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 (!parseBackboneElementContent(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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiates")) {
      res.getInstantiates().add(parseUri(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("intent")) {
      res.setIntentElement(parseEnumeration(xpp, NutritionOrder.NutritiionOrderIntent.NULL,
          new NutritionOrder.NutritiionOrderIntentEnumFactory()));
    } 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
      res.getNote().add(parseAnnotation(xpp));
    } 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 (!parseBackboneElementContent(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(parseQuantity(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instruction")) {
      res.setInstructionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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(parseQuantity(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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("administrationInstruction")) {
      res.setAdministrationInstructionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "rate")) {
      res.setRate(parseType("rate", xpp));
    } else if (!parseBackboneElementContent(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("partOf")) {
      res.getPartOf().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("focus")) {
      res.getFocus().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
      res.setEncounter(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.getInterpretation().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("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("hasMember")) {
      res.getHasMember().add(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("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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("high")) {
      res.setHigh(parseQuantity(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 (!parseBackboneElementContent(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.getInterpretation().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceRange")) {
      res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseObservationDefinitionContent(int eventType, XmlPullParser xpp, ObservationDefinition res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    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("identifier")) {
      res.getIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("permittedDataType")) {
      res.getPermittedDataType().add(parseEnumeration(xpp, ObservationDefinition.ObservationDataType.NULL,
          new ObservationDefinition.ObservationDataTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("multipleResultsAllowed")) {
      res.setMultipleResultsAllowedElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
      res.setMethod(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preferredReportName")) {
      res.setPreferredReportNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantitativeDetails")) {
      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualifiedInterval")) {
      res.getQualifiedInterval()
          .add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validCodedValueSet")) {
      res.setValidCodedValueSet(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("normalCodedValueSet")) {
      res.setNormalCodedValueSet(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abnormalCodedValueSet")) {
      res.setAbnormalCodedValueSet(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criticalCodedValueSet")) {
      res.setCriticalCodedValueSet(parseReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(
      XmlPullParser xpp, ObservationDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentContent(int eventType,
      XmlPullParser xpp, ObservationDefinition owner,
      ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("customaryUnit")) {
      res.setCustomaryUnit(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("conversionFactor")) {
      res.setConversionFactorElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decimalPrecision")) {
      res.setDecimalPrecisionElement(parseInteger(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(
      XmlPullParser xpp, ObservationDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentContent(int eventType,
      XmlPullParser xpp, ObservationDefinition owner,
      ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
      res.setCategoryElement(parseEnumeration(xpp, ObservationDefinition.ObservationRangeCategory.NULL,
          new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("range")) {
      res.setRange(parseRange(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
      res.setContext(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("gender")) {
      res.setGenderElement(parseEnumeration(xpp, Enumerations.AdministrativeGender.NULL,
          new Enumerations.AdministrativeGenderEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("age")) {
      res.setAge(parseRange(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gestationalAge")) {
      res.setGestationalAge(parseRange(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
      res.setConditionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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("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("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("affectsState")) {
      res.setAffectsStateElement(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(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
      res.setBaseElement(parseCanonical(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("inputProfile")) {
      res.setInputProfileElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outputProfile")) {
      res.setOutputProfileElement(parseCanonical(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("targetProfile")) {
      res.getTargetProfile().add(parseCanonical(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("binding")) {
      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referencedFrom")) {
      res.getReferencedFrom()
          .add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("part")) {
      res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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 && xpp.getName().equals("valueSet")) {
      res.setValueSetElement(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentContent(int eventType,
      XmlPullParser xpp, OperationDefinition owner,
      OperationDefinition.OperationDefinitionParameterReferencedFromComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.setSourceElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceId")) {
      res.setSourceIdElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseOrganizationAffiliationContent(int eventType, XmlPullParser xpp, OrganizationAffiliation 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("organization")) {
      res.setOrganization(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participatingOrganization")) {
      res.setParticipatingOrganization(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("network")) {
      res.getNetwork().add(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("endpoint")) {
      res.getEndpoint().add(parseReference(xpp));
    } else if (!parseDomainResourceContent(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("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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("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("payment")) {
      res.setPayment(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paymentDate")) {
      res.setPaymentDateElement(parseDate(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payee")) {
      res.setPayee(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
      res.setRecipient(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseMoney(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("paymentIssuer")) {
      res.setPaymentIssuer(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("requestor")) {
      res.setRequestor(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
      res.setOutcomeElement(
          parseEnumeration(xpp, Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
      res.setDispositionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paymentDate")) {
      res.setPaymentDateElement(parseDate(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paymentAmount")) {
      res.setPaymentAmount(parseMoney(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paymentIdentifier")) {
      res.setPaymentIdentifier(parseIdentifier(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("formCode")) {
      res.setFormCode(parseCodeableConcept(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("identifier")) {
      res.setIdentifier(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("predecessor")) {
      res.setPredecessor(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("request")) {
      res.setRequest(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("response")) {
      res.setResponse(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("responsible")) {
      res.setResponsible(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("amount")) {
      res.setAmount(parseMoney(xpp));
    } else if (!parseBackboneElementContent(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.setTypeElement(parseEnumeration(xpp, Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
      res.setTextElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("subtitle")) {
      res.setSubtitleElement(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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("usage")) {
      res.setUsageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("library")) {
      res.getLibrary().add(parseCanonical(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("prefix")) {
      res.setPrefixElement(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("priority")) {
      res.setPriorityElement(
          parseEnumeration(xpp, PlanDefinition.RequestPriority.NULL, new PlanDefinition.RequestPriorityEnumFactory()));
    } 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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("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(parseCodeableConcept(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 && nameIsTypeName(xpp, "definition")) {
      res.setDefinition(parseType("definition", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("transform")) {
      res.setTransformElement(parseCanonical(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 (!parseBackboneElementContent(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("expression")) {
      res.setExpression(parseExpression(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("path")) {
      res.setPathElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
      res.setExpression(parseExpression(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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("statusReason")) {
      res.setStatusReason(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("encounter")) {
      res.setEncounter(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("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("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("function")) {
      res.setFunction(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 && nameIsTypeName(xpp, "occurred")) {
      res.setOccurred(parseType("occurred", 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(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activity")) {
      res.setActivity(parseCodeableConcept(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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
      res.getRole().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("who")) {
      res.setWho(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
      res.setOnBehalfOf(parseReference(xpp));
    } else if (!parseBackboneElementContent(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 && xpp.getName().equals("what")) {
      res.setWhat(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
      res.getAgent().add(parseProvenanceProvenanceAgentComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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("derivedFrom")) {
      res.getDerivedFrom().add(parseCanonical(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("subjectType")) {
      res.getSubjectType().add(parseCode(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("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("code")) {
      res.getCode().add(parseCoding(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("enableBehavior")) {
      res.setEnableBehaviorElement(parseEnumeration(xpp, Questionnaire.EnableWhenBehavior.NULL,
          new Questionnaire.EnableWhenBehaviorEnumFactory()));
    } 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("answerValueSet")) {
      res.setAnswerValueSetElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("answerOption")) {
      res.getAnswerOption().add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("initial")) {
      res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(xpp, owner));
    } else if (!parseBackboneElementContent(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("operator")) {
      res.setOperatorElement(parseEnumeration(xpp, Questionnaire.QuestionnaireItemOperator.NULL,
          new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "answer")) {
      res.setAnswer(parseType("answer", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseQuestionnaireQuestionnaireItemAnswerOptionComponentContent(int eventType, XmlPullParser xpp,
      Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent 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("initialSelected")) {
      res.setInitialSelectedElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseQuestionnaireQuestionnaireItemInitialComponentContent(int eventType, XmlPullParser xpp,
      Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
      res.setValue(parseType("value", xpp));
    } else if (!parseBackboneElementContent(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("partOf")) {
      res.getPartOf().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("questionnaire")) {
      res.setQuestionnaireElement(parseCanonical(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("encounter")) {
      res.setEncounter(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("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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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.getRelationship().add(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("communication")) {
      res.getCommunication().add(parseRelatedPersonRelatedPersonCommunicationComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonRelatedPersonCommunicationComponent(
      XmlPullParser xpp, RelatedPerson owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseRelatedPersonRelatedPersonCommunicationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRelatedPersonRelatedPersonCommunicationComponentContent(int eventType, XmlPullParser xpp,
      RelatedPerson owner, RelatedPerson.RelatedPersonCommunicationComponent 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 (!parseBackboneElementContent(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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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("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("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 && 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("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("prefix")) {
      res.setPrefixElement(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("priority")) {
      res.setPriorityElement(
          parseEnumeration(xpp, RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
    } 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(parseCodeableConcept(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 (!parseBackboneElementContent(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("expression")) {
      res.setExpression(parseExpression(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseResearchDefinitionContent(int eventType, XmlPullParser xpp, ResearchDefinition 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("shortTitle")) {
      res.setShortTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtitle")) {
      res.setSubtitleElement(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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("comment")) {
      res.getComment().add(parseString(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("usage")) {
      res.setUsageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("library")) {
      res.getLibrary().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.setPopulation(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposure")) {
      res.setExposure(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposureAlternative")) {
      res.setExposureAlternative(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
      res.setOutcome(parseReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseResearchElementDefinitionContent(int eventType, XmlPullParser xpp,
      ResearchElementDefinition 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("shortTitle")) {
      res.setShortTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtitle")) {
      res.setSubtitleElement(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 && nameIsTypeName(xpp, "subject")) {
      res.setSubject(parseType("subject", 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("comment")) {
      res.getComment().add(parseString(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("usage")) {
      res.setUsageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
      res.setCopyrightElement(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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("library")) {
      res.getLibrary().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, ResearchElementDefinition.ResearchElementType.NULL,
          new ResearchElementDefinition.ResearchElementTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variableType")) {
      res.setVariableTypeElement(parseEnumeration(xpp, ResearchElementDefinition.VariableType.NULL,
          new ResearchElementDefinition.VariableTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("characteristic")) {
      res.getCharacteristic()
          .add(parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(
      XmlPullParser xpp, ResearchElementDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res = new ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentContent(int eventType,
      XmlPullParser xpp, ResearchElementDefinition owner,
      ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "definition")) {
      res.setDefinition(parseType("definition", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usageContext")) {
      res.getUsageContext().add(parseUsageContext(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
      res.setExcludeElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitOfMeasure")) {
      res.setUnitOfMeasure(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("studyEffectiveDescription")) {
      res.setStudyEffectiveDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "studyEffective")) {
      res.setStudyEffective(parseType("studyEffective", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("studyEffectiveTimeFromStart")) {
      res.setStudyEffectiveTimeFromStart(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("studyEffectiveGroupMeasure")) {
      res.setStudyEffectiveGroupMeasureElement(parseEnumeration(xpp, ResearchElementDefinition.GroupMeasure.NULL,
          new ResearchElementDefinition.GroupMeasureEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participantEffectiveDescription")) {
      res.setParticipantEffectiveDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "participantEffective")) {
      res.setParticipantEffective(parseType("participantEffective", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participantEffectiveTimeFromStart")) {
      res.setParticipantEffectiveTimeFromStart(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participantEffectiveGroupMeasure")) {
      res.setParticipantEffectiveGroupMeasureElement(parseEnumeration(xpp, ResearchElementDefinition.GroupMeasure.NULL,
          new ResearchElementDefinition.GroupMeasureEnumFactory()));
    } else if (!parseBackboneElementContent(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("primaryPurposeType")) {
      res.setPrimaryPurposeType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("phase")) {
      res.setPhase(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("focus")) {
      res.getFocus().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
      res.getCondition().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("location")) {
      res.getLocation().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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("objective")) {
      res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
      res.setDescriptionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(
      XmlPullParser xpp, ResearchStudy owner) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseResearchStudyResearchStudyObjectiveComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseResearchStudyResearchStudyObjectiveComponentContent(int eventType, XmlPullParser xpp,
      ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent 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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(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.getIdentifier().add(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.getIdentifier().add(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("encounter")) {
      res.setEncounter(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 && 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("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("note")) {
      res.getNote().add(parseAnnotation(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseRiskEvidenceSynthesisContent(int eventType, XmlPullParser xpp, RiskEvidenceSynthesis 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("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("note")) {
      res.getNote().add(parseAnnotation(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("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("topic")) {
      res.getTopic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
      res.getEditor().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
      res.getReviewer().add(parseContactDetail(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
      res.getEndorser().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("synthesisType")) {
      res.setSynthesisType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("studyType")) {
      res.setStudyType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.setPopulation(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposure")) {
      res.setExposure(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
      res.setOutcome(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sampleSize")) {
      res.setSampleSize(parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("riskEstimate")) {
      res.setRiskEstimate(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("certainty")) {
      res.getCertainty().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(
      XmlPullParser xpp, RiskEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentContent(int eventType,
      XmlPullParser xpp, RiskEvidenceSynthesis owner,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent 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("numberOfStudies")) {
      res.setNumberOfStudiesElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfParticipants")) {
      res.setNumberOfParticipantsElement(parseInteger(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(
      XmlPullParser xpp, RiskEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentContent(int eventType,
      XmlPullParser xpp, RiskEvidenceSynthesis owner,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent 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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
      res.setValueElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitOfMeasure")) {
      res.setUnitOfMeasure(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("denominatorCount")) {
      res.setDenominatorCountElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numeratorCount")) {
      res.setNumeratorCountElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precisionEstimate")) {
      res.getPrecisionEstimate()
          .add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(
      XmlPullParser xpp, RiskEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentContent(
      int eventType, XmlPullParser xpp, RiskEvidenceSynthesis owner,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent 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("level")) {
      res.setLevelElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("from")) {
      res.setFromElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("to")) {
      res.setToElement(parseDecimal(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(
      XmlPullParser xpp, RiskEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentContent(int eventType,
      XmlPullParser xpp, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rating")) {
      res.getRating().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("certaintySubcomponent")) {
      res.getCertaintySubcomponent()
          .add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
      XmlPullParser xpp, RiskEvidenceSynthesis owner) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentContent(
      int eventType, XmlPullParser xpp, RiskEvidenceSynthesis owner,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent 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("rating")) {
      res.getRating().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
      res.getNote().add(parseAnnotation(xpp));
    } else if (!parseBackboneElementContent(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.getServiceCategory().add(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("derivedFrom")) {
      res.setDerivedFromElement(parseCanonical(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("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("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("multipleOr")) {
      res.setMultipleOrElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("multipleAnd")) {
      res.setMultipleAndElement(parseBoolean(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.setDefinitionElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
      res.setExpressionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseServiceRequestContent(int eventType, XmlPullParser xpp, ServiceRequest 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("instantiatesCanonical")) {
      res.getInstantiatesCanonical().add(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.getInstantiatesUri().add(parseUri(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, ServiceRequest.ServiceRequestStatus.NULL,
          new ServiceRequest.ServiceRequestStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntentElement(parseEnumeration(xpp, ServiceRequest.ServiceRequestIntent.NULL,
          new ServiceRequest.ServiceRequestIntentEnumFactory()));
    } 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, ServiceRequest.ServiceRequestPriority.NULL,
          new ServiceRequest.ServiceRequestPriorityEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
      res.setDoNotPerformElement(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("orderDetail")) {
      res.getOrderDetail().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "quantity")) {
      res.setQuantity(parseType("quantity", 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 && 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(parseReference(xpp));
    } 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.getPerformer().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("locationCode")) {
      res.getLocationCode().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("locationReference")) {
      res.getLocationReference().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("insurance")) {
      res.getInsurance().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("patientInstruction")) {
      res.setPatientInstructionElement(parseString(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 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.getServiceCategory().add(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("condition")) {
      res.getCondition().add(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 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("duration")) {
      res.setDuration(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(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("bodySite")) {
      res.setBodySite(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "fastingStatus")) {
      res.setFastingStatus(parseType("fastingStatus", xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specimenQuantity")) {
      res.setSpecimenQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "additive")) {
      res.setAdditive(parseType("additive", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseSpecimenDefinitionContent(int eventType, XmlPullParser xpp, SpecimenDefinition 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("typeCollected")) {
      res.setTypeCollected(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientPreparation")) {
      res.getPatientPreparation().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timeAspect")) {
      res.setTimeAspectElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collection")) {
      res.getCollection().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("typeTested")) {
      res.getTypeTested().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(
      XmlPullParser xpp, SpecimenDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentContent(int eventType,
      XmlPullParser xpp, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isDerived")) {
      res.setIsDerivedElement(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("preference")) {
      res.setPreferenceElement(parseEnumeration(xpp, SpecimenDefinition.SpecimenContainedPreference.NULL,
          new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("container")) {
      res.setContainer(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requirement")) {
      res.setRequirementElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("retentionTime")) {
      res.setRetentionTime(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rejectionCriterion")) {
      res.getRejectionCriterion().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("handling")) {
      res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(
      XmlPullParser xpp, SpecimenDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentContent(int eventType,
      XmlPullParser xpp, SpecimenDefinition owner,
      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("material")) {
      res.setMaterial(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cap")) {
      res.setCap(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("capacity")) {
      res.setCapacity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "minimumVolume")) {
      res.setMinimumVolume(parseType("minimumVolume", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additive")) {
      res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preparation")) {
      res.setPreparationElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(
      XmlPullParser xpp, SpecimenDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentContent(int eventType,
      XmlPullParser xpp, SpecimenDefinition owner,
      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "additive")) {
      res.setAdditive(parseType("additive", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(
      XmlPullParser xpp, SpecimenDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentContent(int eventType,
      XmlPullParser xpp, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("temperatureQualifier")) {
      res.setTemperatureQualifier(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("temperatureRange")) {
      res.setTemperatureRange(parseRange(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDuration")) {
      res.setMaxDuration(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instruction")) {
      res.setInstructionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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(
          parseEnumeration(xpp, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
    } 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("context")) {
      res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(xpp, res));
    } 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(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("baseDefinition")) {
      res.setBaseDefinitionElement(parseCanonical(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(
      XmlPullParser xpp, StructureDefinition owner) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseStructureDefinitionStructureDefinitionContextComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionStructureDefinitionContextComponentContent(int eventType, XmlPullParser xpp,
      StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, StructureDefinition.ExtensionContextType.NULL,
          new StructureDefinition.ExtensionContextTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
      res.setExpressionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseCanonical(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(parseCanonical(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("logMessage")) {
      res.setLogMessageElement(parseString(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!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(parseUrl(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payload")) {
      res.setPayloadElement(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("header")) {
      res.getHeader().add(parseString(xpp));
    } else if (!parseBackboneElementContent(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(parseQuantity(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseSubstanceNucleicAcidContent(int eventType, XmlPullParser xpp, SubstanceNucleicAcid res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceType")) {
      res.setSequenceType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfSubunits")) {
      res.setNumberOfSubunitsElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("areaOfHybridisation")) {
      res.setAreaOfHybridisationElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("oligoNucleotideType")) {
      res.setOligoNucleotideType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subunit")) {
      res.getSubunit().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(
      XmlPullParser xpp, SubstanceNucleicAcid owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentContent(int eventType,
      XmlPullParser xpp, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subunit")) {
      res.setSubunitElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
      res.setSequenceElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("length")) {
      res.setLengthElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceAttachment")) {
      res.setSequenceAttachment(parseAttachment(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fivePrime")) {
      res.setFivePrime(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("threePrime")) {
      res.setThreePrime(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("linkage")) {
      res.getLinkage().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sugar")) {
      res.getSugar().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(
      XmlPullParser xpp, SubstanceNucleicAcid owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentContent(int eventType,
      XmlPullParser xpp, SubstanceNucleicAcid owner,
      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("connectivity")) {
      res.setConnectivityElement(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("name")) {
      res.setNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("residueSite")) {
      res.setResidueSiteElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(
      XmlPullParser xpp, SubstanceNucleicAcid owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentContent(int eventType,
      XmlPullParser xpp, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent 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("residueSite")) {
      res.setResidueSiteElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseSubstancePolymerContent(int eventType, XmlPullParser xpp, SubstancePolymer res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
      res.setClass_(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("geometry")) {
      res.setGeometry(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copolymerConnectivity")) {
      res.getCopolymerConnectivity().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modification")) {
      res.getModification().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monomerSet")) {
      res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeat")) {
      res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(
      XmlPullParser xpp, SubstancePolymer owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstancePolymerSubstancePolymerMonomerSetComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerSubstancePolymerMonomerSetComponentContent(int eventType, XmlPullParser xpp,
      SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ratioType")) {
      res.setRatioType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("startingMaterial")) {
      res.getStartingMaterial()
          .add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(
      XmlPullParser xpp, SubstancePolymer owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentContent(int eventType,
      XmlPullParser xpp, SubstancePolymer owner,
      SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("material")) {
      res.setMaterial(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isDefining")) {
      res.setIsDefiningElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseSubstanceAmount(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(
      XmlPullParser xpp, SubstancePolymer owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstancePolymerSubstancePolymerRepeatComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerSubstancePolymerRepeatComponentContent(int eventType, XmlPullParser xpp,
      SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfUnits")) {
      res.setNumberOfUnitsElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("averageMolecularFormula")) {
      res.setAverageMolecularFormulaElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeatUnitAmountType")) {
      res.setRepeatUnitAmountType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeatUnit")) {
      res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(
      XmlPullParser xpp, SubstancePolymer owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentContent(int eventType,
      XmlPullParser xpp, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orientationOfPolymerisation")) {
      res.setOrientationOfPolymerisation(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeatUnit")) {
      res.setRepeatUnitElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseSubstanceAmount(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("degreeOfPolymerisation")) {
      res.getDegreeOfPolymerisation()
          .add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("structuralRepresentation")) {
      res.getStructuralRepresentation()
          .add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(
      XmlPullParser xpp, SubstancePolymer owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentContent(
      int eventType, XmlPullParser xpp, SubstancePolymer owner,
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("degree")) {
      res.setDegree(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseSubstanceAmount(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(
      XmlPullParser xpp, SubstancePolymer owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentContent(
      int eventType, XmlPullParser xpp, SubstancePolymer owner,
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent 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("representation")) {
      res.setRepresentationElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attachment")) {
      res.setAttachment(parseAttachment(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseSubstanceProteinContent(int eventType, XmlPullParser xpp, SubstanceProtein res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceType")) {
      res.setSequenceType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfSubunits")) {
      res.setNumberOfSubunitsElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disulfideLinkage")) {
      res.getDisulfideLinkage().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subunit")) {
      res.getSubunit().add(parseSubstanceProteinSubstanceProteinSubunitComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubstanceProteinSubunitComponent(
      XmlPullParser xpp, SubstanceProtein owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceProteinSubstanceProteinSubunitComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceProteinSubstanceProteinSubunitComponentContent(int eventType, XmlPullParser xpp,
      SubstanceProtein owner, SubstanceProtein.SubstanceProteinSubunitComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subunit")) {
      res.setSubunitElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
      res.setSequenceElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("length")) {
      res.setLengthElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequenceAttachment")) {
      res.setSequenceAttachment(parseAttachment(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nTerminalModificationId")) {
      res.setNTerminalModificationId(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nTerminalModification")) {
      res.setNTerminalModificationElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cTerminalModificationId")) {
      res.setCTerminalModificationId(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cTerminalModification")) {
      res.setCTerminalModificationElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseSubstanceReferenceInformationContent(int eventType, XmlPullParser xpp,
      SubstanceReferenceInformation 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("gene")) {
      res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("geneElement")) {
      res.getGeneElement()
          .add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
      res.getClassification()
          .add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
      res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(
      XmlPullParser xpp, SubstanceReferenceInformation owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentContent(int eventType,
      XmlPullParser xpp, SubstanceReferenceInformation owner,
      SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("geneSequenceOrigin")) {
      res.setGeneSequenceOrigin(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gene")) {
      res.setGene(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(
      XmlPullParser xpp, SubstanceReferenceInformation owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentContent(
      int eventType, XmlPullParser xpp, SubstanceReferenceInformation owner,
      SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent 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("element")) {
      res.setElement(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(
      XmlPullParser xpp, SubstanceReferenceInformation owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentContent(
      int eventType, XmlPullParser xpp, SubstanceReferenceInformation owner,
      SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("domain")) {
      res.setDomain(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
      res.setClassification(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("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(
      XmlPullParser xpp, SubstanceReferenceInformation owner)
      throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentContent(int eventType,
      XmlPullParser xpp, SubstanceReferenceInformation owner,
      SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
      res.setTarget(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("interaction")) {
      res.setInteraction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organism")) {
      res.setOrganism(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organismType")) {
      res.setOrganismType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "amount")) {
      res.setAmount(parseType("amount", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amountType")) {
      res.setAmountType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseSubstanceSourceMaterialContent(int eventType, XmlPullParser xpp, SubstanceSourceMaterial res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceMaterialClass")) {
      res.setSourceMaterialClass(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceMaterialType")) {
      res.setSourceMaterialType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceMaterialState")) {
      res.setSourceMaterialState(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organismId")) {
      res.setOrganismId(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organismName")) {
      res.setOrganismNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parentSubstanceId")) {
      res.getParentSubstanceId().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parentSubstanceName")) {
      res.getParentSubstanceName().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("countryOfOrigin")) {
      res.getCountryOfOrigin().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("geographicalLocation")) {
      res.getGeographicalLocation().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("developmentStage")) {
      res.setDevelopmentStage(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fractionDescription")) {
      res.getFractionDescription()
          .add(parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organism")) {
      res.setOrganism(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partDescription")) {
      res.getPartDescription()
          .add(parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(
      XmlPullParser xpp, SubstanceSourceMaterial owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentContent(
      int eventType, XmlPullParser xpp, SubstanceSourceMaterial owner,
      SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fraction")) {
      res.setFractionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("materialType")) {
      res.setMaterialType(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(
      XmlPullParser xpp, SubstanceSourceMaterial owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSourceMaterial owner,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("family")) {
      res.setFamily(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("genus")) {
      res.setGenus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("species")) {
      res.setSpecies(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intraspecificType")) {
      res.setIntraspecificType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intraspecificDescription")) {
      res.setIntraspecificDescriptionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hybrid")) {
      res.setHybrid(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organismGeneral")) {
      res.setOrganismGeneral(
          parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(
      XmlPullParser xpp, SubstanceSourceMaterial owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSourceMaterial owner,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorType")) {
      res.setAuthorType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorDescription")) {
      res.setAuthorDescriptionElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(
      XmlPullParser xpp, SubstanceSourceMaterial owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSourceMaterial owner,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maternalOrganismId")) {
      res.setMaternalOrganismIdElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maternalOrganismName")) {
      res.setMaternalOrganismNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paternalOrganismId")) {
      res.setPaternalOrganismIdElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paternalOrganismName")) {
      res.setPaternalOrganismNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hybridType")) {
      res.setHybridType(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(
      XmlPullParser xpp, SubstanceSourceMaterial owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentContent(
      int eventType, XmlPullParser xpp, SubstanceSourceMaterial owner,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kingdom")) {
      res.setKingdom(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("phylum")) {
      res.setPhylum(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("order")) {
      res.setOrder(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(
      XmlPullParser xpp, SubstanceSourceMaterial owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSourceMaterial owner,
      SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("part")) {
      res.setPart(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partLocation")) {
      res.setPartLocation(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseSubstanceSpecificationContent(int eventType, XmlPullParser xpp, SubstanceSpecification 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("status")) {
      res.setStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("domain")) {
      res.setDomain(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("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
      res.setCommentElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("moiety")) {
      res.getMoiety().add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceInformation")) {
      res.setReferenceInformation(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("structure")) {
      res.setStructure(parseSubstanceSpecificationSubstanceSpecificationStructureComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.getCode().add(parseSubstanceSpecificationSubstanceSpecificationCodeComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
      res.getName().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularWeight")) {
      res.getMolecularWeight()
          .add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
      res.getRelationship().add(parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nucleicAcid")) {
      res.setNucleicAcid(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("polymer")) {
      res.setPolymer(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protein")) {
      res.setProtein(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceMaterial")) {
      res.setSourceMaterial(parseReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationMoietyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationMoietyComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent 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("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("stereochemistry")) {
      res.setStereochemistry(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("opticalActivity")) {
      res.setOpticalActivity(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularFormula")) {
      res.setMolecularFormulaElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "amount")) {
      res.setAmount(parseType("amount", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationPropertyComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationPropertyComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner,
      SubstanceSpecification.SubstanceSpecificationPropertyComponent 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("code")) {
      res.setCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameters")) {
      res.setParametersElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "definingSubstance")) {
      res.setDefiningSubstance(parseType("definingSubstance", xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "amount")) {
      res.setAmount(parseType("amount", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationStructureComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationStructureComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner,
      SubstanceSpecification.SubstanceSpecificationStructureComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stereochemistry")) {
      res.setStereochemistry(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("opticalActivity")) {
      res.setOpticalActivity(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularFormula")) {
      res.setMolecularFormulaElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularFormulaByMoiety")) {
      res.setMolecularFormulaByMoietyElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isotope")) {
      res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularWeight")) {
      res.setMolecularWeight(
          parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("representation")) {
      res.getRepresentation()
          .add(parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner,
      SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent 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.setName(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substitution")) {
      res.setSubstitution(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("halfLife")) {
      res.setHalfLife(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularWeight")) {
      res.setMolecularWeight(
          parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(xpp, owner));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentContent(eventType,
          xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentContent(
      int eventType, XmlPullParser xpp, SubstanceSpecification owner,
      SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
      res.setMethod(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseQuantity(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentContent(
      int eventType, XmlPullParser xpp, SubstanceSpecification owner,
      SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent 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("representation")) {
      res.setRepresentationElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attachment")) {
      res.setAttachment(parseAttachment(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationCodeComponent parseSubstanceSpecificationSubstanceSpecificationCodeComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationCodeComponent res = new SubstanceSpecification.SubstanceSpecificationCodeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationCodeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationCodeComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationCodeComponent 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.setStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusDate")) {
      res.setStatusDateElement(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("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationNameComponent parseSubstanceSpecificationSubstanceSpecificationNameComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationNameComponent res = new SubstanceSpecification.SubstanceSpecificationNameComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationNameComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationNameComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameComponent 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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preferred")) {
      res.setPreferredElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
      res.getLanguage().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("domain")) {
      res.getDomain().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("synonym")) {
      res.getSynonym().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("translation")) {
      res.getTranslation().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("official")) {
      res.getOfficial().add(parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationNameOfficialComponent parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res = new SubstanceSpecification.SubstanceSpecificationNameOfficialComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner,
      SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authority")) {
      res.setAuthority(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
      res.setDateElement(parseDateTime(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected SubstanceSpecification.SubstanceSpecificationRelationshipComponent parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(
      XmlPullParser xpp, SubstanceSpecification owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSpecification.SubstanceSpecificationRelationshipComponent res = new SubstanceSpecification.SubstanceSpecificationRelationshipComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentContent(int eventType,
      XmlPullParser xpp, SubstanceSpecification owner,
      SubstanceSpecification.SubstanceSpecificationRelationshipComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "substance")) {
      res.setSubstance(parseType("substance", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
      res.setRelationship(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isDefining")) {
      res.setIsDefiningElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "amount")) {
      res.setAmount(parseType("amount", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amountRatioLowLimit")) {
      res.setAmountRatioLowLimit(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amountType")) {
      res.setAmountType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.getSource().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(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.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("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(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
      res.setItem(parseType("item", xpp));
    } else if (!parseBackboneElementContent(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.getIdentifier().add(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 && nameIsTypeName(xpp, "item")) {
      res.setItem(parseType("item", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
      res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(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(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplier")) {
      res.getSupplier().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("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.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(
      XmlPullParser xpp, SupplyRequest owner) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseSupplyRequestSupplyRequestParameterComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyRequestSupplyRequestParameterComponentContent(int eventType, XmlPullParser xpp,
      SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent 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 (!parseBackboneElementContent(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 && xpp.getName().equals("instantiatesCanonical")) {
      res.setInstantiatesCanonicalElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
      res.setInstantiatesUriElement(parseUri(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("encounter")) {
      res.setEncounter(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(parseReference(xpp));
    } 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("location")) {
      res.setLocation(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonCode")) {
      res.setReasonCode(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reasonReference")) {
      res.setReasonReference(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
      res.getInsurance().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 (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.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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseTerminologyCapabilitiesContent(int eventType, XmlPullParser xpp, TerminologyCapabilities 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, TerminologyCapabilities.CapabilityStatementKind.NULL,
          new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("software")) {
      res.setSoftware(parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementation")) {
      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lockedDate")) {
      res.setLockedDateElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("codeSystem")) {
      res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expansion")) {
      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("codeSearch")) {
      res.setCodeSearchElement(parseEnumeration(xpp, TerminologyCapabilities.CodeSearchSupport.NULL,
          new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validateCode")) {
      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("translation")) {
      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("closure")) {
      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent 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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent 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(parseUrl(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
      res.setUriElement(parseCanonical(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subsumption")) {
      res.setSubsumptionElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCodeElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isDefault")) {
      res.setIsDefaultElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compositional")) {
      res.setCompositionalElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
      res.getLanguage().add(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("filter")) {
      res.getFilter()
          .add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseCode(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentContent(eventType, xpp,
          owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentContent(
      int eventType, XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent 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("op")) {
      res.getOp().add(parseCode(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hierarchical")) {
      res.setHierarchicalElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("paging")) {
      res.setPagingElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("incomplete")) {
      res.setIncompleteElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
      res.getParameter()
          .add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(xpp, owner));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("textFilter")) {
      res.setTextFilterElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentContent(eventType, xpp, owner,
          res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent 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("documentation")) {
      res.setDocumentationElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("translations")) {
      res.setTranslationsElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("needsMap")) {
      res.setNeedsMapElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(
      XmlPullParser xpp, TerminologyCapabilities owner) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentContent(int eventType,
      XmlPullParser xpp, TerminologyCapabilities owner,
      TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("translation")) {
      res.setTranslationElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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.setCapabilitiesElement(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
      res.setContentTypeElement(parseCode(xpp));
    } 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("method")) {
      res.setMethodElement(parseEnumeration(xpp, TestScript.TestScriptRequestMethodCode.NULL,
          new TestScript.TestScriptRequestMethodCodeEnumFactory()));
    } 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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseCode(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("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("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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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("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 (!parseBackboneElementContent(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(parseCanonical(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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(parseString(xpp));
    } else if (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

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

  protected boolean parseVerificationResultContent(int eventType, XmlPullParser xpp, VerificationResult 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("targetLocation")) {
      res.getTargetLocation().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("need")) {
      res.setNeed(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(
          parseEnumeration(xpp, VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusDate")) {
      res.setStatusDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validationType")) {
      res.setValidationType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validationProcess")) {
      res.getValidationProcess().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequency")) {
      res.setFrequency(parseTiming(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastPerformed")) {
      res.setLastPerformedElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nextScheduled")) {
      res.setNextScheduledElement(parseDate(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("failureAction")) {
      res.setFailureAction(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("primarySource")) {
      res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attestation")) {
      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(xpp, res));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validator")) {
      res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(
      XmlPullParser xpp, VerificationResult owner) throws XmlPullParserException, IOException, FHIRFormatError {
    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseVerificationResultVerificationResultPrimarySourceComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVerificationResultVerificationResultPrimarySourceComponentContent(int eventType,
      XmlPullParser xpp, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("who")) {
      res.setWho(parseReference(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("communicationMethod")) {
      res.getCommunicationMethod().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validationStatus")) {
      res.setValidationStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validationDate")) {
      res.setValidationDateElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("canPushUpdates")) {
      res.setCanPushUpdates(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pushTypeAvailable")) {
      res.getPushTypeAvailable().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(
      XmlPullParser xpp, VerificationResult owner) throws XmlPullParserException, IOException, FHIRFormatError {
    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseVerificationResultVerificationResultAttestationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVerificationResultVerificationResultAttestationComponentContent(int eventType,
      XmlPullParser xpp, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("who")) {
      res.setWho(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("communicationMethod")) {
      res.setCommunicationMethod(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("sourceIdentityCertificate")) {
      res.setSourceIdentityCertificateElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("proxyIdentityCertificate")) {
      res.setProxyIdentityCertificateElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("proxySignature")) {
      res.setProxySignature(parseSignature(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceSignature")) {
      res.setSourceSignature(parseSignature(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(
      XmlPullParser xpp, VerificationResult owner) throws XmlPullParserException, IOException, FHIRFormatError {
    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseVerificationResultVerificationResultValidatorComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVerificationResultVerificationResultValidatorComponentContent(int eventType, XmlPullParser xpp,
      VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
      res.setOrganization(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identityCertificate")) {
      res.setIdentityCertificateElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attestationSignature")) {
      res.setAttestationSignature(parseSignature(xpp));
    } else if (!parseBackboneElementContent(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("created")) {
      res.setCreatedElement(parseDateTime(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("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 && xpp.getName().equals("lensSpecification")) {
      res.getLensSpecification().add(parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(xpp, res));
    } else if (!parseDomainResourceContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(
      XmlPullParser xpp, VisionPrescription owner) throws XmlPullParserException, IOException, FHIRFormatError {
    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentContent(int eventType,
      XmlPullParser xpp, VisionPrescription owner, VisionPrescription.VisionPrescriptionLensSpecificationComponent 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.getPrism().add(parseVisionPrescriptionPrismComponent(xpp, owner));
    } 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(parseQuantity(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 (!parseBackboneElementContent(eventType, xpp, res))
      return false;
    return true;
  }

  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(XmlPullParser xpp,
      VisionPrescription owner) throws XmlPullParserException, IOException, FHIRFormatError {
    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
    parseBackboneAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
      if (!parseVisionPrescriptionPrismComponentContent(eventType, xpp, owner, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVisionPrescriptionPrismComponentContent(int eventType, XmlPullParser xpp,
      VisionPrescription owner, VisionPrescription.PrismComponent res)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmountElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
      res.setBaseElement(
          parseEnumeration(xpp, VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
    } else if (!parseBackboneElementContent(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("BiologicallyDerivedProduct"))
      return parseBiologicallyDerivedProduct(xpp);
    else if (xpp.getName().equals("BodyStructure"))
      return parseBodyStructure(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("CatalogEntry"))
      return parseCatalogEntry(xpp);
    else if (xpp.getName().equals("ChargeItem"))
      return parseChargeItem(xpp);
    else if (xpp.getName().equals("ChargeItemDefinition"))
      return parseChargeItemDefinition(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("CoverageEligibilityRequest"))
      return parseCoverageEligibilityRequest(xpp);
    else if (xpp.getName().equals("CoverageEligibilityResponse"))
      return parseCoverageEligibilityResponse(xpp);
    else if (xpp.getName().equals("DetectedIssue"))
      return parseDetectedIssue(xpp);
    else if (xpp.getName().equals("Device"))
      return parseDevice(xpp);
    else if (xpp.getName().equals("DeviceDefinition"))
      return parseDeviceDefinition(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("EffectEvidenceSynthesis"))
      return parseEffectEvidenceSynthesis(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("EventDefinition"))
      return parseEventDefinition(xpp);
    else if (xpp.getName().equals("Evidence"))
      return parseEvidence(xpp);
    else if (xpp.getName().equals("EvidenceVariable"))
      return parseEvidenceVariable(xpp);
    else if (xpp.getName().equals("ExampleScenario"))
      return parseExampleScenario(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("ImagingStudy"))
      return parseImagingStudy(xpp);
    else if (xpp.getName().equals("Immunization"))
      return parseImmunization(xpp);
    else if (xpp.getName().equals("ImmunizationEvaluation"))
      return parseImmunizationEvaluation(xpp);
    else if (xpp.getName().equals("ImmunizationRecommendation"))
      return parseImmunizationRecommendation(xpp);
    else if (xpp.getName().equals("ImplementationGuide"))
      return parseImplementationGuide(xpp);
    else if (xpp.getName().equals("InsurancePlan"))
      return parseInsurancePlan(xpp);
    else if (xpp.getName().equals("Invoice"))
      return parseInvoice(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("MedicationKnowledge"))
      return parseMedicationKnowledge(xpp);
    else if (xpp.getName().equals("MedicationRequest"))
      return parseMedicationRequest(xpp);
    else if (xpp.getName().equals("MedicationStatement"))
      return parseMedicationStatement(xpp);
    else if (xpp.getName().equals("MedicinalProduct"))
      return parseMedicinalProduct(xpp);
    else if (xpp.getName().equals("MedicinalProductAuthorization"))
      return parseMedicinalProductAuthorization(xpp);
    else if (xpp.getName().equals("MedicinalProductContraindication"))
      return parseMedicinalProductContraindication(xpp);
    else if (xpp.getName().equals("MedicinalProductIndication"))
      return parseMedicinalProductIndication(xpp);
    else if (xpp.getName().equals("MedicinalProductIngredient"))
      return parseMedicinalProductIngredient(xpp);
    else if (xpp.getName().equals("MedicinalProductInteraction"))
      return parseMedicinalProductInteraction(xpp);
    else if (xpp.getName().equals("MedicinalProductManufactured"))
      return parseMedicinalProductManufactured(xpp);
    else if (xpp.getName().equals("MedicinalProductPackaged"))
      return parseMedicinalProductPackaged(xpp);
    else if (xpp.getName().equals("MedicinalProductPharmaceutical"))
      return parseMedicinalProductPharmaceutical(xpp);
    else if (xpp.getName().equals("MedicinalProductUndesirableEffect"))
      return parseMedicinalProductUndesirableEffect(xpp);
    else if (xpp.getName().equals("MessageDefinition"))
      return parseMessageDefinition(xpp);
    else if (xpp.getName().equals("MessageHeader"))
      return parseMessageHeader(xpp);
    else if (xpp.getName().equals("MolecularSequence"))
      return parseMolecularSequence(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("ObservationDefinition"))
      return parseObservationDefinition(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("OrganizationAffiliation"))
      return parseOrganizationAffiliation(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("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("RelatedPerson"))
      return parseRelatedPerson(xpp);
    else if (xpp.getName().equals("RequestGroup"))
      return parseRequestGroup(xpp);
    else if (xpp.getName().equals("ResearchDefinition"))
      return parseResearchDefinition(xpp);
    else if (xpp.getName().equals("ResearchElementDefinition"))
      return parseResearchElementDefinition(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("RiskEvidenceSynthesis"))
      return parseRiskEvidenceSynthesis(xpp);
    else if (xpp.getName().equals("Schedule"))
      return parseSchedule(xpp);
    else if (xpp.getName().equals("SearchParameter"))
      return parseSearchParameter(xpp);
    else if (xpp.getName().equals("ServiceRequest"))
      return parseServiceRequest(xpp);
    else if (xpp.getName().equals("Slot"))
      return parseSlot(xpp);
    else if (xpp.getName().equals("Specimen"))
      return parseSpecimen(xpp);
    else if (xpp.getName().equals("SpecimenDefinition"))
      return parseSpecimenDefinition(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("SubstanceNucleicAcid"))
      return parseSubstanceNucleicAcid(xpp);
    else if (xpp.getName().equals("SubstancePolymer"))
      return parseSubstancePolymer(xpp);
    else if (xpp.getName().equals("SubstanceProtein"))
      return parseSubstanceProtein(xpp);
    else if (xpp.getName().equals("SubstanceReferenceInformation"))
      return parseSubstanceReferenceInformation(xpp);
    else if (xpp.getName().equals("SubstanceSourceMaterial"))
      return parseSubstanceSourceMaterial(xpp);
    else if (xpp.getName().equals("SubstanceSpecification"))
      return parseSubstanceSpecification(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("TerminologyCapabilities"))
      return parseTerminologyCapabilities(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("VerificationResult"))
      return parseVerificationResult(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 + "canonical"))
      return parseCanonical(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 + "url"))
      return parseUrl(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 + "Meta"))
      return parseMeta(xpp);
    else if (xpp.getName().equals(prefix + "Address"))
      return parseAddress(xpp);
    else if (xpp.getName().equals(prefix + "Contributor"))
      return parseContributor(xpp);
    else if (xpp.getName().equals(prefix + "Attachment"))
      return parseAttachment(xpp);
    else if (xpp.getName().equals(prefix + "Count"))
      return parseCount(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 + "Money"))
      return parseMoney(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 + "MarketingStatus"))
      return parseMarketingStatus(xpp);
    else if (xpp.getName().equals(prefix + "Identifier"))
      return parseIdentifier(xpp);
    else if (xpp.getName().equals(prefix + "SubstanceAmount"))
      return parseSubstanceAmount(xpp);
    else if (xpp.getName().equals(prefix + "Coding"))
      return parseCoding(xpp);
    else if (xpp.getName().equals(prefix + "SampledData"))
      return parseSampledData(xpp);
    else if (xpp.getName().equals(prefix + "Population"))
      return parsePopulation(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 + "Reference"))
      return parseReference(xpp);
    else if (xpp.getName().equals(prefix + "TriggerDefinition"))
      return parseTriggerDefinition(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 + "Duration"))
      return parseDuration(xpp);
    else if (xpp.getName().equals(prefix + "Range"))
      return parseRange(xpp);
    else if (xpp.getName().equals(prefix + "RelatedArtifact"))
      return parseRelatedArtifact(xpp);
    else if (xpp.getName().equals(prefix + "Annotation"))
      return parseAnnotation(xpp);
    else if (xpp.getName().equals(prefix + "ProductShelfLife"))
      return parseProductShelfLife(xpp);
    else if (xpp.getName().equals(prefix + "ContactDetail"))
      return parseContactDetail(xpp);
    else if (xpp.getName().equals(prefix + "UsageContext"))
      return parseUsageContext(xpp);
    else if (xpp.getName().equals(prefix + "Expression"))
      return parseExpression(xpp);
    else if (xpp.getName().equals(prefix + "Signature"))
      return parseSignature(xpp);
    else if (xpp.getName().equals(prefix + "Timing"))
      return parseTiming(xpp);
    else if (xpp.getName().equals(prefix + "ProdCharacteristic"))
      return parseProdCharacteristic(xpp);
    else if (xpp.getName().equals(prefix + "CodeableConcept"))
      return parseCodeableConcept(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 + "Canonical"))
      return parseCanonical(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 + "Url"))
      return parseUrl(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("canonical"))
      return parseCanonical(xpp);
    else if (type.equals("uri"))
      return parseUri(xpp);
    else if (type.equals("uuid"))
      return parseUuid(xpp);
    else if (type.equals("url"))
      return parseUrl(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("Meta"))
      return parseMeta(xpp);
    else if (type.equals("Address"))
      return parseAddress(xpp);
    else if (type.equals("Contributor"))
      return parseContributor(xpp);
    else if (type.equals("Attachment"))
      return parseAttachment(xpp);
    else if (type.equals("Count"))
      return parseCount(xpp);
    else if (type.equals("DataRequirement"))
      return parseDataRequirement(xpp);
    else if (type.equals("Dosage"))
      return parseDosage(xpp);
    else if (type.equals("Money"))
      return parseMoney(xpp);
    else if (type.equals("HumanName"))
      return parseHumanName(xpp);
    else if (type.equals("ContactPoint"))
      return parseContactPoint(xpp);
    else if (type.equals("MarketingStatus"))
      return parseMarketingStatus(xpp);
    else if (type.equals("Identifier"))
      return parseIdentifier(xpp);
    else if (type.equals("SubstanceAmount"))
      return parseSubstanceAmount(xpp);
    else if (type.equals("Coding"))
      return parseCoding(xpp);
    else if (type.equals("SampledData"))
      return parseSampledData(xpp);
    else if (type.equals("Population"))
      return parsePopulation(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("Reference"))
      return parseReference(xpp);
    else if (type.equals("TriggerDefinition"))
      return parseTriggerDefinition(xpp);
    else if (type.equals("Quantity"))
      return parseQuantity(xpp);
    else if (type.equals("Period"))
      return parsePeriod(xpp);
    else if (type.equals("Duration"))
      return parseDuration(xpp);
    else if (type.equals("Range"))
      return parseRange(xpp);
    else if (type.equals("RelatedArtifact"))
      return parseRelatedArtifact(xpp);
    else if (type.equals("Annotation"))
      return parseAnnotation(xpp);
    else if (type.equals("ProductShelfLife"))
      return parseProductShelfLife(xpp);
    else if (type.equals("ContactDetail"))
      return parseContactDetail(xpp);
    else if (type.equals("UsageContext"))
      return parseUsageContext(xpp);
    else if (type.equals("Expression"))
      return parseExpression(xpp);
    else if (type.equals("Signature"))
      return parseSignature(xpp);
    else if (type.equals("Timing"))
      return parseTiming(xpp);
    else if (type.equals("ProdCharacteristic"))
      return parseProdCharacteristic(xpp);
    else if (type.equals("CodeableConcept"))
      return parseCodeableConcept(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("Meta"))
      return parseMeta(xpp);
    else if (type.equals("Address"))
      return parseAddress(xpp);
    else if (type.equals("Contributor"))
      return parseContributor(xpp);
    else if (type.equals("Attachment"))
      return parseAttachment(xpp);
    else if (type.equals("Count"))
      return parseCount(xpp);
    else if (type.equals("DataRequirement"))
      return parseDataRequirement(xpp);
    else if (type.equals("Dosage"))
      return parseDosage(xpp);
    else if (type.equals("Money"))
      return parseMoney(xpp);
    else if (type.equals("HumanName"))
      return parseHumanName(xpp);
    else if (type.equals("ContactPoint"))
      return parseContactPoint(xpp);
    else if (type.equals("MarketingStatus"))
      return parseMarketingStatus(xpp);
    else if (type.equals("Identifier"))
      return parseIdentifier(xpp);
    else if (type.equals("SubstanceAmount"))
      return parseSubstanceAmount(xpp);
    else if (type.equals("Coding"))
      return parseCoding(xpp);
    else if (type.equals("SampledData"))
      return parseSampledData(xpp);
    else if (type.equals("Population"))
      return parsePopulation(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("Reference"))
      return parseReference(xpp);
    else if (type.equals("TriggerDefinition"))
      return parseTriggerDefinition(xpp);
    else if (type.equals("Quantity"))
      return parseQuantity(xpp);
    else if (type.equals("Period"))
      return parsePeriod(xpp);
    else if (type.equals("Duration"))
      return parseDuration(xpp);
    else if (type.equals("Range"))
      return parseRange(xpp);
    else if (type.equals("RelatedArtifact"))
      return parseRelatedArtifact(xpp);
    else if (type.equals("Annotation"))
      return parseAnnotation(xpp);
    else if (type.equals("ProductShelfLife"))
      return parseProductShelfLife(xpp);
    else if (type.equals("ContactDetail"))
      return parseContactDetail(xpp);
    else if (type.equals("UsageContext"))
      return parseUsageContext(xpp);
    else if (type.equals("Expression"))
      return parseExpression(xpp);
    else if (type.equals("Signature"))
      return parseSignature(xpp);
    else if (type.equals("Timing"))
      return parseTiming(xpp);
    else if (type.equals("ProdCharacteristic"))
      return parseProdCharacteristic(xpp);
    else if (type.equals("CodeableConcept"))
      return parseCodeableConcept(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("BiologicallyDerivedProduct"))
      return parseBiologicallyDerivedProduct(xpp);
    else if (type.equals("BodyStructure"))
      return parseBodyStructure(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("CatalogEntry"))
      return parseCatalogEntry(xpp);
    else if (type.equals("ChargeItem"))
      return parseChargeItem(xpp);
    else if (type.equals("ChargeItemDefinition"))
      return parseChargeItemDefinition(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("CoverageEligibilityRequest"))
      return parseCoverageEligibilityRequest(xpp);
    else if (type.equals("CoverageEligibilityResponse"))
      return parseCoverageEligibilityResponse(xpp);
    else if (type.equals("DetectedIssue"))
      return parseDetectedIssue(xpp);
    else if (type.equals("Device"))
      return parseDevice(xpp);
    else if (type.equals("DeviceDefinition"))
      return parseDeviceDefinition(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("EffectEvidenceSynthesis"))
      return parseEffectEvidenceSynthesis(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("EventDefinition"))
      return parseEventDefinition(xpp);
    else if (type.equals("Evidence"))
      return parseEvidence(xpp);
    else if (type.equals("EvidenceVariable"))
      return parseEvidenceVariable(xpp);
    else if (type.equals("ExampleScenario"))
      return parseExampleScenario(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("ImagingStudy"))
      return parseImagingStudy(xpp);
    else if (type.equals("Immunization"))
      return parseImmunization(xpp);
    else if (type.equals("ImmunizationEvaluation"))
      return parseImmunizationEvaluation(xpp);
    else if (type.equals("ImmunizationRecommendation"))
      return parseImmunizationRecommendation(xpp);
    else if (type.equals("ImplementationGuide"))
      return parseImplementationGuide(xpp);
    else if (type.equals("InsurancePlan"))
      return parseInsurancePlan(xpp);
    else if (type.equals("Invoice"))
      return parseInvoice(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("MedicationKnowledge"))
      return parseMedicationKnowledge(xpp);
    else if (type.equals("MedicationRequest"))
      return parseMedicationRequest(xpp);
    else if (type.equals("MedicationStatement"))
      return parseMedicationStatement(xpp);
    else if (type.equals("MedicinalProduct"))
      return parseMedicinalProduct(xpp);
    else if (type.equals("MedicinalProductAuthorization"))
      return parseMedicinalProductAuthorization(xpp);
    else if (type.equals("MedicinalProductContraindication"))
      return parseMedicinalProductContraindication(xpp);
    else if (type.equals("MedicinalProductIndication"))
      return parseMedicinalProductIndication(xpp);
    else if (type.equals("MedicinalProductIngredient"))
      return parseMedicinalProductIngredient(xpp);
    else if (type.equals("MedicinalProductInteraction"))
      return parseMedicinalProductInteraction(xpp);
    else if (type.equals("MedicinalProductManufactured"))
      return parseMedicinalProductManufactured(xpp);
    else if (type.equals("MedicinalProductPackaged"))
      return parseMedicinalProductPackaged(xpp);
    else if (type.equals("MedicinalProductPharmaceutical"))
      return parseMedicinalProductPharmaceutical(xpp);
    else if (type.equals("MedicinalProductUndesirableEffect"))
      return parseMedicinalProductUndesirableEffect(xpp);
    else if (type.equals("MessageDefinition"))
      return parseMessageDefinition(xpp);
    else if (type.equals("MessageHeader"))
      return parseMessageHeader(xpp);
    else if (type.equals("MolecularSequence"))
      return parseMolecularSequence(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("ObservationDefinition"))
      return parseObservationDefinition(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("OrganizationAffiliation"))
      return parseOrganizationAffiliation(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("Provenance"))
      return parseProvenance(xpp);
    else if (type.equals("Questionnaire"))
      return parseQuestionnaire(xpp);
    else if (type.equals("QuestionnaireResponse"))
      return parseQuestionnaireResponse(xpp);
    else if (type.equals("RelatedPerson"))
      return parseRelatedPerson(xpp);
    else if (type.equals("RequestGroup"))
      return parseRequestGroup(xpp);
    else if (type.equals("ResearchDefinition"))
      return parseResearchDefinition(xpp);
    else if (type.equals("ResearchElementDefinition"))
      return parseResearchElementDefinition(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("RiskEvidenceSynthesis"))
      return parseRiskEvidenceSynthesis(xpp);
    else if (type.equals("Schedule"))
      return parseSchedule(xpp);
    else if (type.equals("SearchParameter"))
      return parseSearchParameter(xpp);
    else if (type.equals("ServiceRequest"))
      return parseServiceRequest(xpp);
    else if (type.equals("Slot"))
      return parseSlot(xpp);
    else if (type.equals("Specimen"))
      return parseSpecimen(xpp);
    else if (type.equals("SpecimenDefinition"))
      return parseSpecimenDefinition(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("SubstanceNucleicAcid"))
      return parseSubstanceNucleicAcid(xpp);
    else if (type.equals("SubstancePolymer"))
      return parseSubstancePolymer(xpp);
    else if (type.equals("SubstanceProtein"))
      return parseSubstanceProtein(xpp);
    else if (type.equals("SubstanceReferenceInformation"))
      return parseSubstanceReferenceInformation(xpp);
    else if (type.equals("SubstanceSourceMaterial"))
      return parseSubstanceSourceMaterial(xpp);
    else if (type.equals("SubstanceSpecification"))
      return parseSubstanceSpecification(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("TerminologyCapabilities"))
      return parseTerminologyCapabilities(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("VerificationResult"))
      return parseVerificationResult(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("canonical"))
      return parseCanonical(xpp);
    else if (type.equals("uri"))
      return parseUri(xpp);
    else if (type.equals("uuid"))
      return parseUuid(xpp);
    else if (type.equals("url"))
      return parseUrl(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 + "Meta"))
      return true;
    if (xpp.getName().equals(prefix + "Address"))
      return true;
    if (xpp.getName().equals(prefix + "Contributor"))
      return true;
    if (xpp.getName().equals(prefix + "Attachment"))
      return true;
    if (xpp.getName().equals(prefix + "Count"))
      return true;
    if (xpp.getName().equals(prefix + "DataRequirement"))
      return true;
    if (xpp.getName().equals(prefix + "Dosage"))
      return true;
    if (xpp.getName().equals(prefix + "Money"))
      return true;
    if (xpp.getName().equals(prefix + "HumanName"))
      return true;
    if (xpp.getName().equals(prefix + "ContactPoint"))
      return true;
    if (xpp.getName().equals(prefix + "MarketingStatus"))
      return true;
    if (xpp.getName().equals(prefix + "Identifier"))
      return true;
    if (xpp.getName().equals(prefix + "SubstanceAmount"))
      return true;
    if (xpp.getName().equals(prefix + "Coding"))
      return true;
    if (xpp.getName().equals(prefix + "SampledData"))
      return true;
    if (xpp.getName().equals(prefix + "Population"))
      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 + "Reference"))
      return true;
    if (xpp.getName().equals(prefix + "TriggerDefinition"))
      return true;
    if (xpp.getName().equals(prefix + "Quantity"))
      return true;
    if (xpp.getName().equals(prefix + "Period"))
      return true;
    if (xpp.getName().equals(prefix + "Duration"))
      return true;
    if (xpp.getName().equals(prefix + "Range"))
      return true;
    if (xpp.getName().equals(prefix + "RelatedArtifact"))
      return true;
    if (xpp.getName().equals(prefix + "Annotation"))
      return true;
    if (xpp.getName().equals(prefix + "ProductShelfLife"))
      return true;
    if (xpp.getName().equals(prefix + "ContactDetail"))
      return true;
    if (xpp.getName().equals(prefix + "UsageContext"))
      return true;
    if (xpp.getName().equals(prefix + "Expression"))
      return true;
    if (xpp.getName().equals(prefix + "Signature"))
      return true;
    if (xpp.getName().equals(prefix + "Timing"))
      return true;
    if (xpp.getName().equals(prefix + "ProdCharacteristic"))
      return true;
    if (xpp.getName().equals(prefix + "CodeableConcept"))
      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 + "BiologicallyDerivedProduct"))
      return true;
    if (xpp.getName().equals(prefix + "BodyStructure"))
      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 + "CatalogEntry"))
      return true;
    if (xpp.getName().equals(prefix + "ChargeItem"))
      return true;
    if (xpp.getName().equals(prefix + "ChargeItemDefinition"))
      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 + "CoverageEligibilityRequest"))
      return true;
    if (xpp.getName().equals(prefix + "CoverageEligibilityResponse"))
      return true;
    if (xpp.getName().equals(prefix + "DetectedIssue"))
      return true;
    if (xpp.getName().equals(prefix + "Device"))
      return true;
    if (xpp.getName().equals(prefix + "DeviceDefinition"))
      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 + "EffectEvidenceSynthesis"))
      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 + "EventDefinition"))
      return true;
    if (xpp.getName().equals(prefix + "Evidence"))
      return true;
    if (xpp.getName().equals(prefix + "EvidenceVariable"))
      return true;
    if (xpp.getName().equals(prefix + "ExampleScenario"))
      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 + "ImagingStudy"))
      return true;
    if (xpp.getName().equals(prefix + "Immunization"))
      return true;
    if (xpp.getName().equals(prefix + "ImmunizationEvaluation"))
      return true;
    if (xpp.getName().equals(prefix + "ImmunizationRecommendation"))
      return true;
    if (xpp.getName().equals(prefix + "ImplementationGuide"))
      return true;
    if (xpp.getName().equals(prefix + "InsurancePlan"))
      return true;
    if (xpp.getName().equals(prefix + "Invoice"))
      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 + "MedicationKnowledge"))
      return true;
    if (xpp.getName().equals(prefix + "MedicationRequest"))
      return true;
    if (xpp.getName().equals(prefix + "MedicationStatement"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProduct"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductAuthorization"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductContraindication"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductIndication"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductIngredient"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductInteraction"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductManufactured"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductPackaged"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductPharmaceutical"))
      return true;
    if (xpp.getName().equals(prefix + "MedicinalProductUndesirableEffect"))
      return true;
    if (xpp.getName().equals(prefix + "MessageDefinition"))
      return true;
    if (xpp.getName().equals(prefix + "MessageHeader"))
      return true;
    if (xpp.getName().equals(prefix + "MolecularSequence"))
      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 + "ObservationDefinition"))
      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 + "OrganizationAffiliation"))
      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 + "Provenance"))
      return true;
    if (xpp.getName().equals(prefix + "Questionnaire"))
      return true;
    if (xpp.getName().equals(prefix + "QuestionnaireResponse"))
      return true;
    if (xpp.getName().equals(prefix + "RelatedPerson"))
      return true;
    if (xpp.getName().equals(prefix + "RequestGroup"))
      return true;
    if (xpp.getName().equals(prefix + "ResearchDefinition"))
      return true;
    if (xpp.getName().equals(prefix + "ResearchElementDefinition"))
      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 + "RiskEvidenceSynthesis"))
      return true;
    if (xpp.getName().equals(prefix + "Schedule"))
      return true;
    if (xpp.getName().equals(prefix + "SearchParameter"))
      return true;
    if (xpp.getName().equals(prefix + "ServiceRequest"))
      return true;
    if (xpp.getName().equals(prefix + "Slot"))
      return true;
    if (xpp.getName().equals(prefix + "Specimen"))
      return true;
    if (xpp.getName().equals(prefix + "SpecimenDefinition"))
      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 + "SubstanceNucleicAcid"))
      return true;
    if (xpp.getName().equals(prefix + "SubstancePolymer"))
      return true;
    if (xpp.getName().equals(prefix + "SubstanceProtein"))
      return true;
    if (xpp.getName().equals(prefix + "SubstanceReferenceInformation"))
      return true;
    if (xpp.getName().equals(prefix + "SubstanceSourceMaterial"))
      return true;
    if (xpp.getName().equals(prefix + "SubstanceSpecification"))
      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 + "TerminologyCapabilities"))
      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 + "VerificationResult"))
      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 + "Canonical"))
      return true;
    if (xpp.getName().equals(prefix + "Uri"))
      return true;
    if (xpp.getName().equals(prefix + "Uuid"))
      return true;
    if (xpp.getName().equals(prefix + "Url"))
      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;
  }

  @Override
  protected Type parseAnyType(XmlPullParser xpp, String type)
      throws XmlPullParserException, IOException, FHIRFormatError {
    if (type.equals("ElementDefinition"))
      return parseElementDefinition(xpp);
    else if (type.equals("DataRequirement"))
      return parseDataRequirement(xpp);
    else
      return parseType(xpp, type);
  }

  protected void composeElementElements(Element element) throws IOException {
    for (Extension e : element.getExtension()) {
      composeExtension("extension", e);
    }
  }

  protected void composeBackboneElementElements(BackboneElement element) throws IOException {
    composeElementElements(element);
    for (Extension e : element.getModifierExtension()) {
      composeExtension("modifierExtension", e);
    }
  }

  protected void composeBackboneElementElements(BackboneType 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 composeCanonical(String name, CanonicalType value) throws IOException {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value)
        || !Utilities.noString(value.getValue()))) {// canonical
      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 composeUrl(String name, UrlType value) throws IOException {
    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value)
        || !Utilities.noString(value.getValue()))) {// url
      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 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 composeDosage(String name, Dosage element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDosageElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDosageElements(Dosage element) throws IOException {
    composeBackboneElementElements(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.hasDoseAndRate()) {
      for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate())
        composeDosageDosageDoseAndRateComponent("doseAndRate", e);
    }
    if (element.hasMaxDosePerPeriod()) {
      composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
    }
    if (element.hasMaxDosePerAdministration()) {
      composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
    }
    if (element.hasMaxDosePerLifetime()) {
      composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
    }
  }

  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDosageDosageDoseAndRateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDosageDosageDoseAndRateComponentElements(Dosage.DosageDoseAndRateComponent element)
      throws IOException {
    composeElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDose()) {
      composeType("dose", element.getDose());
    }
    if (element.hasRate()) {
      composeType("rate", element.getRate());
    }
  }

  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMarketingStatusElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMarketingStatusElements(MarketingStatus element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCountry()) {
      composeCodeableConcept("country", element.getCountry());
    }
    if (element.hasJurisdiction()) {
      composeCodeableConcept("jurisdiction", element.getJurisdiction());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasDateRange()) {
      composePeriod("dateRange", element.getDateRange());
    }
    if (element.hasRestoreDateElement()) {
      composeDateTime("restoreDate", element.getRestoreDateElement());
    }
  }

  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceAmountElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceAmountElements(SubstanceAmount element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAmount()) {
      composeType("amount", element.getAmount());
    }
    if (element.hasAmountType()) {
      composeCodeableConcept("amountType", element.getAmountType());
    }
    if (element.hasAmountTextElement()) {
      composeString("amountText", element.getAmountTextElement());
    }
    if (element.hasReferenceRange()) {
      composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
    }
  }

  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name,
      SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceAmountSubstanceAmountReferenceRangeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentElements(
      SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasLowLimit()) {
      composeQuantity("lowLimit", element.getLowLimit());
    }
    if (element.hasHighLimit()) {
      composeQuantity("highLimit", element.getHighLimit());
    }
  }

  protected void composePopulation(String name, Population element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composePopulationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePopulationElements(Population element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAge()) {
      composeType("age", element.getAge());
    }
    if (element.hasGender()) {
      composeCodeableConcept("gender", element.getGender());
    }
    if (element.hasRace()) {
      composeCodeableConcept("race", element.getRace());
    }
    if (element.hasPhysiologicalCondition()) {
      composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
    }
  }

  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 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 composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProductShelfLifeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProductShelfLifeElements(ProductShelfLife element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasPeriod()) {
      composeQuantity("period", element.getPeriod());
    }
    if (element.hasSpecialPrecautionsForStorage()) {
      for (CodeableConcept e : element.getSpecialPrecautionsForStorage())
        composeCodeableConcept("specialPrecautionsForStorage", e);
    }
  }

  protected void composeTiming(String name, Timing element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTimingElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTimingElements(Timing element) throws IOException {
    composeBackboneElementElements(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()) {
      composePositiveInt("count", element.getCountElement());
    }
    if (element.hasCountMaxElement()) {
      composePositiveInt("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()) {
      composePositiveInt("frequency", element.getFrequencyElement());
    }
    if (element.hasFrequencyMaxElement()) {
      composePositiveInt("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 composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProdCharacteristicElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProdCharacteristicElements(ProdCharacteristic element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasHeight()) {
      composeQuantity("height", element.getHeight());
    }
    if (element.hasWidth()) {
      composeQuantity("width", element.getWidth());
    }
    if (element.hasDepth()) {
      composeQuantity("depth", element.getDepth());
    }
    if (element.hasWeight()) {
      composeQuantity("weight", element.getWeight());
    }
    if (element.hasNominalVolume()) {
      composeQuantity("nominalVolume", element.getNominalVolume());
    }
    if (element.hasExternalDiameter()) {
      composeQuantity("externalDiameter", element.getExternalDiameter());
    }
    if (element.hasShapeElement()) {
      composeString("shape", element.getShapeElement());
    }
    if (element.hasColor()) {
      for (StringType e : element.getColor())
        composeString("color", e);
    }
    if (element.hasImprint()) {
      for (StringType e : element.getImprint())
        composeString("imprint", e);
    }
    if (element.hasImage()) {
      for (Attachment e : element.getImage())
        composeAttachment("image", e);
    }
    if (element.hasScoring()) {
      composeCodeableConcept("scoring", element.getScoring());
    }
  }

  protected void composeMeta(String name, Meta element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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.hasSourceElement()) {
      composeUri("source", element.getSourceElement());
    }
    if (element.hasProfile()) {
      for (CanonicalType e : element.getProfile())
        composeCanonical("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) {
      composeTypeAttributes(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 composeContributor(String name, Contributor element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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 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()) {
      composeUrl("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 composeDataRequirement(String name, DataRequirement element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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 (CanonicalType e : element.getProfile())
        composeCanonical("profile", e);
    }
    if (element.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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);
    }
    if (element.hasLimitElement()) {
      composePositiveInt("limit", element.getLimitElement());
    }
    if (element.hasSort()) {
      for (DataRequirement.DataRequirementSortComponent e : element.getSort())
        composeDataRequirementDataRequirementSortComponent("sort", 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.hasSearchParamElement()) {
      composeString("searchParam", element.getSearchParamElement());
    }
    if (element.hasValueSetElement()) {
      composeCanonical("valueSet", element.getValueSetElement());
    }
    if (element.hasCode()) {
      for (Coding e : element.getCode())
        composeCoding("code", 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.hasSearchParamElement()) {
      composeString("searchParam", element.getSearchParamElement());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
  }

  protected void composeDataRequirementDataRequirementSortComponent(String name,
      DataRequirement.DataRequirementSortComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataRequirementDataRequirementSortComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataRequirementDataRequirementSortComponentElements(
      DataRequirement.DataRequirementSortComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasPathElement()) {
      composeString("path", element.getPathElement());
    }
    if (element.hasDirectionElement())
      composeEnumeration("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory());
  }

  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 {
    composeElementElements(element);
    if (element.hasValueElement()) {
      composeDecimal("value", element.getValueElement());
    }
    if (element.hasCurrencyElement()) {
      composeCode("currency", element.getCurrencyElement());
    }
  }

  protected void composeHumanName(String name, HumanName element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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) {
      composeTypeAttributes(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 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 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()) {
      composeQuantity("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 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.hasTypeElement()) {
      composeUri("type", element.getTypeElement());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasDisplayElement()) {
      composeString("display", element.getDisplayElement());
    }
  }

  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTiming()) {
      composeType("timing", element.getTiming());
    }
    if (element.hasData()) {
      for (DataRequirement e : element.getData())
        composeDataRequirement("data", e);
    }
    if (element.hasCondition()) {
      composeExpression("condition", element.getCondition());
    }
  }

  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 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()) {
      composeQuantity("low", element.getLow());
    }
    if (element.hasHigh()) {
      composeQuantity("high", element.getHigh());
    }
  }

  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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.hasLabelElement()) {
      composeString("label", element.getLabelElement());
    }
    if (element.hasDisplayElement()) {
      composeString("display", element.getDisplayElement());
    }
    if (element.hasCitationElement()) {
      composeMarkdown("citation", element.getCitationElement());
    }
    if (element.hasUrlElement()) {
      composeUrl("url", element.getUrlElement());
    }
    if (element.hasDocument()) {
      composeAttachment("document", element.getDocument());
    }
    if (element.hasResourceElement()) {
      composeCanonical("resource", element.getResourceElement());
    }
  }

  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()) {
      composeMarkdown("text", element.getTextElement());
    }
  }

  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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 composeUsageContext(String name, UsageContext element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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 composeExpression(String name, Expression element) throws IOException {
    if (element != null) {
      composeTypeAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExpressionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExpressionElements(Expression element) throws IOException {
    composeElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNameElement()) {
      composeId("name", element.getNameElement());
    }
    if (element.hasLanguageElement())
      composeCode("language", element.getLanguageElement());
    if (element.hasExpressionElement()) {
      composeString("expression", element.getExpressionElement());
    }
    if (element.hasReferenceElement()) {
      composeUri("reference", element.getReferenceElement());
    }
  }

  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()) {
      composeReference("who", element.getWho());
    }
    if (element.hasOnBehalfOf()) {
      composeReference("onBehalfOf", element.getOnBehalfOf());
    }
    if (element.hasTargetFormatElement()) {
      composeCode("targetFormat", element.getTargetFormatElement());
    }
    if (element.hasSigFormatElement()) {
      composeCode("sigFormat", element.getSigFormatElement());
    }
    if (element.hasDataElement()) {
      composeBase64Binary("data", element.getDataElement());
    }
  }

  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 composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
    if (element != null) {
      composeTypeAttributes(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.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
  }

  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 {
    composeBackboneElementElements(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.hasSliceIsConstrainingElement()) {
      composeBoolean("sliceIsConstraining", element.getSliceIsConstrainingElement());
    }
    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.hasIsModifierReasonElement()) {
      composeString("isModifierReason", element.getIsModifierReasonElement());
    }
    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.hasProfile()) {
      for (CanonicalType e : element.getProfile())
        composeCanonical("profile", e);
    }
    if (element.hasTargetProfile()) {
      for (CanonicalType e : element.getTargetProfile())
        composeCanonical("targetProfile", e);
    }
    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()) {
      composeCanonical("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.hasValueSetElement()) {
      composeCanonical("valueSet", element.getValueSetElement());
    }
  }

  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 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 {
    composeBackboneElementElements(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()) {
      for (Reference e : element.getSubject())
        composeReference("subject", e);
    }
    if (element.hasServicePeriod()) {
      composePeriod("servicePeriod", element.getServicePeriod());
    }
    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);
    }
    if (element.hasPartOf()) {
      composeReference("partOf", element.getPartOf());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasExperimentalElement()) {
      composeBoolean("experimental", element.getExperimentalElement());
    }
    if (element.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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.hasUsageElement()) {
      composeString("usage", element.getUsageElement());
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasLibrary()) {
      for (CanonicalType e : element.getLibrary())
        composeCanonical("library", e);
    }
    if (element.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory());
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory());
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory());
    if (element.hasDoNotPerformElement()) {
      composeBoolean("doNotPerform", element.getDoNotPerformElement());
    }
    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()) {
      composeQuantity("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.hasSpecimenRequirement()) {
      for (Reference e : element.getSpecimenRequirement())
        composeReference("specimenRequirement", e);
    }
    if (element.hasObservationRequirement()) {
      for (Reference e : element.getObservationRequirement())
        composeReference("observationRequirement", e);
    }
    if (element.hasObservationResultRequirement()) {
      for (Reference e : element.getObservationResultRequirement())
        composeReference("observationResultRequirement", e);
    }
    if (element.hasTransformElement()) {
      composeCanonical("transform", element.getTransformElement());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasPathElement()) {
      composeString("path", element.getPathElement());
    }
    if (element.hasExpression()) {
      composeExpression("expression", element.getExpression());
    }
  }

  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.hasActualityElement())
      composeEnumeration("actuality", element.getActualityElement(),
          new AdverseEvent.AdverseEventActualityEnumFactory());
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasEvent()) {
      composeCodeableConcept("event", element.getEvent());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasDetectedElement()) {
      composeDateTime("detected", element.getDetectedElement());
    }
    if (element.hasRecordedDateElement()) {
      composeDateTime("recordedDate", element.getRecordedDateElement());
    }
    if (element.hasResultingCondition()) {
      for (Reference e : element.getResultingCondition())
        composeReference("resultingCondition", e);
    }
    if (element.hasLocation()) {
      composeReference("location", element.getLocation());
    }
    if (element.hasSeriousness()) {
      composeCodeableConcept("seriousness", element.getSeriousness());
    }
    if (element.hasSeverity()) {
      composeCodeableConcept("severity", element.getSeverity());
    }
    if (element.hasOutcome()) {
      composeCodeableConcept("outcome", element.getOutcome());
    }
    if (element.hasRecorder()) {
      composeReference("recorder", element.getRecorder());
    }
    if (element.hasContributor()) {
      for (Reference e : element.getContributor())
        composeReference("contributor", e);
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasInstance()) {
      composeReference("instance", element.getInstance());
    }
    if (element.hasCausality()) {
      for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality())
        composeAdverseEventAdverseEventSuspectEntityCausalityComponent("causality", e);
    }
  }

  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name,
      AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdverseEventAdverseEventSuspectEntityCausalityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentElements(
      AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAssessment()) {
      composeCodeableConcept("assessment", element.getAssessment());
    }
    if (element.hasProductRelatednessElement()) {
      composeString("productRelatedness", element.getProductRelatednessElement());
    }
    if (element.hasAuthor()) {
      composeReference("author", element.getAuthor());
    }
    if (element.hasMethod()) {
      composeCodeableConcept("method", element.getMethod());
    }
  }

  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.hasClinicalStatus()) {
      composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
    }
    if (element.hasVerificationStatus()) {
      composeCodeableConcept("verificationStatus", element.getVerificationStatus());
    }
    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.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasOnset()) {
      composeType("onset", element.getOnset());
    }
    if (element.hasRecordedDateElement()) {
      composeDateTime("recordedDate", element.getRecordedDateElement());
    }
    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 {
    composeBackboneElementElements(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.hasCancelationReason()) {
      composeCodeableConcept("cancelationReason", element.getCancelationReason());
    }
    if (element.hasServiceCategory()) {
      for (CodeableConcept e : element.getServiceCategory())
        composeCodeableConcept("serviceCategory", e);
    }
    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.hasReasonCode()) {
      for (CodeableConcept e : element.getReasonCode())
        composeCodeableConcept("reasonCode", e);
    }
    if (element.hasReasonReference()) {
      for (Reference e : element.getReasonReference())
        composeReference("reasonReference", 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.hasPatientInstructionElement()) {
      composeString("patientInstruction", element.getPatientInstructionElement());
    }
    if (element.hasBasedOn()) {
      for (Reference e : element.getBasedOn())
        composeReference("basedOn", 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 {
    composeBackboneElementElements(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());
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
  }

  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.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRole()) {
      for (CodeableConcept e : element.getRole())
        composeCodeableConcept("role", e);
    }
    if (element.hasWho()) {
      composeReference("who", element.getWho());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasSiteElement()) {
      composeString("site", element.getSiteElement());
    }
    if (element.hasObserver()) {
      composeReference("observer", element.getObserver());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasWhat()) {
      composeReference("what", element.getWhat());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasTypeElement()) {
      composeString("type", element.getTypeElement());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
  }

  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.hasDataElement()) {
      composeBase64Binary("data", element.getDataElement());
    }
  }

  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBiologicallyDerivedProductElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBiologicallyDerivedProductElements(BiologicallyDerivedProduct element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasProductCategoryElement())
      composeEnumeration("productCategory", element.getProductCategoryElement(),
          new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory());
    if (element.hasProductCode()) {
      composeCodeableConcept("productCode", element.getProductCode());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory());
    if (element.hasRequest()) {
      for (Reference e : element.getRequest())
        composeReference("request", e);
    }
    if (element.hasQuantityElement()) {
      composeInteger("quantity", element.getQuantityElement());
    }
    if (element.hasParent()) {
      for (Reference e : element.getParent())
        composeReference("parent", e);
    }
    if (element.hasCollection()) {
      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection",
          element.getCollection());
    }
    if (element.hasProcessing()) {
      for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing())
        composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent("processing", e);
    }
    if (element.hasManipulation()) {
      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation",
          element.getManipulation());
    }
    if (element.hasStorage()) {
      for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage())
        composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent("storage", e);
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name,
      BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentElements(
      BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCollector()) {
      composeReference("collector", element.getCollector());
    }
    if (element.hasSource()) {
      composeReference("source", element.getSource());
    }
    if (element.hasCollected()) {
      composeType("collected", element.getCollected());
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name,
      BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentElements(
      BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasProcedure()) {
      composeCodeableConcept("procedure", element.getProcedure());
    }
    if (element.hasAdditive()) {
      composeReference("additive", element.getAdditive());
    }
    if (element.hasTime()) {
      composeType("time", element.getTime());
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name,
      BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentElements(
      BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasTime()) {
      composeType("time", element.getTime());
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name,
      BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentElements(
      BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasTemperatureElement()) {
      composeDecimal("temperature", element.getTemperatureElement());
    }
    if (element.hasScaleElement())
      composeEnumeration("scale", element.getScaleElement(),
          new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory());
    if (element.hasDuration()) {
      composePeriod("duration", element.getDuration());
    }
  }

  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBodyStructureElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBodyStructureElements(BodyStructure 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.hasMorphology()) {
      composeCodeableConcept("morphology", element.getMorphology());
    }
    if (element.hasLocation()) {
      composeCodeableConcept("location", element.getLocation());
    }
    if (element.hasLocationQualifier()) {
      for (CodeableConcept e : element.getLocationQualifier())
        composeCodeableConcept("locationQualifier", 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.hasTimestampElement()) {
      composeInstant("timestamp", element.getTimestampElement());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 (CanonicalType e : element.getInstantiates())
        composeCanonical("instantiates", e);
    }
    if (element.hasImports()) {
      for (CanonicalType e : element.getImports())
        composeCanonical("imports", e);
    }
    if (element.hasSoftware()) {
      composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
    }
    if (element.hasImplementation()) {
      composeCapabilityStatementCapabilityStatementImplementationComponent("implementation",
          element.getImplementation());
    }
    if (element.hasFhirVersionElement())
      composeEnumeration("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory());
    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 (CanonicalType e : element.getImplementationGuide())
        composeCanonical("implementationGuide", 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasUrlElement()) {
      composeUrl("url", element.getUrlElement());
    }
    if (element.hasCustodian()) {
      composeReference("custodian", element.getCustodian());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasModeElement())
      composeEnumeration("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("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.CapabilityStatementRestResourceOperationComponent e : element.getOperation())
        composeCapabilityStatementCapabilityStatementRestResourceOperationComponent("operation", e);
    }
    if (element.hasCompartment()) {
      for (CanonicalType e : element.getCompartment())
        composeCanonical("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 {
    composeBackboneElementElements(element);
    if (element.hasCorsElement()) {
      composeBoolean("cors", element.getCorsElement());
    }
    if (element.hasService()) {
      for (CodeableConcept e : element.getService())
        composeCodeableConcept("service", e);
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasTypeElement()) {
      composeCode("type", element.getTypeElement());
    }
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
    if (element.hasSupportedProfile()) {
      for (CanonicalType e : element.getSupportedProfile())
        composeCanonical("supportedProfile", e);
    }
    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);
    }
    if (element.hasOperation()) {
      for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation())
        composeCapabilityStatementCapabilityStatementRestResourceOperationComponent("operation", 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 {
    composeBackboneElementElements(element);
    if (element.hasCodeElement())
      composeEnumeration("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("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 {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasDefinitionElement()) {
      composeCanonical("definition", element.getDefinitionElement());
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name,
      CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentElements(
      CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasDefinitionElement()) {
      composeCanonical("definition", element.getDefinitionElement());
    }
    if (element.hasDocumentationElement()) {
      composeMarkdown("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 {
    composeBackboneElementElements(element);
    if (element.hasCodeElement())
      composeEnumeration("code", element.getCodeElement(),
          new CapabilityStatement.SystemRestfulInteractionEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasEndpoint()) {
      for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint())
        composeCapabilityStatementCapabilityStatementMessagingEndpointComponent("endpoint", e);
    }
    if (element.hasReliableCacheElement()) {
      composeUnsignedInt("reliableCache", element.getReliableCacheElement());
    }
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
    if (element.hasSupportedMessage()) {
      for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage())
        composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent("supportedMessage", 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 {
    composeBackboneElementElements(element);
    if (element.hasProtocol()) {
      composeCoding("protocol", element.getProtocol());
    }
    if (element.hasAddressElement()) {
      composeUrl("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 {
    composeBackboneElementElements(element);
    if (element.hasModeElement())
      composeEnumeration("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory());
    if (element.hasDefinitionElement()) {
      composeCanonical("definition", element.getDefinitionElement());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasModeElement())
      composeEnumeration("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
  }

  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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", 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.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasCreatedElement()) {
      composeDateTime("created", element.getCreatedElement());
    }
    if (element.hasAuthor()) {
      composeReference("author", element.getAuthor());
    }
    if (element.hasContributor()) {
      for (Reference e : element.getContributor())
        composeReference("contributor", 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory());
    if (element.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", e);
    }
    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.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    if (element.hasDoNotPerformElement()) {
      composeBoolean("doNotPerform", element.getDoNotPerformElement());
    }
    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()) {
      composeQuantity("dailyAmount", element.getDailyAmount());
    }
    if (element.hasQuantity()) {
      composeQuantity("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.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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.hasTelecom()) {
      for (ContactPoint e : element.getTelecom())
        composeContactPoint("telecom", 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 {
    composeBackboneElementElements(element);
    if (element.hasRole()) {
      for (CodeableConcept e : element.getRole())
        composeCodeableConcept("role", e);
    }
    if (element.hasMember()) {
      composeReference("member", element.getMember());
    }
    if (element.hasOnBehalfOf()) {
      composeReference("onBehalfOf", element.getOnBehalfOf());
    }
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
  }

  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCatalogEntryElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCatalogEntryElements(CatalogEntry element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasOrderableElement()) {
      composeBoolean("orderable", element.getOrderableElement());
    }
    if (element.hasReferencedItem()) {
      composeReference("referencedItem", element.getReferencedItem());
    }
    if (element.hasAdditionalIdentifier()) {
      for (Identifier e : element.getAdditionalIdentifier())
        composeIdentifier("additionalIdentifier", e);
    }
    if (element.hasClassification()) {
      for (CodeableConcept e : element.getClassification())
        composeCodeableConcept("classification", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasValidityPeriod()) {
      composePeriod("validityPeriod", element.getValidityPeriod());
    }
    if (element.hasValidToElement()) {
      composeDateTime("validTo", element.getValidToElement());
    }
    if (element.hasLastUpdatedElement()) {
      composeDateTime("lastUpdated", element.getLastUpdatedElement());
    }
    if (element.hasAdditionalCharacteristic()) {
      for (CodeableConcept e : element.getAdditionalCharacteristic())
        composeCodeableConcept("additionalCharacteristic", e);
    }
    if (element.hasAdditionalClassification()) {
      for (CodeableConcept e : element.getAdditionalClassification())
        composeCodeableConcept("additionalClassification", e);
    }
    if (element.hasRelatedEntry()) {
      for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry())
        composeCatalogEntryCatalogEntryRelatedEntryComponent("relatedEntry", e);
    }
  }

  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name,
      CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCatalogEntryCatalogEntryRelatedEntryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentElements(
      CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRelationtypeElement())
      composeEnumeration("relationtype", element.getRelationtypeElement(),
          new CatalogEntry.CatalogEntryRelationTypeEnumFactory());
    if (element.hasItem()) {
      composeReference("item", element.getItem());
    }
  }

  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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasDefinitionUri()) {
      for (UriType e : element.getDefinitionUri())
        composeUri("definitionUri", e);
    }
    if (element.hasDefinitionCanonical()) {
      for (CanonicalType e : element.getDefinitionCanonical())
        composeCanonical("definitionCanonical", 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.hasPerformer()) {
      for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer())
        composeChargeItemChargeItemPerformerComponent("performer", e);
    }
    if (element.hasPerformingOrganization()) {
      composeReference("performingOrganization", element.getPerformingOrganization());
    }
    if (element.hasRequestingOrganization()) {
      composeReference("requestingOrganization", element.getRequestingOrganization());
    }
    if (element.hasCostCenter()) {
      composeReference("costCenter", element.getCostCenter());
    }
    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.hasProduct()) {
      composeType("product", element.getProduct());
    }
    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 composeChargeItemChargeItemPerformerComponent(String name,
      ChargeItem.ChargeItemPerformerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemChargeItemPerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemChargeItemPerformerComponentElements(ChargeItem.ChargeItemPerformerComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemDefinitionElements(ChargeItemDefinition 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.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasDerivedFromUri()) {
      for (UriType e : element.getDerivedFromUri())
        composeUri("derivedFromUri", e);
    }
    if (element.hasPartOf()) {
      for (CanonicalType e : element.getPartOf())
        composeCanonical("partOf", e);
    }
    if (element.hasReplaces()) {
      for (CanonicalType e : element.getReplaces())
        composeCanonical("replaces", e);
    }
    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.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasInstance()) {
      for (Reference e : element.getInstance())
        composeReference("instance", e);
    }
    if (element.hasApplicability()) {
      for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability())
        composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent("applicability", e);
    }
    if (element.hasPropertyGroup()) {
      for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup())
        composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent("propertyGroup", e);
    }
  }

  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name,
      ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentElements(
      ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasLanguageElement()) {
      composeString("language", element.getLanguageElement());
    }
    if (element.hasExpressionElement()) {
      composeString("expression", element.getExpressionElement());
    }
  }

  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name,
      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentElements(
      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasApplicability()) {
      for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability())
        composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent("applicability", e);
    }
    if (element.hasPriceComponent()) {
      for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element
          .getPriceComponent())
        composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent("priceComponent", e);
    }
  }

  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name,
      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentElements(
      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(),
          new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory());
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasFactorElement()) {
      composeDecimal("factor", element.getFactorElement());
    }
    if (element.hasAmount()) {
      composeMoney("amount", element.getAmount());
    }
  }

  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()) {
      composeCodeableConcept("subType", element.getSubType());
    }
    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.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.hasSupportingInfo()) {
      for (Claim.SupportingInformationComponent e : element.getSupportingInfo())
        composeClaimSupportingInformationComponent("supportingInfo", 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.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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    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 {
    composeBackboneElementElements(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 composeClaimSupportingInformationComponent(String name, Claim.SupportingInformationComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimSupportingInformationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimSupportingInformationComponentElements(Claim.SupportingInformationComponent element)
      throws IOException {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasOnAdmission()) {
      composeCodeableConcept("onAdmission", element.getOnAdmission());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasType()) {
      for (CodeableConcept e : element.getType())
        composeCodeableConcept("type", e);
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasProcedure()) {
      composeType("procedure", element.getProcedure());
    }
    if (element.hasUdi()) {
      for (Reference e : element.getUdi())
        composeReference("udi", e);
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasFocalElement()) {
      composeBoolean("focal", element.getFocalElement());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasCareTeamSequence()) {
      for (PositiveIntType e : element.getCareTeamSequence())
        composePositiveInt("careTeamSequence", e);
    }
    if (element.hasDiagnosisSequence()) {
      for (PositiveIntType e : element.getDiagnosisSequence())
        composePositiveInt("diagnosisSequence", e);
    }
    if (element.hasProcedureSequence()) {
      for (PositiveIntType e : element.getProcedureSequence())
        composePositiveInt("procedureSequence", e);
    }
    if (element.hasInformationSequence()) {
      for (PositiveIntType e : element.getInformationSequence())
        composePositiveInt("informationSequence", e);
    }
    if (element.hasRevenue()) {
      composeCodeableConcept("revenue", element.getRevenue());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasRevenue()) {
      composeCodeableConcept("revenue", element.getRevenue());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasRevenue()) {
      composeCodeableConcept("revenue", element.getRevenue());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubType()) {
      composeCodeableConcept("subType", element.getSubType());
    }
    if (element.hasUseElement())
      composeEnumeration("use", element.getUseElement(), new ClaimResponse.UseEnumFactory());
    if (element.hasPatient()) {
      composeReference("patient", element.getPatient());
    }
    if (element.hasCreatedElement()) {
      composeDateTime("created", element.getCreatedElement());
    }
    if (element.hasInsurer()) {
      composeReference("insurer", element.getInsurer());
    }
    if (element.hasRequestor()) {
      composeReference("requestor", element.getRequestor());
    }
    if (element.hasRequest()) {
      composeReference("request", element.getRequest());
    }
    if (element.hasOutcomeElement())
      composeEnumeration("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory());
    if (element.hasDispositionElement()) {
      composeString("disposition", element.getDispositionElement());
    }
    if (element.hasPreAuthRefElement()) {
      composeString("preAuthRef", element.getPreAuthRefElement());
    }
    if (element.hasPreAuthPeriod()) {
      composePeriod("preAuthPeriod", element.getPreAuthPeriod());
    }
    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.hasAdjudication()) {
      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
        composeClaimResponseAdjudicationComponent("adjudication", e);
    }
    if (element.hasTotal()) {
      for (ClaimResponse.TotalComponent e : element.getTotal())
        composeClaimResponseTotalComponent("total", e);
    }
    if (element.hasPayment()) {
      composeClaimResponsePaymentComponent("payment", element.getPayment());
    }
    if (element.hasFundsReserve()) {
      composeCodeableConcept("fundsReserve", element.getFundsReserve());
    }
    if (element.hasFormCode()) {
      composeCodeableConcept("formCode", element.getFormCode());
    }
    if (element.hasForm()) {
      composeAttachment("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);
    }
    if (element.hasError()) {
      for (ClaimResponse.ErrorComponent e : element.getError())
        composeClaimResponseErrorComponent("error", 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 {
    composeBackboneElementElements(element);
    if (element.hasItemSequenceElement()) {
      composePositiveInt("itemSequence", element.getItemSequenceElement());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasDetailSequenceElement()) {
      composePositiveInt("detailSequence", element.getDetailSequenceElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasSubDetailSequenceElement()) {
      composePositiveInt("subDetailSequence", element.getSubDetailSequenceElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasItemSequence()) {
      for (PositiveIntType e : element.getItemSequence())
        composePositiveInt("itemSequence", e);
    }
    if (element.hasDetailSequence()) {
      for (PositiveIntType e : element.getDetailSequence())
        composePositiveInt("detailSequence", e);
    }
    if (element.hasSubdetailSequence()) {
      for (PositiveIntType e : element.getSubdetailSequence())
        composePositiveInt("subdetailSequence", e);
    }
    if (element.hasProvider()) {
      for (Reference e : element.getProvider())
        composeReference("provider", e);
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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.hasBodySite()) {
      composeCodeableConcept("bodySite", element.getBodySite());
    }
    if (element.hasSubSite()) {
      for (CodeableConcept e : element.getSubSite())
        composeCodeableConcept("subSite", e);
    }
    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.AddedItemDetailComponent e : element.getDetail())
        composeClaimResponseAddedItemDetailComponent("detail", e);
    }
  }

  protected void composeClaimResponseAddedItemDetailComponent(String name,
      ClaimResponse.AddedItemDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseAddedItemDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseAddedItemDetailComponentElements(ClaimResponse.AddedItemDetailComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    if (element.hasModifier()) {
      for (CodeableConcept e : element.getModifier())
        composeCodeableConcept("modifier", e);
    }
    if (element.hasQuantity()) {
      composeQuantity("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.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.AddedItemSubDetailComponent e : element.getSubDetail())
        composeClaimResponseAddedItemSubDetailComponent("subDetail", e);
    }
  }

  protected void composeClaimResponseAddedItemSubDetailComponent(String name,
      ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseAddedItemSubDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseAddedItemSubDetailComponentElements(
      ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    if (element.hasModifier()) {
      for (CodeableConcept e : element.getModifier())
        composeCodeableConcept("modifier", e);
    }
    if (element.hasQuantity()) {
      composeQuantity("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.hasNoteNumber()) {
      for (PositiveIntType e : element.getNoteNumber())
        composePositiveInt("noteNumber", e);
    }
    if (element.hasAdjudication()) {
      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
        composeClaimResponseAdjudicationComponent("adjudication", e);
    }
  }

  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClaimResponseTotalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClaimResponseTotalComponentElements(ClaimResponse.TotalComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasAmount()) {
      composeMoney("amount", element.getAmount());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasNumberElement()) {
      composePositiveInt("number", element.getNumberElement());
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory());
    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 {
    composeBackboneElementElements(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.hasClaimResponse()) {
      composeReference("claimResponse", element.getClaimResponse());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasItemSequenceElement()) {
      composePositiveInt("itemSequence", element.getItemSequenceElement());
    }
    if (element.hasDetailSequenceElement()) {
      composePositiveInt("detailSequence", element.getDetailSequenceElement());
    }
    if (element.hasSubDetailSequenceElement()) {
      composePositiveInt("subDetailSequence", element.getSubDetailSequenceElement());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
  }

  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.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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.hasSupportingInfo()) {
      for (Reference e : element.getSupportingInfo())
        composeReference("supportingInfo", 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasItemCodeableConcept()) {
      composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
    }
    if (element.hasItemReference()) {
      composeReference("itemReference", element.getItemReference());
    }
    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()) {
      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.hasCaseSensitiveElement()) {
      composeBoolean("caseSensitive", element.getCaseSensitiveElement());
    }
    if (element.hasValueSetElement()) {
      composeCanonical("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.hasSupplementsElement()) {
      composeCanonical("supplements", element.getSupplementsElement());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", 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.hasInResponseTo()) {
      for (Reference e : element.getInResponseTo())
        composeReference("inResponseTo", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory());
    if (element.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(),
          new Communication.CommunicationPriorityEnumFactory());
    if (element.hasMedium()) {
      for (CodeableConcept e : element.getMedium())
        composeCodeableConcept("medium", e);
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasTopic()) {
      composeCodeableConcept("topic", element.getTopic());
    }
    if (element.hasAbout()) {
      for (Reference e : element.getAbout())
        composeReference("about", e);
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasSentElement()) {
      composeDateTime("sent", element.getSentElement());
    }
    if (element.hasReceivedElement()) {
      composeDateTime("received", element.getReceivedElement());
    }
    if (element.hasRecipient()) {
      for (Reference e : element.getRecipient())
        composeReference("recipient", e);
    }
    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 {
    composeBackboneElementElements(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.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(),
          new CommunicationRequest.CommunicationPriorityEnumFactory());
    if (element.hasDoNotPerformElement()) {
      composeBoolean("doNotPerform", element.getDoNotPerformElement());
    }
    if (element.hasMedium()) {
      for (CodeableConcept e : element.getMedium())
        composeCodeableConcept("medium", e);
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasAbout()) {
      for (Reference e : element.getAbout())
        composeReference("about", e);
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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.hasRequester()) {
      composeReference("requester", element.getRequester());
    }
    if (element.hasRecipient()) {
      for (Reference e : element.getRecipient())
        composeReference("recipient", e);
    }
    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.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 {
    composeBackboneElementElements(element);
    if (element.hasContent()) {
      composeType("content", element.getContent());
    }
  }

  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.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.hasPurposeElement()) {
      composeMarkdown("purpose", element.getPurposeElement());
    }
    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 {
    composeBackboneElementElements(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.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasModeElement())
      composeEnumeration("mode", element.getModeElement(), 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasAuthor()) {
      for (Reference e : element.getAuthor())
        composeReference("author", e);
    }
    if (element.hasFocus()) {
      composeReference("focus", element.getFocus());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasPropertyElement()) {
      composeUri("property", element.getPropertyElement());
    }
    if (element.hasSystemElement()) {
      composeCanonical("system", element.getSystemElement());
    }
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
    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 {
    composeBackboneElementElements(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()) {
      composeCanonical("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.hasClinicalStatus()) {
      composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
    }
    if (element.hasVerificationStatus()) {
      composeCodeableConcept("verificationStatus", element.getVerificationStatus());
    }
    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.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasOnset()) {
      composeType("onset", element.getOnset());
    }
    if (element.hasAbatement()) {
      composeType("abatement", element.getAbatement());
    }
    if (element.hasRecordedDateElement()) {
      composeDateTime("recordedDate", element.getRecordedDateElement());
    }
    if (element.hasRecorder()) {
      composeReference("recorder", element.getRecorder());
    }
    if (element.hasAsserter()) {
      composeReference("asserter", element.getAsserter());
    }
    if (element.hasStage()) {
      for (Condition.ConditionStageComponent e : element.getStage())
        composeConditionConditionStageComponent("stage", e);
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasSummary()) {
      composeCodeableConcept("summary", element.getSummary());
    }
    if (element.hasAssessment()) {
      for (Reference e : element.getAssessment())
        composeReference("assessment", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
  }

  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 {
    composeBackboneElementElements(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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory());
    if (element.hasScope()) {
      composeCodeableConcept("scope", element.getScope());
    }
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasPatient()) {
      composeReference("patient", element.getPatient());
    }
    if (element.hasDateTimeElement()) {
      composeDateTime("dateTime", element.getDateTimeElement());
    }
    if (element.hasPerformer()) {
      for (Reference e : element.getPerformer())
        composeReference("performer", 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.hasPolicyRule()) {
      composeCodeableConcept("policyRule", element.getPolicyRule());
    }
    if (element.hasVerification()) {
      for (Consent.ConsentVerificationComponent e : element.getVerification())
        composeConsentConsentVerificationComponent("verification", e);
    }
    if (element.hasProvision()) {
      composeConsentprovisionComponent("provision", element.getProvision());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasAuthorityElement()) {
      composeUri("authority", element.getAuthorityElement());
    }
    if (element.hasUriElement()) {
      composeUri("uri", element.getUriElement());
    }
  }

  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentConsentVerificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentConsentVerificationComponentElements(Consent.ConsentVerificationComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasVerifiedElement()) {
      composeBoolean("verified", element.getVerifiedElement());
    }
    if (element.hasVerifiedWith()) {
      composeReference("verifiedWith", element.getVerifiedWith());
    }
    if (element.hasVerificationDateElement()) {
      composeDateTime("verificationDate", element.getVerificationDateElement());
    }
  }

  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentprovisionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentprovisionComponentElements(Consent.provisionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory());
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasActor()) {
      for (Consent.provisionActorComponent e : element.getActor())
        composeConsentprovisionActorComponent("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 (CodeableConcept e : element.getCode())
        composeCodeableConcept("code", e);
    }
    if (element.hasDataPeriod()) {
      composePeriod("dataPeriod", element.getDataPeriod());
    }
    if (element.hasData()) {
      for (Consent.provisionDataComponent e : element.getData())
        composeConsentprovisionDataComponent("data", e);
    }
    if (element.hasProvision()) {
      for (Consent.provisionComponent e : element.getProvision())
        composeConsentprovisionComponent("provision", e);
    }
  }

  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentprovisionActorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentprovisionActorComponentElements(Consent.provisionActorComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
  }

  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConsentprovisionDataComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConsentprovisionDataComponentElements(Consent.provisionDataComponent element)
      throws IOException {
    composeBackboneElementElements(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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory());
    if (element.hasLegalState()) {
      composeCodeableConcept("legalState", element.getLegalState());
    }
    if (element.hasInstantiatesCanonical()) {
      composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
    }
    if (element.hasInstantiatesUriElement()) {
      composeUri("instantiatesUri", element.getInstantiatesUriElement());
    }
    if (element.hasContentDerivative()) {
      composeCodeableConcept("contentDerivative", element.getContentDerivative());
    }
    if (element.hasIssuedElement()) {
      composeDateTime("issued", element.getIssuedElement());
    }
    if (element.hasApplies()) {
      composePeriod("applies", element.getApplies());
    }
    if (element.hasExpirationType()) {
      composeCodeableConcept("expirationType", element.getExpirationType());
    }
    if (element.hasSubject()) {
      for (Reference e : element.getSubject())
        composeReference("subject", 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.hasSite()) {
      for (Reference e : element.getSite())
        composeReference("site", e);
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasAlias()) {
      for (StringType e : element.getAlias())
        composeString("alias", e);
    }
    if (element.hasAuthor()) {
      composeReference("author", element.getAuthor());
    }
    if (element.hasScope()) {
      composeCodeableConcept("scope", element.getScope());
    }
    if (element.hasTopic()) {
      composeType("topic", element.getTopic());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubType()) {
      for (CodeableConcept e : element.getSubType())
        composeCodeableConcept("subType", e);
    }
    if (element.hasContentDefinition()) {
      composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
    }
    if (element.hasTerm()) {
      for (Contract.TermComponent e : element.getTerm())
        composeContractTermComponent("term", e);
    }
    if (element.hasSupportingInfo()) {
      for (Reference e : element.getSupportingInfo())
        composeReference("supportingInfo", e);
    }
    if (element.hasRelevantHistory()) {
      for (Reference e : element.getRelevantHistory())
        composeReference("relevantHistory", e);
    }
    if (element.hasSigner()) {
      for (Contract.SignatoryComponent e : element.getSigner())
        composeContractSignatoryComponent("signer", e);
    }
    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);
    }
    if (element.hasLegallyBinding()) {
      composeType("legallyBinding", element.getLegallyBinding());
    }
  }

  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractContentDefinitionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractContentDefinitionComponentElements(Contract.ContentDefinitionComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubType()) {
      composeCodeableConcept("subType", element.getSubType());
    }
    if (element.hasPublisher()) {
      composeReference("publisher", element.getPublisher());
    }
    if (element.hasPublicationDateElement()) {
      composeDateTime("publicationDate", element.getPublicationDateElement());
    }
    if (element.hasPublicationStatusElement())
      composeEnumeration("publicationStatus", element.getPublicationStatusElement(),
          new Contract.ContractPublicationStatusEnumFactory());
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasIssuedElement()) {
      composeDateTime("issued", element.getIssuedElement());
    }
    if (element.hasApplies()) {
      composePeriod("applies", element.getApplies());
    }
    if (element.hasTopic()) {
      composeType("topic", element.getTopic());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubType()) {
      composeCodeableConcept("subType", element.getSubType());
    }
    if (element.hasTextElement()) {
      composeString("text", element.getTextElement());
    }
    if (element.hasSecurityLabel()) {
      for (Contract.SecurityLabelComponent e : element.getSecurityLabel())
        composeContractSecurityLabelComponent("securityLabel", e);
    }
    if (element.hasOffer()) {
      composeContractContractOfferComponent("offer", element.getOffer());
    }
    if (element.hasAsset()) {
      for (Contract.ContractAssetComponent e : element.getAsset())
        composeContractContractAssetComponent("asset", e);
    }
    if (element.hasAction()) {
      for (Contract.ActionComponent e : element.getAction())
        composeContractActionComponent("action", e);
    }
    if (element.hasGroup()) {
      for (Contract.TermComponent e : element.getGroup())
        composeContractTermComponent("group", e);
    }
  }

  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractSecurityLabelComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractSecurityLabelComponentElements(Contract.SecurityLabelComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNumber()) {
      for (UnsignedIntType e : element.getNumber())
        composeUnsignedInt("number", e);
    }
    if (element.hasClassification()) {
      composeCoding("classification", element.getClassification());
    }
    if (element.hasCategory()) {
      for (Coding e : element.getCategory())
        composeCoding("category", e);
    }
    if (element.hasControl()) {
      for (Coding e : element.getControl())
        composeCoding("control", e);
    }
  }

  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractContractOfferComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractContractOfferComponentElements(Contract.ContractOfferComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasParty()) {
      for (Contract.ContractPartyComponent e : element.getParty())
        composeContractContractPartyComponent("party", e);
    }
    if (element.hasTopic()) {
      composeReference("topic", element.getTopic());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDecision()) {
      composeCodeableConcept("decision", element.getDecision());
    }
    if (element.hasDecisionMode()) {
      for (CodeableConcept e : element.getDecisionMode())
        composeCodeableConcept("decisionMode", e);
    }
    if (element.hasAnswer()) {
      for (Contract.AnswerComponent e : element.getAnswer())
        composeContractAnswerComponent("answer", e);
    }
    if (element.hasTextElement()) {
      composeString("text", element.getTextElement());
    }
    if (element.hasLinkId()) {
      for (StringType e : element.getLinkId())
        composeString("linkId", e);
    }
    if (element.hasSecurityLabelNumber()) {
      for (UnsignedIntType e : element.getSecurityLabelNumber())
        composeUnsignedInt("securityLabelNumber", e);
    }
  }

  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractContractPartyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractContractPartyComponentElements(Contract.ContractPartyComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasReference()) {
      for (Reference e : element.getReference())
        composeReference("reference", e);
    }
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
  }

  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractAnswerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractAnswerComponentElements(Contract.AnswerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
  }

  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractContractAssetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractContractAssetComponentElements(Contract.ContractAssetComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasScope()) {
      composeCodeableConcept("scope", element.getScope());
    }
    if (element.hasType()) {
      for (CodeableConcept e : element.getType())
        composeCodeableConcept("type", e);
    }
    if (element.hasTypeReference()) {
      for (Reference e : element.getTypeReference())
        composeReference("typeReference", e);
    }
    if (element.hasSubtype()) {
      for (CodeableConcept e : element.getSubtype())
        composeCodeableConcept("subtype", e);
    }
    if (element.hasRelationship()) {
      composeCoding("relationship", element.getRelationship());
    }
    if (element.hasContext()) {
      for (Contract.AssetContextComponent e : element.getContext())
        composeContractAssetContextComponent("context", e);
    }
    if (element.hasConditionElement()) {
      composeString("condition", element.getConditionElement());
    }
    if (element.hasPeriodType()) {
      for (CodeableConcept e : element.getPeriodType())
        composeCodeableConcept("periodType", e);
    }
    if (element.hasPeriod()) {
      for (Period e : element.getPeriod())
        composePeriod("period", e);
    }
    if (element.hasUsePeriod()) {
      for (Period e : element.getUsePeriod())
        composePeriod("usePeriod", e);
    }
    if (element.hasTextElement()) {
      composeString("text", element.getTextElement());
    }
    if (element.hasLinkId()) {
      for (StringType e : element.getLinkId())
        composeString("linkId", e);
    }
    if (element.hasAnswer()) {
      for (Contract.AnswerComponent e : element.getAnswer())
        composeContractAnswerComponent("answer", e);
    }
    if (element.hasSecurityLabelNumber()) {
      for (UnsignedIntType e : element.getSecurityLabelNumber())
        composeUnsignedInt("securityLabelNumber", e);
    }
    if (element.hasValuedItem()) {
      for (Contract.ValuedItemComponent e : element.getValuedItem())
        composeContractValuedItemComponent("valuedItem", e);
    }
  }

  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractAssetContextComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractAssetContextComponentElements(Contract.AssetContextComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
    if (element.hasCode()) {
      for (CodeableConcept e : element.getCode())
        composeCodeableConcept("code", e);
    }
    if (element.hasTextElement()) {
      composeString("text", element.getTextElement());
    }
  }

  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 {
    composeBackboneElementElements(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()) {
      composeQuantity("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());
    }
    if (element.hasPaymentElement()) {
      composeString("payment", element.getPaymentElement());
    }
    if (element.hasPaymentDateElement()) {
      composeDateTime("paymentDate", element.getPaymentDateElement());
    }
    if (element.hasResponsible()) {
      composeReference("responsible", element.getResponsible());
    }
    if (element.hasRecipient()) {
      composeReference("recipient", element.getRecipient());
    }
    if (element.hasLinkId()) {
      for (StringType e : element.getLinkId())
        composeString("linkId", e);
    }
    if (element.hasSecurityLabelNumber()) {
      for (UnsignedIntType e : element.getSecurityLabelNumber())
        composeUnsignedInt("securityLabelNumber", e);
    }
  }

  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractActionComponentElements(Contract.ActionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDoNotPerformElement()) {
      composeBoolean("doNotPerform", element.getDoNotPerformElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubject()) {
      for (Contract.ActionSubjectComponent e : element.getSubject())
        composeContractActionSubjectComponent("subject", e);
    }
    if (element.hasIntent()) {
      composeCodeableConcept("intent", element.getIntent());
    }
    if (element.hasLinkId()) {
      for (StringType e : element.getLinkId())
        composeString("linkId", e);
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasContext()) {
      composeReference("context", element.getContext());
    }
    if (element.hasContextLinkId()) {
      for (StringType e : element.getContextLinkId())
        composeString("contextLinkId", e);
    }
    if (element.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }
    if (element.hasRequester()) {
      for (Reference e : element.getRequester())
        composeReference("requester", e);
    }
    if (element.hasRequesterLinkId()) {
      for (StringType e : element.getRequesterLinkId())
        composeString("requesterLinkId", e);
    }
    if (element.hasPerformerType()) {
      for (CodeableConcept e : element.getPerformerType())
        composeCodeableConcept("performerType", e);
    }
    if (element.hasPerformerRole()) {
      composeCodeableConcept("performerRole", element.getPerformerRole());
    }
    if (element.hasPerformer()) {
      composeReference("performer", element.getPerformer());
    }
    if (element.hasPerformerLinkId()) {
      for (StringType e : element.getPerformerLinkId())
        composeString("performerLinkId", 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.hasReason()) {
      for (StringType e : element.getReason())
        composeString("reason", e);
    }
    if (element.hasReasonLinkId()) {
      for (StringType e : element.getReasonLinkId())
        composeString("reasonLinkId", e);
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
    if (element.hasSecurityLabelNumber()) {
      for (UnsignedIntType e : element.getSecurityLabelNumber())
        composeUnsignedInt("securityLabelNumber", e);
    }
  }

  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractActionSubjectComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractActionSubjectComponentElements(Contract.ActionSubjectComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasReference()) {
      for (Reference e : element.getReference())
        composeReference("reference", e);
    }
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
  }

  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 {
    composeBackboneElementElements(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 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasDependentElement()) {
      composeString("dependent", element.getDependentElement());
    }
    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.hasClass_()) {
      for (Coverage.ClassComponent e : element.getClass_())
        composeCoverageClassComponent("class", e);
    }
    if (element.hasOrderElement()) {
      composePositiveInt("order", element.getOrderElement());
    }
    if (element.hasNetworkElement()) {
      composeString("network", element.getNetworkElement());
    }
    if (element.hasCostToBeneficiary()) {
      for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary())
        composeCoverageCostToBeneficiaryComponent("costToBeneficiary", e);
    }
    if (element.hasSubrogationElement()) {
      composeBoolean("subrogation", element.getSubrogationElement());
    }
    if (element.hasContract()) {
      for (Reference e : element.getContract())
        composeReference("contract", e);
    }
  }

  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageClassComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageClassComponentElements(Coverage.ClassComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
  }

  protected void composeCoverageCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageCostToBeneficiaryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageCostToBeneficiaryComponentElements(Coverage.CostToBeneficiaryComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
    if (element.hasException()) {
      for (Coverage.ExemptionComponent e : element.getException())
        composeCoverageExemptionComponent("exception", e);
    }
  }

  protected void composeCoverageExemptionComponent(String name, Coverage.ExemptionComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageExemptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageExemptionComponentElements(Coverage.ExemptionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
  }

  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityRequestElements(CoverageEligibilityRequest element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory());
    if (element.hasPriority()) {
      composeCodeableConcept("priority", element.getPriority());
    }
    if (element.hasPurpose())
      for (Enumeration e : element.getPurpose())
        composeEnumeration("purpose", e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory());
    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.hasInsurer()) {
      composeReference("insurer", element.getInsurer());
    }
    if (element.hasFacility()) {
      composeReference("facility", element.getFacility());
    }
    if (element.hasSupportingInfo()) {
      for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo())
        composeCoverageEligibilityRequestSupportingInformationComponent("supportingInfo", e);
    }
    if (element.hasInsurance()) {
      for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance())
        composeCoverageEligibilityRequestInsuranceComponent("insurance", e);
    }
    if (element.hasItem()) {
      for (CoverageEligibilityRequest.DetailsComponent e : element.getItem())
        composeCoverageEligibilityRequestDetailsComponent("item", e);
    }
  }

  protected void composeCoverageEligibilityRequestSupportingInformationComponent(String name,
      CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityRequestSupportingInformationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityRequestSupportingInformationComponentElements(
      CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasInformation()) {
      composeReference("information", element.getInformation());
    }
    if (element.hasAppliesToAllElement()) {
      composeBoolean("appliesToAll", element.getAppliesToAllElement());
    }
  }

  protected void composeCoverageEligibilityRequestInsuranceComponent(String name,
      CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityRequestInsuranceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityRequestInsuranceComponentElements(
      CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFocalElement()) {
      composeBoolean("focal", element.getFocalElement());
    }
    if (element.hasCoverage()) {
      composeReference("coverage", element.getCoverage());
    }
    if (element.hasBusinessArrangementElement()) {
      composeString("businessArrangement", element.getBusinessArrangementElement());
    }
  }

  protected void composeCoverageEligibilityRequestDetailsComponent(String name,
      CoverageEligibilityRequest.DetailsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityRequestDetailsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityRequestDetailsComponentElements(
      CoverageEligibilityRequest.DetailsComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSupportingInfoSequence()) {
      for (PositiveIntType e : element.getSupportingInfoSequence())
        composePositiveInt("supportingInfoSequence", e);
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    if (element.hasModifier()) {
      for (CodeableConcept e : element.getModifier())
        composeCodeableConcept("modifier", e);
    }
    if (element.hasProvider()) {
      composeReference("provider", element.getProvider());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasUnitPrice()) {
      composeMoney("unitPrice", element.getUnitPrice());
    }
    if (element.hasFacility()) {
      composeReference("facility", element.getFacility());
    }
    if (element.hasDiagnosis()) {
      for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis())
        composeCoverageEligibilityRequestDiagnosisComponent("diagnosis", e);
    }
    if (element.hasDetail()) {
      for (Reference e : element.getDetail())
        composeReference("detail", e);
    }
  }

  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name,
      CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityRequestDiagnosisComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityRequestDiagnosisComponentElements(
      CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDiagnosis()) {
      composeType("diagnosis", element.getDiagnosis());
    }
  }

  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityResponseElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityResponseElements(CoverageEligibilityResponse element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory());
    if (element.hasPurpose())
      for (Enumeration e : element.getPurpose())
        composeEnumeration("purpose", e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory());
    if (element.hasPatient()) {
      composeReference("patient", element.getPatient());
    }
    if (element.hasServiced()) {
      composeType("serviced", element.getServiced());
    }
    if (element.hasCreatedElement()) {
      composeDateTime("created", element.getCreatedElement());
    }
    if (element.hasRequestor()) {
      composeReference("requestor", element.getRequestor());
    }
    if (element.hasRequest()) {
      composeReference("request", element.getRequest());
    }
    if (element.hasOutcomeElement())
      composeEnumeration("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory());
    if (element.hasDispositionElement()) {
      composeString("disposition", element.getDispositionElement());
    }
    if (element.hasInsurer()) {
      composeReference("insurer", element.getInsurer());
    }
    if (element.hasInsurance()) {
      for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance())
        composeCoverageEligibilityResponseInsuranceComponent("insurance", e);
    }
    if (element.hasPreAuthRefElement()) {
      composeString("preAuthRef", element.getPreAuthRefElement());
    }
    if (element.hasForm()) {
      composeCodeableConcept("form", element.getForm());
    }
    if (element.hasError()) {
      for (CoverageEligibilityResponse.ErrorsComponent e : element.getError())
        composeCoverageEligibilityResponseErrorsComponent("error", e);
    }
  }

  protected void composeCoverageEligibilityResponseInsuranceComponent(String name,
      CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityResponseInsuranceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityResponseInsuranceComponentElements(
      CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCoverage()) {
      composeReference("coverage", element.getCoverage());
    }
    if (element.hasInforceElement()) {
      composeBoolean("inforce", element.getInforceElement());
    }
    if (element.hasBenefitPeriod()) {
      composePeriod("benefitPeriod", element.getBenefitPeriod());
    }
    if (element.hasItem()) {
      for (CoverageEligibilityResponse.ItemsComponent e : element.getItem())
        composeCoverageEligibilityResponseItemsComponent("item", e);
    }
  }

  protected void composeCoverageEligibilityResponseItemsComponent(String name,
      CoverageEligibilityResponse.ItemsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityResponseItemsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityResponseItemsComponentElements(
      CoverageEligibilityResponse.ItemsComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    if (element.hasModifier()) {
      for (CodeableConcept e : element.getModifier())
        composeCodeableConcept("modifier", e);
    }
    if (element.hasProvider()) {
      composeReference("provider", element.getProvider());
    }
    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.hasBenefit()) {
      for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit())
        composeCoverageEligibilityResponseBenefitComponent("benefit", e);
    }
    if (element.hasAuthorizationRequiredElement()) {
      composeBoolean("authorizationRequired", element.getAuthorizationRequiredElement());
    }
    if (element.hasAuthorizationSupporting()) {
      for (CodeableConcept e : element.getAuthorizationSupporting())
        composeCodeableConcept("authorizationSupporting", e);
    }
    if (element.hasAuthorizationUrlElement()) {
      composeUri("authorizationUrl", element.getAuthorizationUrlElement());
    }
  }

  protected void composeCoverageEligibilityResponseBenefitComponent(String name,
      CoverageEligibilityResponse.BenefitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityResponseBenefitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityResponseBenefitComponentElements(
      CoverageEligibilityResponse.BenefitComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasAllowed()) {
      composeType("allowed", element.getAllowed());
    }
    if (element.hasUsed()) {
      composeType("used", element.getUsed());
    }
  }

  protected void composeCoverageEligibilityResponseErrorsComponent(String name,
      CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCoverageEligibilityResponseErrorsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCoverageEligibilityResponseErrorsComponentElements(
      CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
  }

  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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory());
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasSeverityElement())
      composeEnumeration("severity", element.getSeverityElement(),
          new DetectedIssue.DetectedIssueSeverityEnumFactory());
    if (element.hasPatient()) {
      composeReference("patient", element.getPatient());
    }
    if (element.hasIdentified()) {
      composeType("identified", element.getIdentified());
    }
    if (element.hasAuthor()) {
      composeReference("author", element.getAuthor());
    }
    if (element.hasImplicated()) {
      for (Reference e : element.getImplicated())
        composeReference("implicated", e);
    }
    if (element.hasEvidence()) {
      for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence())
        composeDetectedIssueDetectedIssueEvidenceComponent("evidence", 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 composeDetectedIssueDetectedIssueEvidenceComponent(String name,
      DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDetectedIssueDetectedIssueEvidenceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDetectedIssueDetectedIssueEvidenceComponentElements(
      DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
    composeBackboneElementElements(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 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 {
    composeBackboneElementElements(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.hasDefinition()) {
      composeReference("definition", element.getDefinition());
    }
    if (element.hasUdiCarrier()) {
      for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier())
        composeDeviceDeviceUdiCarrierComponent("udiCarrier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory());
    if (element.hasStatusReason()) {
      for (CodeableConcept e : element.getStatusReason())
        composeCodeableConcept("statusReason", e);
    }
    if (element.hasDistinctIdentifierElement()) {
      composeString("distinctIdentifier", element.getDistinctIdentifierElement());
    }
    if (element.hasManufacturerElement()) {
      composeString("manufacturer", element.getManufacturerElement());
    }
    if (element.hasManufactureDateElement()) {
      composeDateTime("manufactureDate", element.getManufactureDateElement());
    }
    if (element.hasExpirationDateElement()) {
      composeDateTime("expirationDate", element.getExpirationDateElement());
    }
    if (element.hasLotNumberElement()) {
      composeString("lotNumber", element.getLotNumberElement());
    }
    if (element.hasSerialNumberElement()) {
      composeString("serialNumber", element.getSerialNumberElement());
    }
    if (element.hasDeviceName()) {
      for (Device.DeviceDeviceNameComponent e : element.getDeviceName())
        composeDeviceDeviceDeviceNameComponent("deviceName", e);
    }
    if (element.hasModelNumberElement()) {
      composeString("modelNumber", element.getModelNumberElement());
    }
    if (element.hasPartNumberElement()) {
      composeString("partNumber", element.getPartNumberElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSpecialization()) {
      for (Device.DeviceSpecializationComponent e : element.getSpecialization())
        composeDeviceDeviceSpecializationComponent("specialization", e);
    }
    if (element.hasVersion()) {
      for (Device.DeviceVersionComponent e : element.getVersion())
        composeDeviceDeviceVersionComponent("version", e);
    }
    if (element.hasProperty()) {
      for (Device.DevicePropertyComponent e : element.getProperty())
        composeDeviceDevicePropertyComponent("property", e);
    }
    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);
    }
    if (element.hasParent()) {
      composeReference("parent", element.getParent());
    }
  }

  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDeviceUdiCarrierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDeviceUdiCarrierComponentElements(Device.DeviceUdiCarrierComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDeviceIdentifierElement()) {
      composeString("deviceIdentifier", element.getDeviceIdentifierElement());
    }
    if (element.hasIssuerElement()) {
      composeUri("issuer", element.getIssuerElement());
    }
    if (element.hasJurisdictionElement()) {
      composeUri("jurisdiction", element.getJurisdictionElement());
    }
    if (element.hasCarrierAIDCElement()) {
      composeBase64Binary("carrierAIDC", element.getCarrierAIDCElement());
    }
    if (element.hasCarrierHRFElement()) {
      composeString("carrierHRF", element.getCarrierHRFElement());
    }
    if (element.hasEntryTypeElement())
      composeEnumeration("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory());
  }

  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDeviceDeviceNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDeviceDeviceNameComponentElements(Device.DeviceDeviceNameComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory());
  }

  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDeviceSpecializationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDeviceSpecializationComponentElements(Device.DeviceSpecializationComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSystemType()) {
      composeCodeableConcept("systemType", element.getSystemType());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
  }

  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDeviceVersionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDeviceVersionComponentElements(Device.DeviceVersionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasComponent()) {
      composeIdentifier("component", element.getComponent());
    }
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
  }

  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDevicePropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDevicePropertyComponentElements(Device.DevicePropertyComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValueQuantity()) {
      for (Quantity e : element.getValueQuantity())
        composeQuantity("valueQuantity", e);
    }
    if (element.hasValueCode()) {
      for (CodeableConcept e : element.getValueCode())
        composeCodeableConcept("valueCode", e);
    }
  }

  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionElements(DeviceDefinition element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasUdiDeviceIdentifier()) {
      for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier())
        composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent("udiDeviceIdentifier", e);
    }
    if (element.hasManufacturer()) {
      composeType("manufacturer", element.getManufacturer());
    }
    if (element.hasDeviceName()) {
      for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName())
        composeDeviceDefinitionDeviceDefinitionDeviceNameComponent("deviceName", e);
    }
    if (element.hasModelNumberElement()) {
      composeString("modelNumber", element.getModelNumberElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSpecialization()) {
      for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization())
        composeDeviceDefinitionDeviceDefinitionSpecializationComponent("specialization", e);
    }
    if (element.hasVersion()) {
      for (StringType e : element.getVersion())
        composeString("version", e);
    }
    if (element.hasSafety()) {
      for (CodeableConcept e : element.getSafety())
        composeCodeableConcept("safety", e);
    }
    if (element.hasShelfLifeStorage()) {
      for (ProductShelfLife e : element.getShelfLifeStorage())
        composeProductShelfLife("shelfLifeStorage", e);
    }
    if (element.hasPhysicalCharacteristics()) {
      composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
    }
    if (element.hasLanguageCode()) {
      for (CodeableConcept e : element.getLanguageCode())
        composeCodeableConcept("languageCode", e);
    }
    if (element.hasCapability()) {
      for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability())
        composeDeviceDefinitionDeviceDefinitionCapabilityComponent("capability", e);
    }
    if (element.hasProperty()) {
      for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty())
        composeDeviceDefinitionDeviceDefinitionPropertyComponent("property", e);
    }
    if (element.hasOwner()) {
      composeReference("owner", element.getOwner());
    }
    if (element.hasContact()) {
      for (ContactPoint e : element.getContact())
        composeContactPoint("contact", e);
    }
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasOnlineInformationElement()) {
      composeUri("onlineInformation", element.getOnlineInformationElement());
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasParentDevice()) {
      composeReference("parentDevice", element.getParentDevice());
    }
    if (element.hasMaterial()) {
      for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial())
        composeDeviceDefinitionDeviceDefinitionMaterialComponent("material", e);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name,
      DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentElements(
      DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDeviceIdentifierElement()) {
      composeString("deviceIdentifier", element.getDeviceIdentifierElement());
    }
    if (element.hasIssuerElement()) {
      composeUri("issuer", element.getIssuerElement());
    }
    if (element.hasJurisdictionElement()) {
      composeUri("jurisdiction", element.getJurisdictionElement());
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name,
      DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentElements(
      DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory());
  }

  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name,
      DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionDeviceDefinitionSpecializationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentElements(
      DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSystemTypeElement()) {
      composeString("systemType", element.getSystemTypeElement());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name,
      DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionDeviceDefinitionCapabilityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentElements(
      DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDescription()) {
      for (CodeableConcept e : element.getDescription())
        composeCodeableConcept("description", e);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name,
      DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionDeviceDefinitionPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentElements(
      DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValueQuantity()) {
      for (Quantity e : element.getValueQuantity())
        composeQuantity("valueQuantity", e);
    }
    if (element.hasValueCode()) {
      for (CodeableConcept e : element.getValueCode())
        composeCodeableConcept("valueCode", e);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name,
      DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionDeviceDefinitionMaterialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentElements(
      DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSubstance()) {
      composeCodeableConcept("substance", element.getSubstance());
    }
    if (element.hasAlternateElement()) {
      composeBoolean("alternate", element.getAlternateElement());
    }
    if (element.hasAllergenicIndicatorElement()) {
      composeBoolean("allergenicIndicator", element.getAllergenicIndicatorElement());
    }
  }

  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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    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 {
    composeBackboneElementElements(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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", 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.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory());
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory());
    if (element.hasCode()) {
      composeType("code", element.getCode());
    }
    if (element.hasParameter()) {
      for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter())
        composeDeviceRequestDeviceRequestParameterComponent("parameter", e);
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }
    if (element.hasAuthoredOnElement()) {
      composeDateTime("authoredOn", element.getAuthoredOnElement());
    }
    if (element.hasRequester()) {
      composeReference("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.hasInsurance()) {
      for (Reference e : element.getInsurance())
        composeReference("insurance", 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 composeDeviceRequestDeviceRequestParameterComponent(String name,
      DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceRequestDeviceRequestParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceRequestDeviceRequestParameterComponentElements(
      DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
  }

  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.hasBasedOn()) {
      for (Reference e : element.getBasedOn())
        composeReference("basedOn", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new DeviceUseStatement.DeviceUseStatementStatusEnumFactory());
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasDerivedFrom()) {
      for (Reference e : element.getDerivedFrom())
        composeReference("derivedFrom", e);
    }
    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.hasReasonCode()) {
      for (CodeableConcept e : element.getReasonCode())
        composeCodeableConcept("reasonCode", e);
    }
    if (element.hasReasonReference()) {
      for (Reference e : element.getReasonReference())
        composeReference("reasonReference", 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()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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.hasResultsInterpreter()) {
      for (Reference e : element.getResultsInterpreter())
        composeReference("resultsInterpreter", 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.hasMedia()) {
      for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia())
        composeDiagnosticReportDiagnosticReportMediaComponent("media", e);
    }
    if (element.hasConclusionElement()) {
      composeString("conclusion", element.getConclusionElement());
    }
    if (element.hasConclusionCode()) {
      for (CodeableConcept e : element.getConclusionCode())
        composeCodeableConcept("conclusionCode", e);
    }
    if (element.hasPresentedForm()) {
      for (Attachment e : element.getPresentedForm())
        composeAttachment("presentedForm", e);
    }
  }

  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name,
      DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDiagnosticReportDiagnosticReportMediaComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDiagnosticReportDiagnosticReportMediaComponentElements(
      DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
    composeBackboneElementElements(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 (Reference e : element.getContent())
        composeReference("content", e);
    }
    if (element.hasRelated()) {
      for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated())
        composeDocumentManifestDocumentManifestRelatedComponent("related", e);
    }
  }

  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 {
    composeBackboneElementElements(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.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasDateElement()) {
      composeInstant("date", element.getDateElement());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasEncounter()) {
      for (Reference e : element.getEncounter())
        composeReference("encounter", e);
    }
    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 (Reference e : element.getRelated())
        composeReference("related", e);
    }
  }

  protected void composeEffectEvidenceSynthesis(String name, EffectEvidenceSynthesis element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEffectEvidenceSynthesisElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEffectEvidenceSynthesisElements(EffectEvidenceSynthesis 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.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.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", 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.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasSynthesisType()) {
      composeCodeableConcept("synthesisType", element.getSynthesisType());
    }
    if (element.hasStudyType()) {
      composeCodeableConcept("studyType", element.getStudyType());
    }
    if (element.hasPopulation()) {
      composeReference("population", element.getPopulation());
    }
    if (element.hasExposure()) {
      composeReference("exposure", element.getExposure());
    }
    if (element.hasExposureAlternative()) {
      composeReference("exposureAlternative", element.getExposureAlternative());
    }
    if (element.hasOutcome()) {
      composeReference("outcome", element.getOutcome());
    }
    if (element.hasSampleSize()) {
      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
    }
    if (element.hasResultsByExposure()) {
      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent e : element.getResultsByExposure())
        composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent("resultsByExposure", e);
    }
    if (element.hasEffectEstimate()) {
      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent e : element.getEffectEstimate())
        composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent("effectEstimate", e);
    }
    if (element.hasCertainty()) {
      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent e : element.getCertainty())
        composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent("certainty", e);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(String name,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentElements(
      EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNumberOfStudiesElement()) {
      composeInteger("numberOfStudies", element.getNumberOfStudiesElement());
    }
    if (element.hasNumberOfParticipantsElement()) {
      composeInteger("numberOfParticipants", element.getNumberOfParticipantsElement());
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(String name,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentElements(
      EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasExposureStateElement())
      composeEnumeration("exposureState", element.getExposureStateElement(),
          new EffectEvidenceSynthesis.ExposureStateEnumFactory());
    if (element.hasVariantState()) {
      composeCodeableConcept("variantState", element.getVariantState());
    }
    if (element.hasRiskEvidenceSynthesis()) {
      composeReference("riskEvidenceSynthesis", element.getRiskEvidenceSynthesis());
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(String name,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentElements(
      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasVariantState()) {
      composeCodeableConcept("variantState", element.getVariantState());
    }
    if (element.hasValueElement()) {
      composeDecimal("value", element.getValueElement());
    }
    if (element.hasUnitOfMeasure()) {
      composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
    }
    if (element.hasPrecisionEstimate()) {
      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent e : element
          .getPrecisionEstimate())
        composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(
            "precisionEstimate", e);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(
      String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentElements(
      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasLevelElement()) {
      composeDecimal("level", element.getLevelElement());
    }
    if (element.hasFromElement()) {
      composeDecimal("from", element.getFromElement());
    }
    if (element.hasToElement()) {
      composeDecimal("to", element.getToElement());
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(String name,
      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentElements(
      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRating()) {
      for (CodeableConcept e : element.getRating())
        composeCodeableConcept("rating", e);
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
    if (element.hasCertaintySubcomponent()) {
      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element
          .getCertaintySubcomponent())
        composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
            "certaintySubcomponent", e);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
      String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentElements(
      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRating()) {
      for (CodeableConcept e : element.getRating())
        composeCodeableConcept("rating", e);
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
  }

  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.hasServiceType()) {
      composeCodeableConcept("serviceType", element.getServiceType());
    }
    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.hasBasedOn()) {
      for (Reference e : element.getBasedOn())
        composeReference("basedOn", e);
    }
    if (element.hasParticipant()) {
      for (Encounter.EncounterParticipantComponent e : element.getParticipant())
        composeEncounterEncounterParticipantComponent("participant", e);
    }
    if (element.hasAppointment()) {
      for (Reference e : element.getAppointment())
        composeReference("appointment", e);
    }
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasLength()) {
      composeDuration("length", element.getLength());
    }
    if (element.hasReasonCode()) {
      for (CodeableConcept e : element.getReasonCode())
        composeCodeableConcept("reasonCode", e);
    }
    if (element.hasReasonReference()) {
      for (Reference e : element.getReasonReference())
        composeReference("reasonReference", 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasCondition()) {
      composeReference("condition", element.getCondition());
    }
    if (element.hasUse()) {
      composeCodeableConcept("use", element.getUse());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasLocation()) {
      composeReference("location", element.getLocation());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory());
    if (element.hasPhysicalType()) {
      composeCodeableConcept("physicalType", element.getPhysicalType());
    }
    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()) {
      composeUrl("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.hasCandidate()) {
      composeReference("candidate", element.getCandidate());
    }
    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.hasOutcomeElement())
      composeEnumeration("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory());
    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());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasCondition()) {
      composeReference("condition", element.getCondition());
    }
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasRankElement()) {
      composePositiveInt("rank", element.getRankElement());
    }
  }

  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEventDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEventDefinitionElements(EventDefinition 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.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasExperimentalElement()) {
      composeBoolean("experimental", element.getExperimentalElement());
    }
    if (element.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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.hasUsageElement()) {
      composeString("usage", element.getUsageElement());
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasTrigger()) {
      for (TriggerDefinition e : element.getTrigger())
        composeTriggerDefinition("trigger", e);
    }
  }

  protected void composeEvidence(String name, Evidence element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceElements(Evidence 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.hasShortTitleElement()) {
      composeString("shortTitle", element.getShortTitleElement());
    }
    if (element.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    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.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", 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.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasExposureBackground()) {
      composeReference("exposureBackground", element.getExposureBackground());
    }
    if (element.hasExposureVariant()) {
      for (Reference e : element.getExposureVariant())
        composeReference("exposureVariant", e);
    }
    if (element.hasOutcome()) {
      for (Reference e : element.getOutcome())
        composeReference("outcome", e);
    }
  }

  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceVariableElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceVariableElements(EvidenceVariable 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.hasShortTitleElement()) {
      composeString("shortTitle", element.getShortTitleElement());
    }
    if (element.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    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.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", 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.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory());
    if (element.hasCharacteristic()) {
      for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic())
        composeEvidenceVariableEvidenceVariableCharacteristicComponent("characteristic", e);
    }
  }

  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponent(String name,
      EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceVariableEvidenceVariableCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponentElements(
      EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasDefinition()) {
      composeType("definition", element.getDefinition());
    }
    if (element.hasUsageContext()) {
      for (UsageContext e : element.getUsageContext())
        composeUsageContext("usageContext", e);
    }
    if (element.hasExcludeElement()) {
      composeBoolean("exclude", element.getExcludeElement());
    }
    if (element.hasParticipantEffective()) {
      composeType("participantEffective", element.getParticipantEffective());
    }
    if (element.hasTimeFromStart()) {
      composeDuration("timeFromStart", element.getTimeFromStart());
    }
    if (element.hasGroupMeasureElement())
      composeEnumeration("groupMeasure", element.getGroupMeasureElement(),
          new EvidenceVariable.GroupMeasureEnumFactory());
  }

  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioElements(ExampleScenario 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.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.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasPurposeElement()) {
      composeMarkdown("purpose", element.getPurposeElement());
    }
    if (element.hasActor()) {
      for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor())
        composeExampleScenarioExampleScenarioActorComponent("actor", e);
    }
    if (element.hasInstance()) {
      for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance())
        composeExampleScenarioExampleScenarioInstanceComponent("instance", e);
    }
    if (element.hasProcess()) {
      for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess())
        composeExampleScenarioExampleScenarioProcessComponent("process", e);
    }
    if (element.hasWorkflow()) {
      for (CanonicalType e : element.getWorkflow())
        composeCanonical("workflow", e);
    }
  }

  protected void composeExampleScenarioExampleScenarioActorComponent(String name,
      ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioActorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioActorComponentElements(
      ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasActorIdElement()) {
      composeString("actorId", element.getActorIdElement());
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory());
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
  }

  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name,
      ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioInstanceComponentElements(
      ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasResourceIdElement()) {
      composeString("resourceId", element.getResourceIdElement());
    }
    if (element.hasResourceTypeElement())
      composeEnumeration("resourceType", element.getResourceTypeElement(),
          new ExampleScenario.FHIRResourceTypeEnumFactory());
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasVersion()) {
      for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion())
        composeExampleScenarioExampleScenarioInstanceVersionComponent("version", e);
    }
    if (element.hasContainedInstance()) {
      for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance())
        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("containedInstance", e);
    }
  }

  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name,
      ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioInstanceVersionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentElements(
      ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasVersionIdElement()) {
      composeString("versionId", element.getVersionIdElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
  }

  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name,
      ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentElements(
      ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasResourceIdElement()) {
      composeString("resourceId", element.getResourceIdElement());
    }
    if (element.hasVersionIdElement()) {
      composeString("versionId", element.getVersionIdElement());
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessComponent(String name,
      ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioProcessComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessComponentElements(
      ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasPreConditionsElement()) {
      composeMarkdown("preConditions", element.getPreConditionsElement());
    }
    if (element.hasPostConditionsElement()) {
      composeMarkdown("postConditions", element.getPostConditionsElement());
    }
    if (element.hasStep()) {
      for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep())
        composeExampleScenarioExampleScenarioProcessStepComponent("step", e);
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name,
      ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioProcessStepComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessStepComponentElements(
      ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProcess()) {
      for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess())
        composeExampleScenarioExampleScenarioProcessComponent("process", e);
    }
    if (element.hasPauseElement()) {
      composeBoolean("pause", element.getPauseElement());
    }
    if (element.hasOperation()) {
      composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
    }
    if (element.hasAlternative()) {
      for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative())
        composeExampleScenarioExampleScenarioProcessStepAlternativeComponent("alternative", e);
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name,
      ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioProcessStepOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentElements(
      ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNumberElement()) {
      composeString("number", element.getNumberElement());
    }
    if (element.hasTypeElement()) {
      composeString("type", element.getTypeElement());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasInitiatorElement()) {
      composeString("initiator", element.getInitiatorElement());
    }
    if (element.hasReceiverElement()) {
      composeString("receiver", element.getReceiverElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasInitiatorActiveElement()) {
      composeBoolean("initiatorActive", element.getInitiatorActiveElement());
    }
    if (element.hasReceiverActiveElement()) {
      composeBoolean("receiverActive", element.getReceiverActiveElement());
    }
    if (element.hasRequest()) {
      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
    }
    if (element.hasResponse()) {
      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name,
      ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentElements(
      ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasStep()) {
      for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep())
        composeExampleScenarioExampleScenarioProcessStepComponent("step", e);
    }
  }

  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()) {
      composeCodeableConcept("subType", element.getSubType());
    }
    if (element.hasUseElement())
      composeEnumeration("use", element.getUseElement(), new ExplanationOfBenefit.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.hasPriority()) {
      composeCodeableConcept("priority", element.getPriority());
    }
    if (element.hasFundsReserveRequested()) {
      composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
    }
    if (element.hasFundsReserve()) {
      composeCodeableConcept("fundsReserve", element.getFundsReserve());
    }
    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.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.hasOutcomeElement())
      composeEnumeration("outcome", element.getOutcomeElement(),
          new ExplanationOfBenefit.RemittanceOutcomeEnumFactory());
    if (element.hasDispositionElement()) {
      composeString("disposition", element.getDispositionElement());
    }
    if (element.hasPreAuthRef()) {
      for (StringType e : element.getPreAuthRef())
        composeString("preAuthRef", e);
    }
    if (element.hasPreAuthRefPeriod()) {
      for (Period e : element.getPreAuthRefPeriod())
        composePeriod("preAuthRefPeriod", e);
    }
    if (element.hasCareTeam()) {
      for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam())
        composeExplanationOfBenefitCareTeamComponent("careTeam", e);
    }
    if (element.hasSupportingInfo()) {
      for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo())
        composeExplanationOfBenefitSupportingInformationComponent("supportingInfo", 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()) {
      for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance())
        composeExplanationOfBenefitInsuranceComponent("insurance", e);
    }
    if (element.hasAccident()) {
      composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
    }
    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.hasAdjudication()) {
      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
        composeExplanationOfBenefitAdjudicationComponent("adjudication", e);
    }
    if (element.hasTotal()) {
      for (ExplanationOfBenefit.TotalComponent e : element.getTotal())
        composeExplanationOfBenefitTotalComponent("total", e);
    }
    if (element.hasPayment()) {
      composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
    }
    if (element.hasFormCode()) {
      composeCodeableConcept("formCode", element.getFormCode());
    }
    if (element.hasForm()) {
      composeAttachment("form", element.getForm());
    }
    if (element.hasProcessNote()) {
      for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote())
        composeExplanationOfBenefitNoteComponent("processNote", e);
    }
    if (element.hasBenefitPeriod()) {
      composePeriod("benefitPeriod", element.getBenefitPeriod());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasParty()) {
      composeReference("party", element.getParty());
    }
  }

  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 {
    composeBackboneElementElements(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 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 {
    composeBackboneElementElements(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 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 {
    composeBackboneElementElements(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.hasOnAdmission()) {
      composeCodeableConcept("onAdmission", element.getOnAdmission());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasType()) {
      for (CodeableConcept e : element.getType())
        composeCodeableConcept("type", e);
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasProcedure()) {
      composeType("procedure", element.getProcedure());
    }
    if (element.hasUdi()) {
      for (Reference e : element.getUdi())
        composeReference("udi", e);
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasFocalElement()) {
      composeBoolean("focal", element.getFocalElement());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasCareTeamSequence()) {
      for (PositiveIntType e : element.getCareTeamSequence())
        composePositiveInt("careTeamSequence", e);
    }
    if (element.hasDiagnosisSequence()) {
      for (PositiveIntType e : element.getDiagnosisSequence())
        composePositiveInt("diagnosisSequence", e);
    }
    if (element.hasProcedureSequence()) {
      for (PositiveIntType e : element.getProcedureSequence())
        composePositiveInt("procedureSequence", e);
    }
    if (element.hasInformationSequence()) {
      for (PositiveIntType e : element.getInformationSequence())
        composePositiveInt("informationSequence", e);
    }
    if (element.hasRevenue()) {
      composeCodeableConcept("revenue", element.getRevenue());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasRevenue()) {
      composeCodeableConcept("revenue", element.getRevenue());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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 {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasRevenue()) {
      composeCodeableConcept("revenue", element.getRevenue());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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 {
    composeBackboneElementElements(element);
    if (element.hasItemSequence()) {
      for (PositiveIntType e : element.getItemSequence())
        composePositiveInt("itemSequence", e);
    }
    if (element.hasDetailSequence()) {
      for (PositiveIntType e : element.getDetailSequence())
        composePositiveInt("detailSequence", e);
    }
    if (element.hasSubDetailSequence()) {
      for (PositiveIntType e : element.getSubDetailSequence())
        composePositiveInt("subDetailSequence", e);
    }
    if (element.hasProvider()) {
      for (Reference e : element.getProvider())
        composeReference("provider", e);
    }
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    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()) {
      composeQuantity("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.hasBodySite()) {
      composeCodeableConcept("bodySite", element.getBodySite());
    }
    if (element.hasSubSite()) {
      for (CodeableConcept e : element.getSubSite())
        composeCodeableConcept("subSite", 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.AddedItemDetailComponent e : element.getDetail())
        composeExplanationOfBenefitAddedItemDetailComponent("detail", e);
    }
  }

  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name,
      ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitAddedItemDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitAddedItemDetailComponentElements(
      ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    if (element.hasModifier()) {
      for (CodeableConcept e : element.getModifier())
        composeCodeableConcept("modifier", e);
    }
    if (element.hasQuantity()) {
      composeQuantity("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.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.AddedItemDetailSubDetailComponent e : element.getSubDetail())
        composeExplanationOfBenefitAddedItemDetailSubDetailComponent("subDetail", e);
    }
  }

  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name,
      ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitAddedItemDetailSubDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentElements(
      ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProductOrService()) {
      composeCodeableConcept("productOrService", element.getProductOrService());
    }
    if (element.hasModifier()) {
      for (CodeableConcept e : element.getModifier())
        composeCodeableConcept("modifier", e);
    }
    if (element.hasQuantity()) {
      composeQuantity("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.hasNoteNumber()) {
      for (PositiveIntType e : element.getNoteNumber())
        composePositiveInt("noteNumber", e);
    }
    if (element.hasAdjudication()) {
      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
        composeExplanationOfBenefitAdjudicationComponent("adjudication", e);
    }
  }

  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExplanationOfBenefitTotalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeExplanationOfBenefitTotalComponentElements(ExplanationOfBenefit.TotalComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasAmount()) {
      composeMoney("amount", element.getAmount());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasNumberElement()) {
      composePositiveInt("number", element.getNumberElement());
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory());
    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 {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    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 {
    composeBackboneElementElements(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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new FamilyMemberHistory.FamilyHistoryStatusEnumFactory());
    if (element.hasDataAbsentReason()) {
      composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
    }
    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.hasSex()) {
      composeCodeableConcept("sex", element.getSex());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasOutcome()) {
      composeCodeableConcept("outcome", element.getOutcome());
    }
    if (element.hasContributedToDeathElement()) {
      composeBoolean("contributedToDeath", element.getContributedToDeathElement());
    }
    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()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    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.hasLifecycleStatusElement())
      composeEnumeration("lifecycleStatus", element.getLifecycleStatusElement(),
          new Goal.GoalLifecycleStatusEnumFactory());
    if (element.hasAchievementStatus()) {
      composeCodeableConcept("achievementStatus", element.getAchievementStatus());
    }
    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()) {
      for (Goal.GoalTargetComponent e : element.getTarget())
        composeGoalGoalTargetComponent("target", e);
    }
    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 {
    composeBackboneElementElements(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()) {
      composeCanonical("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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasTypeElement()) {
      composeCode("type", element.getTypeElement());
    }
    if (element.hasParamsElement()) {
      composeString("params", element.getParamsElement());
    }
    if (element.hasProfileElement()) {
      composeCanonical("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 {
    composeBackboneElementElements(element);
    if (element.hasUseElement())
      composeEnumeration("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory());
    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.hasManagingEntity()) {
      composeReference("managingEntity", element.getManagingEntity());
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasRequestIdentifier()) {
      composeIdentifier("requestIdentifier", element.getRequestIdentifier());
    }
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasModule()) {
      composeType("module", element.getModule());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new GuidanceResponse.GuidanceResponseStatusEnumFactory());
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasOccurrenceDateTimeElement()) {
      composeDateTime("occurrenceDateTime", element.getOccurrenceDateTimeElement());
    }
    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.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()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    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()) {
      composeMarkdown("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()) {
      for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility())
        composeHealthcareServiceHealthcareServiceEligibilityComponent("eligibility", e);
    }
    if (element.hasProgram()) {
      for (CodeableConcept e : element.getProgram())
        composeCodeableConcept("program", e);
    }
    if (element.hasCharacteristic()) {
      for (CodeableConcept e : element.getCharacteristic())
        composeCodeableConcept("characteristic", e);
    }
    if (element.hasCommunication()) {
      for (CodeableConcept e : element.getCommunication())
        composeCodeableConcept("communication", 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 composeHealthcareServiceHealthcareServiceEligibilityComponent(String name,
      HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHealthcareServiceHealthcareServiceEligibilityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHealthcareServiceHealthcareServiceEligibilityComponentElements(
      HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasCommentElement()) {
      composeMarkdown("comment", element.getCommentElement());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasDuring()) {
      composePeriod("during", element.getDuring());
    }
  }

  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.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory());
    if (element.hasModality()) {
      for (Coding e : element.getModality())
        composeCoding("modality", e);
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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()) {
      composeReference("procedureReference", element.getProcedureReference());
    }
    if (element.hasProcedureCode()) {
      for (CodeableConcept e : element.getProcedureCode())
        composeCodeableConcept("procedureCode", 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.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasUidElement()) {
      composeId("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.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.hasSpecimen()) {
      for (Reference e : element.getSpecimen())
        composeReference("specimen", e);
    }
    if (element.hasStartedElement()) {
      composeDateTime("started", element.getStartedElement());
    }
    if (element.hasPerformer()) {
      for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer())
        composeImagingStudyImagingStudySeriesPerformerComponent("performer", e);
    }
    if (element.hasInstance()) {
      for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance())
        composeImagingStudyImagingStudySeriesInstanceComponent("instance", e);
    }
  }

  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name,
      ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImagingStudyImagingStudySeriesPerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImagingStudyImagingStudySeriesPerformerComponentElements(
      ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasUidElement()) {
      composeId("uid", element.getUidElement());
    }
    if (element.hasSopClass()) {
      composeCoding("sopClass", element.getSopClass());
    }
    if (element.hasNumberElement()) {
      composeUnsignedInt("number", element.getNumberElement());
    }
    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.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    if (element.hasVaccineCode()) {
      composeCodeableConcept("vaccineCode", element.getVaccineCode());
    }
    if (element.hasPatient()) {
      composeReference("patient", element.getPatient());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }
    if (element.hasRecordedElement()) {
      composeDateTime("recorded", element.getRecordedElement());
    }
    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()) {
      composeQuantity("doseQuantity", element.getDoseQuantity());
    }
    if (element.hasPerformer()) {
      for (Immunization.ImmunizationPerformerComponent e : element.getPerformer())
        composeImmunizationImmunizationPerformerComponent("performer", e);
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", 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.hasIsSubpotentElement()) {
      composeBoolean("isSubpotent", element.getIsSubpotentElement());
    }
    if (element.hasSubpotentReason()) {
      for (CodeableConcept e : element.getSubpotentReason())
        composeCodeableConcept("subpotentReason", e);
    }
    if (element.hasEducation()) {
      for (Immunization.ImmunizationEducationComponent e : element.getEducation())
        composeImmunizationImmunizationEducationComponent("education", e);
    }
    if (element.hasProgramEligibility()) {
      for (CodeableConcept e : element.getProgramEligibility())
        composeCodeableConcept("programEligibility", e);
    }
    if (element.hasFundingSource()) {
      composeCodeableConcept("fundingSource", element.getFundingSource());
    }
    if (element.hasReaction()) {
      for (Immunization.ImmunizationReactionComponent e : element.getReaction())
        composeImmunizationImmunizationReactionComponent("reaction", e);
    }
    if (element.hasProtocolApplied()) {
      for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied())
        composeImmunizationImmunizationProtocolAppliedComponent("protocolApplied", e);
    }
  }

  protected void composeImmunizationImmunizationPerformerComponent(String name,
      Immunization.ImmunizationPerformerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationImmunizationPerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationImmunizationPerformerComponentElements(
      Immunization.ImmunizationPerformerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  protected void composeImmunizationImmunizationEducationComponent(String name,
      Immunization.ImmunizationEducationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationImmunizationEducationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationImmunizationEducationComponentElements(
      Immunization.ImmunizationEducationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDocumentTypeElement()) {
      composeString("documentType", element.getDocumentTypeElement());
    }
    if (element.hasReferenceElement()) {
      composeUri("reference", element.getReferenceElement());
    }
    if (element.hasPublicationDateElement()) {
      composeDateTime("publicationDate", element.getPublicationDateElement());
    }
    if (element.hasPresentationDateElement()) {
      composeDateTime("presentationDate", element.getPresentationDateElement());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasDetail()) {
      composeReference("detail", element.getDetail());
    }
    if (element.hasReportedElement()) {
      composeBoolean("reported", element.getReportedElement());
    }
  }

  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name,
      Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationImmunizationProtocolAppliedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationImmunizationProtocolAppliedComponentElements(
      Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSeriesElement()) {
      composeString("series", element.getSeriesElement());
    }
    if (element.hasAuthority()) {
      composeReference("authority", element.getAuthority());
    }
    if (element.hasTargetDisease()) {
      for (CodeableConcept e : element.getTargetDisease())
        composeCodeableConcept("targetDisease", e);
    }
    if (element.hasDoseNumber()) {
      composeType("doseNumber", element.getDoseNumber());
    }
    if (element.hasSeriesDoses()) {
      composeType("seriesDoses", element.getSeriesDoses());
    }
  }

  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationEvaluationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationEvaluationElements(ImmunizationEvaluation element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory());
    if (element.hasPatient()) {
      composeReference("patient", element.getPatient());
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasAuthority()) {
      composeReference("authority", element.getAuthority());
    }
    if (element.hasTargetDisease()) {
      composeCodeableConcept("targetDisease", element.getTargetDisease());
    }
    if (element.hasImmunizationEvent()) {
      composeReference("immunizationEvent", element.getImmunizationEvent());
    }
    if (element.hasDoseStatus()) {
      composeCodeableConcept("doseStatus", element.getDoseStatus());
    }
    if (element.hasDoseStatusReason()) {
      for (CodeableConcept e : element.getDoseStatusReason())
        composeCodeableConcept("doseStatusReason", e);
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasSeriesElement()) {
      composeString("series", element.getSeriesElement());
    }
    if (element.hasDoseNumber()) {
      composeType("doseNumber", element.getDoseNumber());
    }
    if (element.hasSeriesDoses()) {
      composeType("seriesDoses", element.getSeriesDoses());
    }
  }

  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.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasAuthority()) {
      composeReference("authority", element.getAuthority());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasVaccineCode()) {
      for (CodeableConcept e : element.getVaccineCode())
        composeCodeableConcept("vaccineCode", e);
    }
    if (element.hasTargetDisease()) {
      composeCodeableConcept("targetDisease", element.getTargetDisease());
    }
    if (element.hasContraindicatedVaccineCode()) {
      for (CodeableConcept e : element.getContraindicatedVaccineCode())
        composeCodeableConcept("contraindicatedVaccineCode", e);
    }
    if (element.hasForecastStatus()) {
      composeCodeableConcept("forecastStatus", element.getForecastStatus());
    }
    if (element.hasForecastReason()) {
      for (CodeableConcept e : element.getForecastReason())
        composeCodeableConcept("forecastReason", e);
    }
    if (element.hasDateCriterion()) {
      for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element
          .getDateCriterion())
        composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent("dateCriterion",
            e);
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasSeriesElement()) {
      composeString("series", element.getSeriesElement());
    }
    if (element.hasDoseNumber()) {
      composeType("doseNumber", element.getDoseNumber());
    }
    if (element.hasSeriesDoses()) {
      composeType("seriesDoses", element.getSeriesDoses());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasValueElement()) {
      composeDateTime("value", element.getValueElement());
    }
  }

  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.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.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasPackageIdElement()) {
      composeId("packageId", element.getPackageIdElement());
    }
    if (element.hasLicenseElement())
      composeEnumeration("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory());
    if (element.hasFhirVersion())
      for (Enumeration e : element.getFhirVersion())
        composeEnumeration("fhirVersion", e, new Enumerations.FHIRVersionEnumFactory());
    if (element.hasDependsOn()) {
      for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn())
        composeImplementationGuideImplementationGuideDependsOnComponent("dependsOn", e);
    }
    if (element.hasGlobal()) {
      for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal())
        composeImplementationGuideImplementationGuideGlobalComponent("global", e);
    }
    if (element.hasDefinition()) {
      composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
    }
    if (element.hasManifest()) {
      composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
    }
  }

  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name,
      ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDependsOnComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDependsOnComponentElements(
      ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasUriElement()) {
      composeCanonical("uri", element.getUriElement());
    }
    if (element.hasPackageIdElement()) {
      composeId("packageId", element.getPackageIdElement());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasTypeElement()) {
      composeCode("type", element.getTypeElement());
    }
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name,
      ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDefinitionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionComponentElements(
      ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasGrouping()) {
      for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping())
        composeImplementationGuideImplementationGuideDefinitionGroupingComponent("grouping", e);
    }
    if (element.hasResource()) {
      for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource())
        composeImplementationGuideImplementationGuideDefinitionResourceComponent("resource", e);
    }
    if (element.hasPage()) {
      composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
    }
    if (element.hasParameter()) {
      for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter())
        composeImplementationGuideImplementationGuideDefinitionParameterComponent("parameter", e);
    }
    if (element.hasTemplate()) {
      for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate())
        composeImplementationGuideImplementationGuideDefinitionTemplateComponent("template", e);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponent(String name,
      ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDefinitionGroupingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponentElements(
      ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name,
      ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDefinitionResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentElements(
      ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
    if (element.hasFhirVersion())
      for (Enumeration e : element.getFhirVersion())
        composeEnumeration("fhirVersion", e, new Enumerations.FHIRVersionEnumFactory());
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasExample()) {
      composeType("example", element.getExample());
    }
    if (element.hasGroupingIdElement()) {
      composeId("groupingId", element.getGroupingIdElement());
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name,
      ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDefinitionPageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentElements(
      ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasName()) {
      composeType("name", element.getName());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasGenerationElement())
      composeEnumeration("generation", element.getGenerationElement(),
          new ImplementationGuide.GuidePageGenerationEnumFactory());
    if (element.hasPage()) {
      for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage())
        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", e);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name,
      ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDefinitionParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentElements(
      ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement())
      composeString("code", element.getCodeElement());
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name,
      ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideDefinitionTemplateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentElements(
      ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement()) {
      composeCode("code", element.getCodeElement());
    }
    if (element.hasSourceElement()) {
      composeString("source", element.getSourceElement());
    }
    if (element.hasScopeElement()) {
      composeString("scope", element.getScopeElement());
    }
  }

  protected void composeImplementationGuideImplementationGuideManifestComponent(String name,
      ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideImplementationGuideManifestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideImplementationGuideManifestComponentElements(
      ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRenderingElement()) {
      composeUrl("rendering", element.getRenderingElement());
    }
    if (element.hasResource()) {
      for (ImplementationGuide.ManifestResourceComponent e : element.getResource())
        composeImplementationGuideManifestResourceComponent("resource", e);
    }
    if (element.hasPage()) {
      for (ImplementationGuide.ManifestPageComponent e : element.getPage())
        composeImplementationGuideManifestPageComponent("page", e);
    }
    if (element.hasImage()) {
      for (StringType e : element.getImage())
        composeString("image", e);
    }
    if (element.hasOther()) {
      for (StringType e : element.getOther())
        composeString("other", e);
    }
  }

  protected void composeImplementationGuideManifestResourceComponent(String name,
      ImplementationGuide.ManifestResourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideManifestResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideManifestResourceComponentElements(
      ImplementationGuide.ManifestResourceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
    if (element.hasExample()) {
      composeType("example", element.getExample());
    }
    if (element.hasRelativePathElement()) {
      composeUrl("relativePath", element.getRelativePathElement());
    }
  }

  protected void composeImplementationGuideManifestPageComponent(String name,
      ImplementationGuide.ManifestPageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideManifestPageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideManifestPageComponentElements(
      ImplementationGuide.ManifestPageComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasAnchor()) {
      for (StringType e : element.getAnchor())
        composeString("anchor", e);
    }
  }

  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanElements(InsurancePlan element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    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.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasOwnedBy()) {
      composeReference("ownedBy", element.getOwnedBy());
    }
    if (element.hasAdministeredBy()) {
      composeReference("administeredBy", element.getAdministeredBy());
    }
    if (element.hasCoverageArea()) {
      for (Reference e : element.getCoverageArea())
        composeReference("coverageArea", e);
    }
    if (element.hasContact()) {
      for (InsurancePlan.InsurancePlanContactComponent e : element.getContact())
        composeInsurancePlanInsurancePlanContactComponent("contact", e);
    }
    if (element.hasEndpoint()) {
      for (Reference e : element.getEndpoint())
        composeReference("endpoint", e);
    }
    if (element.hasNetwork()) {
      for (Reference e : element.getNetwork())
        composeReference("network", e);
    }
    if (element.hasCoverage()) {
      for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage())
        composeInsurancePlanInsurancePlanCoverageComponent("coverage", e);
    }
    if (element.hasPlan()) {
      for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan())
        composeInsurancePlanInsurancePlanPlanComponent("plan", e);
    }
  }

  protected void composeInsurancePlanInsurancePlanContactComponent(String name,
      InsurancePlan.InsurancePlanContactComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanInsurancePlanContactComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanInsurancePlanContactComponentElements(
      InsurancePlan.InsurancePlanContactComponent element) throws IOException {
    composeBackboneElementElements(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 composeInsurancePlanInsurancePlanCoverageComponent(String name,
      InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanInsurancePlanCoverageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanInsurancePlanCoverageComponentElements(
      InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasNetwork()) {
      for (Reference e : element.getNetwork())
        composeReference("network", e);
    }
    if (element.hasBenefit()) {
      for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit())
        composeInsurancePlanCoverageBenefitComponent("benefit", e);
    }
  }

  protected void composeInsurancePlanCoverageBenefitComponent(String name,
      InsurancePlan.CoverageBenefitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanCoverageBenefitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanCoverageBenefitComponentElements(InsurancePlan.CoverageBenefitComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRequirementElement()) {
      composeString("requirement", element.getRequirementElement());
    }
    if (element.hasLimit()) {
      for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit())
        composeInsurancePlanCoverageBenefitLimitComponent("limit", e);
    }
  }

  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name,
      InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanCoverageBenefitLimitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanCoverageBenefitLimitComponentElements(
      InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeQuantity("value", element.getValue());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
  }

  protected void composeInsurancePlanInsurancePlanPlanComponent(String name,
      InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanInsurancePlanPlanComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanInsurancePlanPlanComponentElements(
      InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasCoverageArea()) {
      for (Reference e : element.getCoverageArea())
        composeReference("coverageArea", e);
    }
    if (element.hasNetwork()) {
      for (Reference e : element.getNetwork())
        composeReference("network", e);
    }
    if (element.hasGeneralCost()) {
      for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost())
        composeInsurancePlanInsurancePlanPlanGeneralCostComponent("generalCost", e);
    }
    if (element.hasSpecificCost()) {
      for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost())
        composeInsurancePlanInsurancePlanPlanSpecificCostComponent("specificCost", e);
    }
  }

  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name,
      InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanInsurancePlanPlanGeneralCostComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentElements(
      InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasGroupSizeElement()) {
      composePositiveInt("groupSize", element.getGroupSizeElement());
    }
    if (element.hasCost()) {
      composeMoney("cost", element.getCost());
    }
    if (element.hasCommentElement()) {
      composeString("comment", element.getCommentElement());
    }
  }

  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name,
      InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanInsurancePlanPlanSpecificCostComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentElements(
      InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasBenefit()) {
      for (InsurancePlan.PlanBenefitComponent e : element.getBenefit())
        composeInsurancePlanPlanBenefitComponent("benefit", e);
    }
  }

  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanPlanBenefitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanPlanBenefitComponentElements(InsurancePlan.PlanBenefitComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasCost()) {
      for (InsurancePlan.PlanBenefitCostComponent e : element.getCost())
        composeInsurancePlanPlanBenefitCostComponent("cost", e);
    }
  }

  protected void composeInsurancePlanPlanBenefitCostComponent(String name,
      InsurancePlan.PlanBenefitCostComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanPlanBenefitCostComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanPlanBenefitCostComponentElements(InsurancePlan.PlanBenefitCostComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasApplicability()) {
      composeCodeableConcept("applicability", element.getApplicability());
    }
    if (element.hasQualifiers()) {
      for (CodeableConcept e : element.getQualifiers())
        composeCodeableConcept("qualifiers", e);
    }
    if (element.hasValue()) {
      composeQuantity("value", element.getValue());
    }
  }

  protected void composeInvoice(String name, Invoice element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInvoiceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInvoiceElements(Invoice element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory());
    if (element.hasCancelledReasonElement()) {
      composeString("cancelledReason", element.getCancelledReasonElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasRecipient()) {
      composeReference("recipient", element.getRecipient());
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasParticipant()) {
      for (Invoice.InvoiceParticipantComponent e : element.getParticipant())
        composeInvoiceInvoiceParticipantComponent("participant", e);
    }
    if (element.hasIssuer()) {
      composeReference("issuer", element.getIssuer());
    }
    if (element.hasAccount()) {
      composeReference("account", element.getAccount());
    }
    if (element.hasLineItem()) {
      for (Invoice.InvoiceLineItemComponent e : element.getLineItem())
        composeInvoiceInvoiceLineItemComponent("lineItem", e);
    }
    if (element.hasTotalPriceComponent()) {
      for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent())
        composeInvoiceInvoiceLineItemPriceComponentComponent("totalPriceComponent", e);
    }
    if (element.hasTotalNet()) {
      composeMoney("totalNet", element.getTotalNet());
    }
    if (element.hasTotalGross()) {
      composeMoney("totalGross", element.getTotalGross());
    }
    if (element.hasPaymentTermsElement()) {
      composeMarkdown("paymentTerms", element.getPaymentTermsElement());
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
  }

  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInvoiceInvoiceParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInvoiceInvoiceParticipantComponentElements(Invoice.InvoiceParticipantComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInvoiceInvoiceLineItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInvoiceInvoiceLineItemComponentElements(Invoice.InvoiceLineItemComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSequenceElement()) {
      composePositiveInt("sequence", element.getSequenceElement());
    }
    if (element.hasChargeItem()) {
      composeType("chargeItem", element.getChargeItem());
    }
    if (element.hasPriceComponent()) {
      for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent())
        composeInvoiceInvoiceLineItemPriceComponentComponent("priceComponent", e);
    }
  }

  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name,
      Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInvoiceInvoiceLineItemPriceComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInvoiceInvoiceLineItemPriceComponentComponentElements(
      Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory());
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasFactorElement()) {
      composeDecimal("factor", element.getFactorElement());
    }
    if (element.hasAmount()) {
      composeMoney("amount", element.getAmount());
    }
  }

  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.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    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.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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.hasUsageElement()) {
      composeString("usage", element.getUsageElement());
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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()) {
      for (CodeableConcept e : element.getType())
        composeCodeableConcept("type", e);
    }
    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.hasHoursOfOperation()) {
      for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation())
        composeLocationLocationHoursOfOperationComponent("hoursOfOperation", e);
    }
    if (element.hasAvailabilityExceptionsElement()) {
      composeString("availabilityExceptions", element.getAvailabilityExceptionsElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasLongitudeElement()) {
      composeDecimal("longitude", element.getLongitudeElement());
    }
    if (element.hasLatitudeElement()) {
      composeDecimal("latitude", element.getLatitudeElement());
    }
    if (element.hasAltitudeElement()) {
      composeDecimal("altitude", element.getAltitudeElement());
    }
  }

  protected void composeLocationLocationHoursOfOperationComponent(String name,
      Location.LocationHoursOfOperationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLocationLocationHoursOfOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLocationLocationHoursOfOperationComponentElements(
      Location.LocationHoursOfOperationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDaysOfWeek())
      for (Enumeration e : element.getDaysOfWeek())
        composeEnumeration("daysOfWeek", e, new Location.DaysOfWeekEnumFactory());
    if (element.hasAllDayElement()) {
      composeBoolean("allDay", element.getAllDayElement());
    }
    if (element.hasOpeningTimeElement()) {
      composeTime("openingTime", element.getOpeningTimeElement());
    }
    if (element.hasClosingTimeElement()) {
      composeTime("closingTime", element.getClosingTimeElement());
    }
  }

  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.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasExperimentalElement()) {
      composeBoolean("experimental", element.getExperimentalElement());
    }
    if (element.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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.hasUsageElement()) {
      composeString("usage", element.getUsageElement());
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasLibrary()) {
      for (CanonicalType e : element.getLibrary())
        composeCanonical("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.hasImprovementNotation()) {
      composeCodeableConcept("improvementNotation", element.getImprovementNotation());
    }
    if (element.hasDefinition()) {
      for (MarkdownType e : element.getDefinition())
        composeMarkdown("definition", e);
    }
    if (element.hasGuidanceElement()) {
      composeMarkdown("guidance", element.getGuidanceElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasCriteria()) {
      composeExpression("criteria", element.getCriteria());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasCriteria()) {
      composeExpression("criteria", element.getCriteria());
    }
    if (element.hasComponent()) {
      for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent())
        composeMeasureMeasureGroupStratifierComponentComponent("component", e);
    }
  }

  protected void composeMeasureMeasureGroupStratifierComponentComponent(String name,
      Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureMeasureGroupStratifierComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureMeasureGroupStratifierComponentComponentElements(
      Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasCriteria()) {
      composeExpression("criteria", element.getCriteria());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasUsage()) {
      for (CodeableConcept e : element.getUsage())
        composeCodeableConcept("usage", e);
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasCriteria()) {
      composeExpression("criteria", element.getCriteria());
    }
  }

  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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory());
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory());
    if (element.hasMeasureElement()) {
      composeCanonical("measure", element.getMeasureElement());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasReporter()) {
      composeReference("reporter", element.getReporter());
    }
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasImprovementNotation()) {
      composeCodeableConcept("improvementNotation", element.getImprovementNotation());
    }
    if (element.hasGroup()) {
      for (MeasureReport.MeasureReportGroupComponent e : element.getGroup())
        composeMeasureReportMeasureReportGroupComponent("group", e);
    }
    if (element.hasEvaluatedResource()) {
      for (Reference e : element.getEvaluatedResource())
        composeReference("evaluatedResource", e);
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasPopulation()) {
      for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation())
        composeMeasureReportMeasureReportGroupPopulationComponent("population", e);
    }
    if (element.hasMeasureScore()) {
      composeQuantity("measureScore", element.getMeasureScore());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasCountElement()) {
      composeInteger("count", element.getCountElement());
    }
    if (element.hasSubjectResults()) {
      composeReference("subjectResults", element.getSubjectResults());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      for (CodeableConcept e : element.getCode())
        composeCodeableConcept("code", e);
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeCodeableConcept("value", element.getValue());
    }
    if (element.hasComponent()) {
      for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent())
        composeMeasureReportStratifierGroupComponentComponent("component", e);
    }
    if (element.hasPopulation()) {
      for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation())
        composeMeasureReportStratifierGroupPopulationComponent("population", e);
    }
    if (element.hasMeasureScore()) {
      composeQuantity("measureScore", element.getMeasureScore());
    }
  }

  protected void composeMeasureReportStratifierGroupComponentComponent(String name,
      MeasureReport.StratifierGroupComponentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportStratifierGroupComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportStratifierGroupComponentComponentElements(
      MeasureReport.StratifierGroupComponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasValue()) {
      composeCodeableConcept("value", element.getValue());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasCountElement()) {
      composeInteger("count", element.getCountElement());
    }
    if (element.hasSubjectResults()) {
      composeReference("subjectResults", element.getSubjectResults());
    }
  }

  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.hasPartOf()) {
      for (Reference e : element.getPartOf())
        composeReference("partOf", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Media.MediaStatusEnumFactory());
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasModality()) {
      composeCodeableConcept("modality", element.getModality());
    }
    if (element.hasView()) {
      composeCodeableConcept("view", element.getView());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasCreated()) {
      composeType("created", element.getCreated());
    }
    if (element.hasIssuedElement()) {
      composeInstant("issued", element.getIssuedElement());
    }
    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.hasDeviceNameElement()) {
      composeString("deviceName", element.getDeviceNameElement());
    }
    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()) {
      composeDecimal("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.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory());
    if (element.hasManufacturer()) {
      composeReference("manufacturer", element.getManufacturer());
    }
    if (element.hasForm()) {
      composeCodeableConcept("form", element.getForm());
    }
    if (element.hasAmount()) {
      composeRatio("amount", element.getAmount());
    }
    if (element.hasIngredient()) {
      for (Medication.MedicationIngredientComponent e : element.getIngredient())
        composeMedicationMedicationIngredientComponent("ingredient", e);
    }
    if (element.hasBatch()) {
      composeMedicationMedicationBatchComponent("batch", element.getBatch());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }
    if (element.hasIsActiveElement()) {
      composeBoolean("isActive", element.getIsActiveElement());
    }
    if (element.hasStrength()) {
      composeRatio("strength", element.getStrength());
    }
  }

  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationMedicationBatchComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationMedicationBatchComponentElements(Medication.MedicationBatchComponent element)
      throws IOException {
    composeBackboneElementElements(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.hasInstantiates()) {
      for (UriType e : element.getInstantiates())
        composeUri("instantiates", e);
    }
    if (element.hasPartOf()) {
      for (Reference e : element.getPartOf())
        composeReference("partOf", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new MedicationAdministration.MedicationAdministrationStatusEnumFactory());
    if (element.hasStatusReason()) {
      for (CodeableConcept e : element.getStatusReason())
        composeCodeableConcept("statusReason", e);
    }
    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.hasReasonCode()) {
      for (CodeableConcept e : element.getReasonCode())
        composeCodeableConcept("reasonCode", e);
    }
    if (element.hasReasonReference()) {
      for (Reference e : element.getReasonReference())
        composeReference("reasonReference", e);
    }
    if (element.hasRequest()) {
      composeReference("request", element.getRequest());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  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 {
    composeBackboneElementElements(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()) {
      composeQuantity("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.hasStatusReason()) {
      composeType("statusReason", element.getStatusReason());
    }
    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.hasLocation()) {
      composeReference("location", element.getLocation());
    }
    if (element.hasAuthorizingPrescription()) {
      for (Reference e : element.getAuthorizingPrescription())
        composeReference("authorizingPrescription", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasDaysSupply()) {
      composeQuantity("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.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 {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  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 {
    composeBackboneElementElements(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 composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeElements(MedicationKnowledge element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory());
    if (element.hasManufacturer()) {
      composeReference("manufacturer", element.getManufacturer());
    }
    if (element.hasDoseForm()) {
      composeCodeableConcept("doseForm", element.getDoseForm());
    }
    if (element.hasAmount()) {
      composeQuantity("amount", element.getAmount());
    }
    if (element.hasSynonym()) {
      for (StringType e : element.getSynonym())
        composeString("synonym", e);
    }
    if (element.hasRelatedMedicationKnowledge()) {
      for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element
          .getRelatedMedicationKnowledge())
        composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent("relatedMedicationKnowledge",
            e);
    }
    if (element.hasAssociatedMedication()) {
      for (Reference e : element.getAssociatedMedication())
        composeReference("associatedMedication", e);
    }
    if (element.hasProductType()) {
      for (CodeableConcept e : element.getProductType())
        composeCodeableConcept("productType", e);
    }
    if (element.hasMonograph()) {
      for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph())
        composeMedicationKnowledgeMedicationKnowledgeMonographComponent("monograph", e);
    }
    if (element.hasIngredient()) {
      for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient())
        composeMedicationKnowledgeMedicationKnowledgeIngredientComponent("ingredient", e);
    }
    if (element.hasPreparationInstructionElement()) {
      composeMarkdown("preparationInstruction", element.getPreparationInstructionElement());
    }
    if (element.hasIntendedRoute()) {
      for (CodeableConcept e : element.getIntendedRoute())
        composeCodeableConcept("intendedRoute", e);
    }
    if (element.hasCost()) {
      for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost())
        composeMedicationKnowledgeMedicationKnowledgeCostComponent("cost", e);
    }
    if (element.hasMonitoringProgram()) {
      for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram())
        composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent("monitoringProgram", e);
    }
    if (element.hasAdministrationGuidelines()) {
      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element
          .getAdministrationGuidelines())
        composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent("administrationGuidelines", e);
    }
    if (element.hasMedicineClassification()) {
      for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element
          .getMedicineClassification())
        composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent("medicineClassification", e);
    }
    if (element.hasPackaging()) {
      composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
    }
    if (element.hasDrugCharacteristic()) {
      for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic())
        composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent("drugCharacteristic", e);
    }
    if (element.hasContraindication()) {
      for (Reference e : element.getContraindication())
        composeReference("contraindication", e);
    }
    if (element.hasRegulatory()) {
      for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory())
        composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent("regulatory", e);
    }
    if (element.hasKinetics()) {
      for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics())
        composeMedicationKnowledgeMedicationKnowledgeKineticsComponent("kinetics", e);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name,
      MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentElements(
      MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasReference()) {
      for (Reference e : element.getReference())
        composeReference("reference", e);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name,
      MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeMonographComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentElements(
      MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSource()) {
      composeReference("source", element.getSource());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name,
      MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentElements(
      MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }
    if (element.hasIsActiveElement()) {
      composeBoolean("isActive", element.getIsActiveElement());
    }
    if (element.hasStrength()) {
      composeRatio("strength", element.getStrength());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name,
      MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeCostComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentElements(
      MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSourceElement()) {
      composeString("source", element.getSourceElement());
    }
    if (element.hasCost()) {
      composeMoney("cost", element.getCost());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name,
      MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentElements(
      MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name,
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentElements(
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDosage()) {
      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage())
        composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent("dosage", e);
    }
    if (element.hasIndication()) {
      composeType("indication", element.getIndication());
    }
    if (element.hasPatientCharacteristics()) {
      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element
          .getPatientCharacteristics())
        composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(
            "patientCharacteristics", e);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name,
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentElements(
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDosage()) {
      for (Dosage e : element.getDosage())
        composeDosage("dosage", e);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(
      String name,
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentElements(
          element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentElements(
      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCharacteristic()) {
      composeType("characteristic", element.getCharacteristic());
    }
    if (element.hasValue()) {
      for (StringType e : element.getValue())
        composeString("value", e);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name,
      MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentElements(
      MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasClassification()) {
      for (CodeableConcept e : element.getClassification())
        composeCodeableConcept("classification", e);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name,
      MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgePackagingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentElements(
      MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name,
      MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentElements(
      MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name,
      MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentElements(
      MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRegulatoryAuthority()) {
      composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
    }
    if (element.hasSubstitution()) {
      for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution())
        composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent("substitution", e);
    }
    if (element.hasSchedule()) {
      for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule())
        composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent("schedule", e);
    }
    if (element.hasMaxDispense()) {
      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense",
          element.getMaxDispense());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name,
      MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentElements(
      MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasAllowedElement()) {
      composeBoolean("allowed", element.getAllowedElement());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(String name,
      MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentElements(
      MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSchedule()) {
      composeCodeableConcept("schedule", element.getSchedule());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name,
      MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentElements(
      MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasPeriod()) {
      composeDuration("period", element.getPeriod());
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(String name,
      MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicationKnowledgeKineticsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponentElements(
      MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAreaUnderCurve()) {
      for (Quantity e : element.getAreaUnderCurve())
        composeQuantity("areaUnderCurve", e);
    }
    if (element.hasLethalDose50()) {
      for (Quantity e : element.getLethalDose50())
        composeQuantity("lethalDose50", e);
    }
    if (element.hasHalfLifePeriod()) {
      composeDuration("halfLifePeriod", element.getHalfLifePeriod());
    }
  }

  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.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new MedicationRequest.MedicationRequestStatusEnumFactory());
    if (element.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(),
          new MedicationRequest.MedicationRequestIntentEnumFactory());
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(),
          new MedicationRequest.MedicationRequestPriorityEnumFactory());
    if (element.hasDoNotPerformElement()) {
      composeBoolean("doNotPerform", element.getDoNotPerformElement());
    }
    if (element.hasReported()) {
      composeType("reported", element.getReported());
    }
    if (element.hasMedication()) {
      composeType("medication", element.getMedication());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasSupportingInformation()) {
      for (Reference e : element.getSupportingInformation())
        composeReference("supportingInformation", e);
    }
    if (element.hasAuthoredOnElement()) {
      composeDateTime("authoredOn", element.getAuthoredOnElement());
    }
    if (element.hasRequester()) {
      composeReference("requester", element.getRequester());
    }
    if (element.hasPerformer()) {
      composeReference("performer", element.getPerformer());
    }
    if (element.hasPerformerType()) {
      composeCodeableConcept("performerType", element.getPerformerType());
    }
    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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", e);
    }
    if (element.hasBasedOn()) {
      for (Reference e : element.getBasedOn())
        composeReference("basedOn", e);
    }
    if (element.hasGroupIdentifier()) {
      composeIdentifier("groupIdentifier", element.getGroupIdentifier());
    }
    if (element.hasCourseOfTherapyType()) {
      composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
    }
    if (element.hasInsurance()) {
      for (Reference e : element.getInsurance())
        composeReference("insurance", 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 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 {
    composeBackboneElementElements(element);
    if (element.hasInitialFill()) {
      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill",
          element.getInitialFill());
    }
    if (element.hasDispenseInterval()) {
      composeDuration("dispenseInterval", element.getDispenseInterval());
    }
    if (element.hasValidityPeriod()) {
      composePeriod("validityPeriod", element.getValidityPeriod());
    }
    if (element.hasNumberOfRepeatsAllowedElement()) {
      composeUnsignedInt("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasExpectedSupplyDuration()) {
      composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
    }
    if (element.hasPerformer()) {
      composeReference("performer", element.getPerformer());
    }
  }

  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name,
      MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentElements(
      MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasDuration()) {
      composeDuration("duration", element.getDuration());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasAllowed()) {
      composeType("allowed", element.getAllowed());
    }
    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.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new MedicationStatement.MedicationStatementStatusEnumFactory());
    if (element.hasStatusReason()) {
      for (CodeableConcept e : element.getStatusReason())
        composeCodeableConcept("statusReason", e);
    }
    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.hasEffective()) {
      composeType("effective", element.getEffective());
    }
    if (element.hasDateAssertedElement()) {
      composeDateTime("dateAsserted", element.getDateAssertedElement());
    }
    if (element.hasInformationSource()) {
      composeReference("informationSource", element.getInformationSource());
    }
    if (element.hasDerivedFrom()) {
      for (Reference e : element.getDerivedFrom())
        composeReference("derivedFrom", 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 composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductElements(MedicinalProduct element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDomain()) {
      composeCoding("domain", element.getDomain());
    }
    if (element.hasCombinedPharmaceuticalDoseForm()) {
      composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
    }
    if (element.hasLegalStatusOfSupply()) {
      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
    }
    if (element.hasAdditionalMonitoringIndicator()) {
      composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
    }
    if (element.hasSpecialMeasures()) {
      for (StringType e : element.getSpecialMeasures())
        composeString("specialMeasures", e);
    }
    if (element.hasPaediatricUseIndicator()) {
      composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
    }
    if (element.hasProductClassification()) {
      for (CodeableConcept e : element.getProductClassification())
        composeCodeableConcept("productClassification", e);
    }
    if (element.hasMarketingStatus()) {
      for (MarketingStatus e : element.getMarketingStatus())
        composeMarketingStatus("marketingStatus", e);
    }
    if (element.hasPharmaceuticalProduct()) {
      for (Reference e : element.getPharmaceuticalProduct())
        composeReference("pharmaceuticalProduct", e);
    }
    if (element.hasPackagedMedicinalProduct()) {
      for (Reference e : element.getPackagedMedicinalProduct())
        composeReference("packagedMedicinalProduct", e);
    }
    if (element.hasAttachedDocument()) {
      for (Reference e : element.getAttachedDocument())
        composeReference("attachedDocument", e);
    }
    if (element.hasMasterFile()) {
      for (Reference e : element.getMasterFile())
        composeReference("masterFile", e);
    }
    if (element.hasContact()) {
      for (Reference e : element.getContact())
        composeReference("contact", e);
    }
    if (element.hasClinicalTrial()) {
      for (Reference e : element.getClinicalTrial())
        composeReference("clinicalTrial", e);
    }
    if (element.hasName()) {
      for (MedicinalProduct.MedicinalProductNameComponent e : element.getName())
        composeMedicinalProductMedicinalProductNameComponent("name", e);
    }
    if (element.hasCrossReference()) {
      for (Identifier e : element.getCrossReference())
        composeIdentifier("crossReference", e);
    }
    if (element.hasManufacturingBusinessOperation()) {
      for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element
          .getManufacturingBusinessOperation())
        composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent("manufacturingBusinessOperation",
            e);
    }
    if (element.hasSpecialDesignation()) {
      for (MedicinalProduct.MedicinalProductSpecialDesignationComponent e : element.getSpecialDesignation())
        composeMedicinalProductMedicinalProductSpecialDesignationComponent("specialDesignation", e);
    }
  }

  protected void composeMedicinalProductMedicinalProductNameComponent(String name,
      MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductMedicinalProductNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductMedicinalProductNameComponentElements(
      MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProductNameElement()) {
      composeString("productName", element.getProductNameElement());
    }
    if (element.hasNamePart()) {
      for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart())
        composeMedicinalProductMedicinalProductNameNamePartComponent("namePart", e);
    }
    if (element.hasCountryLanguage()) {
      for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage())
        composeMedicinalProductMedicinalProductNameCountryLanguageComponent("countryLanguage", e);
    }
  }

  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name,
      MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductMedicinalProductNameNamePartComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductMedicinalProductNameNamePartComponentElements(
      MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPartElement()) {
      composeString("part", element.getPartElement());
    }
    if (element.hasType()) {
      composeCoding("type", element.getType());
    }
  }

  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name,
      MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductMedicinalProductNameCountryLanguageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentElements(
      MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCountry()) {
      composeCodeableConcept("country", element.getCountry());
    }
    if (element.hasJurisdiction()) {
      composeCodeableConcept("jurisdiction", element.getJurisdiction());
    }
    if (element.hasLanguage()) {
      composeCodeableConcept("language", element.getLanguage());
    }
  }

  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name,
      MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentElements(
      MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasOperationType()) {
      composeCodeableConcept("operationType", element.getOperationType());
    }
    if (element.hasAuthorisationReferenceNumber()) {
      composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
    }
    if (element.hasEffectiveDateElement()) {
      composeDateTime("effectiveDate", element.getEffectiveDateElement());
    }
    if (element.hasConfidentialityIndicator()) {
      composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
    }
    if (element.hasManufacturer()) {
      for (Reference e : element.getManufacturer())
        composeReference("manufacturer", e);
    }
    if (element.hasRegulator()) {
      composeReference("regulator", element.getRegulator());
    }
  }

  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponent(String name,
      MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductMedicinalProductSpecialDesignationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponentElements(
      MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasIntendedUse()) {
      composeCodeableConcept("intendedUse", element.getIntendedUse());
    }
    if (element.hasIndication()) {
      composeType("indication", element.getIndication());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasSpecies()) {
      composeCodeableConcept("species", element.getSpecies());
    }
  }

  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductAuthorizationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductAuthorizationElements(MedicinalProductAuthorization element)
      throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasCountry()) {
      for (CodeableConcept e : element.getCountry())
        composeCodeableConcept("country", e);
    }
    if (element.hasJurisdiction()) {
      for (CodeableConcept e : element.getJurisdiction())
        composeCodeableConcept("jurisdiction", e);
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasStatusDateElement()) {
      composeDateTime("statusDate", element.getStatusDateElement());
    }
    if (element.hasRestoreDateElement()) {
      composeDateTime("restoreDate", element.getRestoreDateElement());
    }
    if (element.hasValidityPeriod()) {
      composePeriod("validityPeriod", element.getValidityPeriod());
    }
    if (element.hasDataExclusivityPeriod()) {
      composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
    }
    if (element.hasDateOfFirstAuthorizationElement()) {
      composeDateTime("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement());
    }
    if (element.hasInternationalBirthDateElement()) {
      composeDateTime("internationalBirthDate", element.getInternationalBirthDateElement());
    }
    if (element.hasLegalBasis()) {
      composeCodeableConcept("legalBasis", element.getLegalBasis());
    }
    if (element.hasJurisdictionalAuthorization()) {
      for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element
          .getJurisdictionalAuthorization())
        composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(
            "jurisdictionalAuthorization", e);
    }
    if (element.hasHolder()) {
      composeReference("holder", element.getHolder());
    }
    if (element.hasRegulator()) {
      composeReference("regulator", element.getRegulator());
    }
    if (element.hasProcedure()) {
      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure",
          element.getProcedure());
    }
  }

  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(
      String name,
      MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentElements(
          element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentElements(
      MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasCountry()) {
      composeCodeableConcept("country", element.getCountry());
    }
    if (element.hasJurisdiction()) {
      for (CodeableConcept e : element.getJurisdiction())
        composeCodeableConcept("jurisdiction", e);
    }
    if (element.hasLegalStatusOfSupply()) {
      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
    }
    if (element.hasValidityPeriod()) {
      composePeriod("validityPeriod", element.getValidityPeriod());
    }
  }

  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name,
      MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentElements(
      MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDate()) {
      composeType("date", element.getDate());
    }
    if (element.hasApplication()) {
      for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent e : element.getApplication())
        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("application", e);
    }
  }

  protected void composeMedicinalProductContraindication(String name, MedicinalProductContraindication element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductContraindicationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductContraindicationElements(MedicinalProductContraindication element)
      throws IOException {
    composeDomainResourceElements(element);
    if (element.hasSubject()) {
      for (Reference e : element.getSubject())
        composeReference("subject", e);
    }
    if (element.hasDisease()) {
      composeCodeableConcept("disease", element.getDisease());
    }
    if (element.hasDiseaseStatus()) {
      composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
    }
    if (element.hasComorbidity()) {
      for (CodeableConcept e : element.getComorbidity())
        composeCodeableConcept("comorbidity", e);
    }
    if (element.hasTherapeuticIndication()) {
      for (Reference e : element.getTherapeuticIndication())
        composeReference("therapeuticIndication", e);
    }
    if (element.hasOtherTherapy()) {
      for (MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent e : element
          .getOtherTherapy())
        composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent("otherTherapy", e);
    }
    if (element.hasPopulation()) {
      for (Population e : element.getPopulation())
        composePopulation("population", e);
    }
  }

  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(
      String name, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentElements(
      MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTherapyRelationshipType()) {
      composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
    }
    if (element.hasMedication()) {
      composeType("medication", element.getMedication());
    }
  }

  protected void composeMedicinalProductIndication(String name, MedicinalProductIndication element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductIndicationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductIndicationElements(MedicinalProductIndication element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasSubject()) {
      for (Reference e : element.getSubject())
        composeReference("subject", e);
    }
    if (element.hasDiseaseSymptomProcedure()) {
      composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
    }
    if (element.hasDiseaseStatus()) {
      composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
    }
    if (element.hasComorbidity()) {
      for (CodeableConcept e : element.getComorbidity())
        composeCodeableConcept("comorbidity", e);
    }
    if (element.hasIntendedEffect()) {
      composeCodeableConcept("intendedEffect", element.getIntendedEffect());
    }
    if (element.hasDuration()) {
      composeQuantity("duration", element.getDuration());
    }
    if (element.hasOtherTherapy()) {
      for (MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent e : element.getOtherTherapy())
        composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent("otherTherapy", e);
    }
    if (element.hasUndesirableEffect()) {
      for (Reference e : element.getUndesirableEffect())
        composeReference("undesirableEffect", e);
    }
    if (element.hasPopulation()) {
      for (Population e : element.getPopulation())
        composePopulation("population", e);
    }
  }

  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(String name,
      MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentElements(
      MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTherapyRelationshipType()) {
      composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
    }
    if (element.hasMedication()) {
      composeType("medication", element.getMedication());
    }
  }

  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductIngredientElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductIngredientElements(MedicinalProductIngredient element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasAllergenicIndicatorElement()) {
      composeBoolean("allergenicIndicator", element.getAllergenicIndicatorElement());
    }
    if (element.hasManufacturer()) {
      for (Reference e : element.getManufacturer())
        composeReference("manufacturer", e);
    }
    if (element.hasSpecifiedSubstance()) {
      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element
          .getSpecifiedSubstance())
        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent("specifiedSubstance", e);
    }
    if (element.hasSubstance()) {
      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance",
          element.getSubstance());
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name,
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentElements(
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasGroup()) {
      composeCodeableConcept("group", element.getGroup());
    }
    if (element.hasConfidentiality()) {
      composeCodeableConcept("confidentiality", element.getConfidentiality());
    }
    if (element.hasStrength()) {
      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element
          .getStrength())
        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent("strength", e);
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(
      String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentElements(
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPresentation()) {
      composeRatio("presentation", element.getPresentation());
    }
    if (element.hasPresentationLowLimit()) {
      composeRatio("presentationLowLimit", element.getPresentationLowLimit());
    }
    if (element.hasConcentration()) {
      composeRatio("concentration", element.getConcentration());
    }
    if (element.hasConcentrationLowLimit()) {
      composeRatio("concentrationLowLimit", element.getConcentrationLowLimit());
    }
    if (element.hasMeasurementPointElement()) {
      composeString("measurementPoint", element.getMeasurementPointElement());
    }
    if (element.hasCountry()) {
      for (CodeableConcept e : element.getCountry())
        composeCodeableConcept("country", e);
    }
    if (element.hasReferenceStrength()) {
      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element
          .getReferenceStrength())
        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
            "referenceStrength", e);
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
      String name,
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentElements(
          element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentElements(
      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSubstance()) {
      composeCodeableConcept("substance", element.getSubstance());
    }
    if (element.hasStrength()) {
      composeRatio("strength", element.getStrength());
    }
    if (element.hasStrengthLowLimit()) {
      composeRatio("strengthLowLimit", element.getStrengthLowLimit());
    }
    if (element.hasMeasurementPointElement()) {
      composeString("measurementPoint", element.getMeasurementPointElement());
    }
    if (element.hasCountry()) {
      for (CodeableConcept e : element.getCountry())
        composeCodeableConcept("country", e);
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name,
      MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentElements(
      MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasStrength()) {
      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element
          .getStrength())
        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent("strength", e);
    }
  }

  protected void composeMedicinalProductInteraction(String name, MedicinalProductInteraction element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductInteractionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductInteractionElements(MedicinalProductInteraction element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasSubject()) {
      for (Reference e : element.getSubject())
        composeReference("subject", e);
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasInteractant()) {
      for (MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent e : element.getInteractant())
        composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent("interactant", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasEffect()) {
      composeCodeableConcept("effect", element.getEffect());
    }
    if (element.hasIncidence()) {
      composeCodeableConcept("incidence", element.getIncidence());
    }
    if (element.hasManagement()) {
      composeCodeableConcept("management", element.getManagement());
    }
  }

  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(String name,
      MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentElements(
      MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }
  }

  protected void composeMedicinalProductManufactured(String name, MedicinalProductManufactured element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductManufacturedElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductManufacturedElements(MedicinalProductManufactured element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasManufacturedDoseForm()) {
      composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
    }
    if (element.hasUnitOfPresentation()) {
      composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasManufacturer()) {
      for (Reference e : element.getManufacturer())
        composeReference("manufacturer", e);
    }
    if (element.hasIngredient()) {
      for (Reference e : element.getIngredient())
        composeReference("ingredient", e);
    }
    if (element.hasPhysicalCharacteristics()) {
      composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
    }
    if (element.hasOtherCharacteristics()) {
      for (CodeableConcept e : element.getOtherCharacteristics())
        composeCodeableConcept("otherCharacteristics", e);
    }
  }

  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPackagedElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPackagedElements(MedicinalProductPackaged element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasSubject()) {
      for (Reference e : element.getSubject())
        composeReference("subject", e);
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasLegalStatusOfSupply()) {
      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
    }
    if (element.hasMarketingStatus()) {
      for (MarketingStatus e : element.getMarketingStatus())
        composeMarketingStatus("marketingStatus", e);
    }
    if (element.hasMarketingAuthorization()) {
      composeReference("marketingAuthorization", element.getMarketingAuthorization());
    }
    if (element.hasManufacturer()) {
      for (Reference e : element.getManufacturer())
        composeReference("manufacturer", e);
    }
    if (element.hasBatchIdentifier()) {
      for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier())
        composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent("batchIdentifier", e);
    }
    if (element.hasPackageItem()) {
      for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem())
        composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent("packageItem", e);
    }
  }

  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name,
      MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentElements(
      MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasOuterPackaging()) {
      composeIdentifier("outerPackaging", element.getOuterPackaging());
    }
    if (element.hasImmediatePackaging()) {
      composeIdentifier("immediatePackaging", element.getImmediatePackaging());
    }
  }

  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name,
      MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentElements(
      MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasMaterial()) {
      for (CodeableConcept e : element.getMaterial())
        composeCodeableConcept("material", e);
    }
    if (element.hasAlternateMaterial()) {
      for (CodeableConcept e : element.getAlternateMaterial())
        composeCodeableConcept("alternateMaterial", e);
    }
    if (element.hasDevice()) {
      for (Reference e : element.getDevice())
        composeReference("device", e);
    }
    if (element.hasManufacturedItem()) {
      for (Reference e : element.getManufacturedItem())
        composeReference("manufacturedItem", e);
    }
    if (element.hasPackageItem()) {
      for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem())
        composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent("packageItem", e);
    }
    if (element.hasPhysicalCharacteristics()) {
      composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
    }
    if (element.hasOtherCharacteristics()) {
      for (CodeableConcept e : element.getOtherCharacteristics())
        composeCodeableConcept("otherCharacteristics", e);
    }
    if (element.hasShelfLifeStorage()) {
      for (ProductShelfLife e : element.getShelfLifeStorage())
        composeProductShelfLife("shelfLifeStorage", e);
    }
    if (element.hasManufacturer()) {
      for (Reference e : element.getManufacturer())
        composeReference("manufacturer", e);
    }
  }

  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPharmaceuticalElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPharmaceuticalElements(MedicinalProductPharmaceutical element)
      throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasAdministrableDoseForm()) {
      composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
    }
    if (element.hasUnitOfPresentation()) {
      composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
    }
    if (element.hasIngredient()) {
      for (Reference e : element.getIngredient())
        composeReference("ingredient", e);
    }
    if (element.hasDevice()) {
      for (Reference e : element.getDevice())
        composeReference("device", e);
    }
    if (element.hasCharacteristics()) {
      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element
          .getCharacteristics())
        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent("characteristics",
            e);
    }
    if (element.hasRouteOfAdministration()) {
      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent e : element
          .getRouteOfAdministration())
        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(
            "routeOfAdministration", e);
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(
      String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentElements(
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(
      String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentElements(
          element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentElements(
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasFirstDose()) {
      composeQuantity("firstDose", element.getFirstDose());
    }
    if (element.hasMaxSingleDose()) {
      composeQuantity("maxSingleDose", element.getMaxSingleDose());
    }
    if (element.hasMaxDosePerDay()) {
      composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
    }
    if (element.hasMaxDosePerTreatmentPeriod()) {
      composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
    }
    if (element.hasMaxTreatmentPeriod()) {
      composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
    }
    if (element.hasTargetSpecies()) {
      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent e : element
          .getTargetSpecies())
        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
            "targetSpecies", e);
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
      String name,
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentElements(
          element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentElements(
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasWithdrawalPeriod()) {
      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element
          .getWithdrawalPeriod())
        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
            "withdrawalPeriod", e);
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
      String name,
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentElements(
          element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentElements(
      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTissue()) {
      composeCodeableConcept("tissue", element.getTissue());
    }
    if (element.hasValue()) {
      composeQuantity("value", element.getValue());
    }
    if (element.hasSupportingInformationElement()) {
      composeString("supportingInformation", element.getSupportingInformationElement());
    }
  }

  protected void composeMedicinalProductUndesirableEffect(String name, MedicinalProductUndesirableEffect element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductUndesirableEffectElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductUndesirableEffectElements(MedicinalProductUndesirableEffect element)
      throws IOException {
    composeDomainResourceElements(element);
    if (element.hasSubject()) {
      for (Reference e : element.getSubject())
        composeReference("subject", e);
    }
    if (element.hasSymptomConditionEffect()) {
      composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
    }
    if (element.hasClassification()) {
      composeCodeableConcept("classification", element.getClassification());
    }
    if (element.hasFrequencyOfOccurrence()) {
      composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
    }
    if (element.hasPopulation()) {
      for (Population e : element.getPopulation())
        composePopulation("population", 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()) {
      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.hasReplaces()) {
      for (CanonicalType e : element.getReplaces())
        composeCanonical("replaces", e);
    }
    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.hasBaseElement()) {
      composeCanonical("base", element.getBaseElement());
    }
    if (element.hasParent()) {
      for (CanonicalType e : element.getParent())
        composeCanonical("parent", e);
    }
    if (element.hasEvent()) {
      composeType("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())
      composeEnumeration("responseRequired", element.getResponseRequiredElement(),
          new MessageDefinition.MessageheaderResponseRequestEnumFactory());
    if (element.hasAllowedResponse()) {
      for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse())
        composeMessageDefinitionMessageDefinitionAllowedResponseComponent("allowedResponse", e);
    }
    if (element.hasGraph()) {
      for (CanonicalType e : element.getGraph())
        composeCanonical("graph", 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 {
    composeBackboneElementElements(element);
    if (element.hasCodeElement()) {
      composeCode("code", element.getCodeElement());
    }
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasMessageElement()) {
      composeCanonical("message", element.getMessageElement());
    }
    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()) {
      composeType("event", element.getEvent());
    }
    if (element.hasDestination()) {
      for (MessageHeader.MessageDestinationComponent e : element.getDestination())
        composeMessageHeaderMessageDestinationComponent("destination", e);
    }
    if (element.hasSender()) {
      composeReference("sender", element.getSender());
    }
    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);
    }
    if (element.hasDefinitionElement()) {
      composeCanonical("definition", element.getDefinitionElement());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTarget()) {
      composeReference("target", element.getTarget());
    }
    if (element.hasEndpointElement()) {
      composeUrl("endpoint", element.getEndpointElement());
    }
    if (element.hasReceiver()) {
      composeReference("receiver", element.getReceiver());
    }
  }

  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 {
    composeBackboneElementElements(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()) {
      composeUrl("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 {
    composeBackboneElementElements(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 composeMolecularSequence(String name, MolecularSequence element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceElements(MolecularSequence element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new MolecularSequence.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()) {
      composeMolecularSequenceMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
    }
    if (element.hasVariant()) {
      for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant())
        composeMolecularSequenceMolecularSequenceVariantComponent("variant", e);
    }
    if (element.hasObservedSeqElement()) {
      composeString("observedSeq", element.getObservedSeqElement());
    }
    if (element.hasQuality()) {
      for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality())
        composeMolecularSequenceMolecularSequenceQualityComponent("quality", e);
    }
    if (element.hasReadCoverageElement()) {
      composeInteger("readCoverage", element.getReadCoverageElement());
    }
    if (element.hasRepository()) {
      for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository())
        composeMolecularSequenceMolecularSequenceRepositoryComponent("repository", e);
    }
    if (element.hasPointer()) {
      for (Reference e : element.getPointer())
        composeReference("pointer", e);
    }
    if (element.hasStructureVariant()) {
      for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant())
        composeMolecularSequenceMolecularSequenceStructureVariantComponent("structureVariant", e);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponent(String name,
      MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceReferenceSeqComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponentElements(
      MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasChromosome()) {
      composeCodeableConcept("chromosome", element.getChromosome());
    }
    if (element.hasGenomeBuildElement()) {
      composeString("genomeBuild", element.getGenomeBuildElement());
    }
    if (element.hasOrientationElement())
      composeEnumeration("orientation", element.getOrientationElement(),
          new MolecularSequence.OrientationTypeEnumFactory());
    if (element.hasReferenceSeqId()) {
      composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
    }
    if (element.hasReferenceSeqPointer()) {
      composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
    }
    if (element.hasReferenceSeqStringElement()) {
      composeString("referenceSeqString", element.getReferenceSeqStringElement());
    }
    if (element.hasStrandElement())
      composeEnumeration("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory());
    if (element.hasWindowStartElement()) {
      composeInteger("windowStart", element.getWindowStartElement());
    }
    if (element.hasWindowEndElement()) {
      composeInteger("windowEnd", element.getWindowEndElement());
    }
  }

  protected void composeMolecularSequenceMolecularSequenceVariantComponent(String name,
      MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceVariantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceVariantComponentElements(
      MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
    composeBackboneElementElements(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 composeMolecularSequenceMolecularSequenceQualityComponent(String name,
      MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceQualityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceQualityComponentElements(
      MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new MolecularSequence.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());
    }
    if (element.hasRoc()) {
      composeMolecularSequenceMolecularSequenceQualityRocComponent("roc", element.getRoc());
    }
  }

  protected void composeMolecularSequenceMolecularSequenceQualityRocComponent(String name,
      MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceQualityRocComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceQualityRocComponentElements(
      MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasScore()) {
      for (IntegerType e : element.getScore())
        composeInteger("score", e);
    }
    if (element.hasNumTP()) {
      for (IntegerType e : element.getNumTP())
        composeInteger("numTP", e);
    }
    if (element.hasNumFP()) {
      for (IntegerType e : element.getNumFP())
        composeInteger("numFP", e);
    }
    if (element.hasNumFN()) {
      for (IntegerType e : element.getNumFN())
        composeInteger("numFN", e);
    }
    if (element.hasPrecision()) {
      for (DecimalType e : element.getPrecision())
        composeDecimal("precision", e);
    }
    if (element.hasSensitivity()) {
      for (DecimalType e : element.getSensitivity())
        composeDecimal("sensitivity", e);
    }
    if (element.hasFMeasure()) {
      for (DecimalType e : element.getFMeasure())
        composeDecimal("fMeasure", e);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceRepositoryComponent(String name,
      MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceRepositoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceRepositoryComponentElements(
      MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new MolecularSequence.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 composeMolecularSequenceMolecularSequenceStructureVariantComponent(String name,
      MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceStructureVariantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponentElements(
      MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasVariantType()) {
      composeCodeableConcept("variantType", element.getVariantType());
    }
    if (element.hasExactElement()) {
      composeBoolean("exact", element.getExactElement());
    }
    if (element.hasLengthElement()) {
      composeInteger("length", element.getLengthElement());
    }
    if (element.hasOuter()) {
      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
    }
    if (element.hasInner()) {
      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
    }
  }

  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent(String name,
      MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentElements(
      MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasStartElement()) {
      composeInteger("start", element.getStartElement());
    }
    if (element.hasEndElement()) {
      composeInteger("end", element.getEndElement());
    }
  }

  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent(String name,
      MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentElements(
      MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasStartElement()) {
      composeInteger("start", element.getStartElement());
    }
    if (element.hasEndElement()) {
      composeInteger("end", element.getEndElement());
    }
  }

  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);
    }
  }

  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 {
    composeBackboneElementElements(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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", e);
    }
    if (element.hasInstantiates()) {
      for (UriType e : element.getInstantiates())
        composeUri("instantiates", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory());
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory());
    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());
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasModifier()) {
      composeCodeableConcept("modifier", element.getModifier());
    }
    if (element.hasAmount()) {
      composeQuantity("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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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()) {
      composeQuantity("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 {
    composeBackboneElementElements(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()) {
      composeQuantity("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()) {
      composeQuantity("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 {
    composeBackboneElementElements(element);
    if (element.hasSchedule()) {
      composeTiming("schedule", element.getSchedule());
    }
    if (element.hasQuantity()) {
      composeQuantity("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.hasPartOf()) {
      for (Reference e : element.getPartOf())
        composeReference("partOf", 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.hasFocus()) {
      for (Reference e : element.getFocus())
        composeReference("focus", e);
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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()) {
      for (CodeableConcept e : element.getInterpretation())
        composeCodeableConcept("interpretation", e);
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
    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.hasHasMember()) {
      for (Reference e : element.getHasMember())
        composeReference("hasMember", e);
    }
    if (element.hasDerivedFrom()) {
      for (Reference e : element.getDerivedFrom())
        composeReference("derivedFrom", 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 {
    composeBackboneElementElements(element);
    if (element.hasLow()) {
      composeQuantity("low", element.getLow());
    }
    if (element.hasHigh()) {
      composeQuantity("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 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 {
    composeBackboneElementElements(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()) {
      for (CodeableConcept e : element.getInterpretation())
        composeCodeableConcept("interpretation", e);
    }
    if (element.hasReferenceRange()) {
      for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange())
        composeObservationObservationReferenceRangeComponent("referenceRange", e);
    }
  }

  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationDefinitionElements(ObservationDefinition element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasPermittedDataType())
      for (Enumeration e : element.getPermittedDataType())
        composeEnumeration("permittedDataType", e, new ObservationDefinition.ObservationDataTypeEnumFactory());
    if (element.hasMultipleResultsAllowedElement()) {
      composeBoolean("multipleResultsAllowed", element.getMultipleResultsAllowedElement());
    }
    if (element.hasMethod()) {
      composeCodeableConcept("method", element.getMethod());
    }
    if (element.hasPreferredReportNameElement()) {
      composeString("preferredReportName", element.getPreferredReportNameElement());
    }
    if (element.hasQuantitativeDetails()) {
      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails",
          element.getQuantitativeDetails());
    }
    if (element.hasQualifiedInterval()) {
      for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval())
        composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent("qualifiedInterval", e);
    }
    if (element.hasValidCodedValueSet()) {
      composeReference("validCodedValueSet", element.getValidCodedValueSet());
    }
    if (element.hasNormalCodedValueSet()) {
      composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
    }
    if (element.hasAbnormalCodedValueSet()) {
      composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
    }
    if (element.hasCriticalCodedValueSet()) {
      composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
    }
  }

  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name,
      ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentElements(
      ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCustomaryUnit()) {
      composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
    }
    if (element.hasUnit()) {
      composeCodeableConcept("unit", element.getUnit());
    }
    if (element.hasConversionFactorElement()) {
      composeDecimal("conversionFactor", element.getConversionFactorElement());
    }
    if (element.hasDecimalPrecisionElement()) {
      composeInteger("decimalPrecision", element.getDecimalPrecisionElement());
    }
  }

  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name,
      ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentElements(
      ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategoryElement())
      composeEnumeration("category", element.getCategoryElement(),
          new ObservationDefinition.ObservationRangeCategoryEnumFactory());
    if (element.hasRange()) {
      composeRange("range", element.getRange());
    }
    if (element.hasContext()) {
      composeCodeableConcept("context", element.getContext());
    }
    if (element.hasAppliesTo()) {
      for (CodeableConcept e : element.getAppliesTo())
        composeCodeableConcept("appliesTo", e);
    }
    if (element.hasGenderElement())
      composeEnumeration("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory());
    if (element.hasAge()) {
      composeRange("age", element.getAge());
    }
    if (element.hasGestationalAge()) {
      composeRange("gestationalAge", element.getGestationalAge());
    }
    if (element.hasConditionElement()) {
      composeString("condition", element.getConditionElement());
    }
  }

  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.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    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.hasAffectsStateElement()) {
      composeBoolean("affectsState", element.getAffectsStateElement());
    }
    if (element.hasCodeElement()) {
      composeCode("code", element.getCodeElement());
    }
    if (element.hasCommentElement()) {
      composeMarkdown("comment", element.getCommentElement());
    }
    if (element.hasBaseElement()) {
      composeCanonical("base", element.getBaseElement());
    }
    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.hasInputProfileElement()) {
      composeCanonical("inputProfile", element.getInputProfileElement());
    }
    if (element.hasOutputProfileElement()) {
      composeCanonical("outputProfile", element.getOutputProfileElement());
    }
    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 {
    composeBackboneElementElements(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.hasTargetProfile()) {
      for (CanonicalType e : element.getTargetProfile())
        composeCanonical("targetProfile", e);
    }
    if (element.hasSearchTypeElement())
      composeEnumeration("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory());
    if (element.hasBinding()) {
      composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
    }
    if (element.hasReferencedFrom()) {
      for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom())
        composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent("referencedFrom", e);
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasStrengthElement())
      composeEnumeration("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory());
    if (element.hasValueSetElement()) {
      composeCanonical("valueSet", element.getValueSetElement());
    }
  }

  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name,
      OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentElements(
      OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSourceElement()) {
      composeString("source", element.getSourceElement());
    }
    if (element.hasSourceIdElement()) {
      composeString("sourceId", element.getSourceIdElement());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOrganizationAffiliationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOrganizationAffiliationElements(OrganizationAffiliation 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.hasOrganization()) {
      composeReference("organization", element.getOrganization());
    }
    if (element.hasParticipatingOrganization()) {
      composeReference("participatingOrganization", element.getParticipatingOrganization());
    }
    if (element.hasNetwork()) {
      for (Reference e : element.getNetwork())
        composeReference("network", e);
    }
    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.hasEndpoint()) {
      for (Reference e : element.getEndpoint())
        composeReference("endpoint", e);
    }
  }

  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.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 {
    composeBackboneElementElements(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 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasCreatedElement()) {
      composeDateTime("created", element.getCreatedElement());
    }
    if (element.hasProvider()) {
      composeReference("provider", element.getProvider());
    }
    if (element.hasPayment()) {
      composeReference("payment", element.getPayment());
    }
    if (element.hasPaymentDateElement()) {
      composeDate("paymentDate", element.getPaymentDateElement());
    }
    if (element.hasPayee()) {
      composeReference("payee", element.getPayee());
    }
    if (element.hasRecipient()) {
      composeReference("recipient", element.getRecipient());
    }
    if (element.hasAmount()) {
      composeMoney("amount", element.getAmount());
    }
    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.hasPaymentIssuer()) {
      composeReference("paymentIssuer", element.getPaymentIssuer());
    }
    if (element.hasRequest()) {
      composeReference("request", element.getRequest());
    }
    if (element.hasRequestor()) {
      composeReference("requestor", element.getRequestor());
    }
    if (element.hasOutcomeElement())
      composeEnumeration("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory());
    if (element.hasDispositionElement()) {
      composeString("disposition", element.getDispositionElement());
    }
    if (element.hasPaymentDateElement()) {
      composeDate("paymentDate", element.getPaymentDateElement());
    }
    if (element.hasPaymentAmount()) {
      composeMoney("paymentAmount", element.getPaymentAmount());
    }
    if (element.hasPaymentIdentifier()) {
      composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
    }
    if (element.hasDetail()) {
      for (PaymentReconciliation.DetailsComponent e : element.getDetail())
        composePaymentReconciliationDetailsComponent("detail", e);
    }
    if (element.hasFormCode()) {
      composeCodeableConcept("formCode", element.getFormCode());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasPredecessor()) {
      composeIdentifier("predecessor", element.getPredecessor());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRequest()) {
      composeReference("request", element.getRequest());
    }
    if (element.hasSubmitter()) {
      composeReference("submitter", element.getSubmitter());
    }
    if (element.hasResponse()) {
      composeReference("response", element.getResponse());
    }
    if (element.hasDateElement()) {
      composeDate("date", element.getDateElement());
    }
    if (element.hasResponsible()) {
      composeReference("responsible", element.getResponsible());
    }
    if (element.hasPayee()) {
      composeReference("payee", element.getPayee());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory());
    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 {
    composeBackboneElementElements(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.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    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.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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.hasUsageElement()) {
      composeString("usage", element.getUsageElement());
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasLibrary()) {
      for (CanonicalType e : element.getLibrary())
        composeCanonical("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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasPrefixElement()) {
      composeString("prefix", element.getPrefixElement());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasTextEquivalentElement()) {
      composeString("textEquivalent", element.getTextEquivalentElement());
    }
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory());
    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.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    if (element.hasTrigger()) {
      for (TriggerDefinition e : element.getTrigger())
        composeTriggerDefinition("trigger", 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()) {
      composeCodeableConcept("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()) {
      composeType("definition", element.getDefinition());
    }
    if (element.hasTransformElement()) {
      composeCanonical("transform", element.getTransformElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory());
    if (element.hasExpression()) {
      composeExpression("expression", element.getExpression());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasPathElement()) {
      composeString("path", element.getPathElement());
    }
    if (element.hasExpression()) {
      composeExpression("expression", element.getExpression());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", 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.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasPerformed()) {
      composeType("performed", element.getPerformed());
    }
    if (element.hasRecorder()) {
      composeReference("recorder", element.getRecorder());
    }
    if (element.hasAsserter()) {
      composeReference("asserter", element.getAsserter());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasAction()) {
      composeCodeableConcept("action", element.getAction());
    }
    if (element.hasManipulated()) {
      composeReference("manipulated", element.getManipulated());
    }
  }

  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.hasOccurred()) {
      composeType("occurred", element.getOccurred());
    }
    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 (CodeableConcept e : element.getReason())
        composeCodeableConcept("reason", e);
    }
    if (element.hasActivity()) {
      composeCodeableConcept("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 {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRole()) {
      for (CodeableConcept e : element.getRole())
        composeCodeableConcept("role", e);
    }
    if (element.hasWho()) {
      composeReference("who", element.getWho());
    }
    if (element.hasOnBehalfOf()) {
      composeReference("onBehalfOf", element.getOnBehalfOf());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasRoleElement())
      composeEnumeration("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory());
    if (element.hasWhat()) {
      composeReference("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.hasDerivedFrom()) {
      for (CanonicalType e : element.getDerivedFrom())
        composeCanonical("derivedFrom", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasExperimentalElement()) {
      composeBoolean("experimental", element.getExperimentalElement());
    }
    if (element.hasSubjectType()) {
      for (CodeType e : element.getSubjectType())
        composeCode("subjectType", e);
    }
    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.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasCode()) {
      for (Coding e : element.getCode())
        composeCoding("code", 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 {
    composeBackboneElementElements(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.hasEnableBehaviorElement())
      composeEnumeration("enableBehavior", element.getEnableBehaviorElement(),
          new Questionnaire.EnableWhenBehaviorEnumFactory());
    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.hasAnswerValueSetElement()) {
      composeCanonical("answerValueSet", element.getAnswerValueSetElement());
    }
    if (element.hasAnswerOption()) {
      for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption())
        composeQuestionnaireQuestionnaireItemAnswerOptionComponent("answerOption", e);
    }
    if (element.hasInitial()) {
      for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial())
        composeQuestionnaireQuestionnaireItemInitialComponent("initial", e);
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasQuestionElement()) {
      composeString("question", element.getQuestionElement());
    }
    if (element.hasOperatorElement())
      composeEnumeration("operator", element.getOperatorElement(),
          new Questionnaire.QuestionnaireItemOperatorEnumFactory());
    if (element.hasAnswer()) {
      composeType("answer", element.getAnswer());
    }
  }

  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name,
      Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireQuestionnaireItemAnswerOptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentElements(
      Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
    if (element.hasInitialSelectedElement()) {
      composeBoolean("initialSelected", element.getInitialSelectedElement());
    }
  }

  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name,
      Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireQuestionnaireItemInitialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireQuestionnaireItemInitialComponentElements(
      Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
    composeBackboneElementElements(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.hasPartOf()) {
      for (Reference e : element.getPartOf())
        composeReference("partOf", e);
    }
    if (element.hasQuestionnaireElement()) {
      composeCanonical("questionnaire", element.getQuestionnaireElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(),
          new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory());
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasLinkIdElement()) {
      composeString("linkId", element.getLinkIdElement());
    }
    if (element.hasDefinitionElement()) {
      composeUri("definition", element.getDefinitionElement());
    }
    if (element.hasTextElement()) {
      composeString("text", element.getTextElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
    if (element.hasItem()) {
      for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem())
        composeQuestionnaireResponseQuestionnaireResponseItemComponent("item", e);
    }
  }

  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()) {
      for (CodeableConcept e : element.getRelationship())
        composeCodeableConcept("relationship", 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()) {
      for (Attachment e : element.getPhoto())
        composeAttachment("photo", e);
    }
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasCommunication()) {
      for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication())
        composeRelatedPersonRelatedPersonCommunicationComponent("communication", e);
    }
  }

  protected void composeRelatedPersonRelatedPersonCommunicationComponent(String name,
      RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRelatedPersonRelatedPersonCommunicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRelatedPersonRelatedPersonCommunicationComponentElements(
      RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasLanguage()) {
      composeCodeableConcept("language", element.getLanguage());
    }
    if (element.hasPreferredElement()) {
      composeBoolean("preferred", element.getPreferredElement());
    }
  }

  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.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", 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.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasAuthoredOnElement()) {
      composeDateTime("authoredOn", element.getAuthoredOnElement());
    }
    if (element.hasAuthor()) {
      composeReference("author", element.getAuthor());
    }
    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.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 {
    composeBackboneElementElements(element);
    if (element.hasPrefixElement()) {
      composeString("prefix", element.getPrefixElement());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasTextEquivalentElement()) {
      composeString("textEquivalent", element.getTextEquivalentElement());
    }
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory());
    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()) {
      composeCodeableConcept("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 {
    composeBackboneElementElements(element);
    if (element.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory());
    if (element.hasExpression()) {
      composeExpression("expression", element.getExpression());
    }
  }

  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 {
    composeBackboneElementElements(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 composeResearchDefinition(String name, ResearchDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchDefinitionElements(ResearchDefinition 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.hasShortTitleElement()) {
      composeString("shortTitle", element.getShortTitleElement());
    }
    if (element.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasExperimentalElement()) {
      composeBoolean("experimental", element.getExperimentalElement());
    }
    if (element.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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.hasComment()) {
      for (StringType e : element.getComment())
        composeString("comment", 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.hasUsageElement()) {
      composeString("usage", element.getUsageElement());
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasLibrary()) {
      for (CanonicalType e : element.getLibrary())
        composeCanonical("library", e);
    }
    if (element.hasPopulation()) {
      composeReference("population", element.getPopulation());
    }
    if (element.hasExposure()) {
      composeReference("exposure", element.getExposure());
    }
    if (element.hasExposureAlternative()) {
      composeReference("exposureAlternative", element.getExposureAlternative());
    }
    if (element.hasOutcome()) {
      composeReference("outcome", element.getOutcome());
    }
  }

  protected void composeResearchElementDefinition(String name, ResearchElementDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchElementDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchElementDefinitionElements(ResearchElementDefinition 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.hasShortTitleElement()) {
      composeString("shortTitle", element.getShortTitleElement());
    }
    if (element.hasSubtitleElement()) {
      composeString("subtitle", element.getSubtitleElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasExperimentalElement()) {
      composeBoolean("experimental", element.getExperimentalElement());
    }
    if (element.hasSubject()) {
      composeType("subject", element.getSubject());
    }
    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.hasComment()) {
      for (StringType e : element.getComment())
        composeString("comment", 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.hasUsageElement()) {
      composeString("usage", element.getUsageElement());
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasLibrary()) {
      for (CanonicalType e : element.getLibrary())
        composeCanonical("library", e);
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(),
          new ResearchElementDefinition.ResearchElementTypeEnumFactory());
    if (element.hasVariableTypeElement())
      composeEnumeration("variableType", element.getVariableTypeElement(),
          new ResearchElementDefinition.VariableTypeEnumFactory());
    if (element.hasCharacteristic()) {
      for (ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent e : element.getCharacteristic())
        composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent("characteristic", e);
    }
  }

  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(String name,
      ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentElements(
      ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDefinition()) {
      composeType("definition", element.getDefinition());
    }
    if (element.hasUsageContext()) {
      for (UsageContext e : element.getUsageContext())
        composeUsageContext("usageContext", e);
    }
    if (element.hasExcludeElement()) {
      composeBoolean("exclude", element.getExcludeElement());
    }
    if (element.hasUnitOfMeasure()) {
      composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
    }
    if (element.hasStudyEffectiveDescriptionElement()) {
      composeString("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement());
    }
    if (element.hasStudyEffective()) {
      composeType("studyEffective", element.getStudyEffective());
    }
    if (element.hasStudyEffectiveTimeFromStart()) {
      composeDuration("studyEffectiveTimeFromStart", element.getStudyEffectiveTimeFromStart());
    }
    if (element.hasStudyEffectiveGroupMeasureElement())
      composeEnumeration("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(),
          new ResearchElementDefinition.GroupMeasureEnumFactory());
    if (element.hasParticipantEffectiveDescriptionElement()) {
      composeString("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement());
    }
    if (element.hasParticipantEffective()) {
      composeType("participantEffective", element.getParticipantEffective());
    }
    if (element.hasParticipantEffectiveTimeFromStart()) {
      composeDuration("participantEffectiveTimeFromStart", element.getParticipantEffectiveTimeFromStart());
    }
    if (element.hasParticipantEffectiveGroupMeasureElement())
      composeEnumeration("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(),
          new ResearchElementDefinition.GroupMeasureEnumFactory());
  }

  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.hasPrimaryPurposeType()) {
      composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
    }
    if (element.hasPhase()) {
      composeCodeableConcept("phase", element.getPhase());
    }
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasFocus()) {
      for (CodeableConcept e : element.getFocus())
        composeCodeableConcept("focus", e);
    }
    if (element.hasCondition()) {
      for (CodeableConcept e : element.getCondition())
        composeCodeableConcept("condition", 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.hasLocation()) {
      for (CodeableConcept e : element.getLocation())
        composeCodeableConcept("location", 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);
    }
    if (element.hasObjective()) {
      for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective())
        composeResearchStudyResearchStudyObjectiveComponent("objective", 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 {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
  }

  protected void composeResearchStudyResearchStudyObjectiveComponent(String name,
      ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchStudyResearchStudyObjectiveComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchStudyResearchStudyObjectiveComponentElements(
      ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
  }

  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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    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.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }
    if (element.hasCondition()) {
      composeReference("condition", element.getCondition());
    }
    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.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.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
  }

  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 {
    composeBackboneElementElements(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 composeRiskEvidenceSynthesis(String name, RiskEvidenceSynthesis element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskEvidenceSynthesisElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskEvidenceSynthesisElements(RiskEvidenceSynthesis 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.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.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", 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.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasTopic()) {
      for (CodeableConcept e : element.getTopic())
        composeCodeableConcept("topic", e);
    }
    if (element.hasAuthor()) {
      for (ContactDetail e : element.getAuthor())
        composeContactDetail("author", e);
    }
    if (element.hasEditor()) {
      for (ContactDetail e : element.getEditor())
        composeContactDetail("editor", e);
    }
    if (element.hasReviewer()) {
      for (ContactDetail e : element.getReviewer())
        composeContactDetail("reviewer", e);
    }
    if (element.hasEndorser()) {
      for (ContactDetail e : element.getEndorser())
        composeContactDetail("endorser", e);
    }
    if (element.hasRelatedArtifact()) {
      for (RelatedArtifact e : element.getRelatedArtifact())
        composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasSynthesisType()) {
      composeCodeableConcept("synthesisType", element.getSynthesisType());
    }
    if (element.hasStudyType()) {
      composeCodeableConcept("studyType", element.getStudyType());
    }
    if (element.hasPopulation()) {
      composeReference("population", element.getPopulation());
    }
    if (element.hasExposure()) {
      composeReference("exposure", element.getExposure());
    }
    if (element.hasOutcome()) {
      composeReference("outcome", element.getOutcome());
    }
    if (element.hasSampleSize()) {
      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
    }
    if (element.hasRiskEstimate()) {
      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent("riskEstimate", element.getRiskEstimate());
    }
    if (element.hasCertainty()) {
      for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent e : element.getCertainty())
        composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent("certainty", e);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(String name,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentElements(
      RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNumberOfStudiesElement()) {
      composeInteger("numberOfStudies", element.getNumberOfStudiesElement());
    }
    if (element.hasNumberOfParticipantsElement()) {
      composeInteger("numberOfParticipants", element.getNumberOfParticipantsElement());
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(String name,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentElements(
      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValueElement()) {
      composeDecimal("value", element.getValueElement());
    }
    if (element.hasUnitOfMeasure()) {
      composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
    }
    if (element.hasDenominatorCountElement()) {
      composeInteger("denominatorCount", element.getDenominatorCountElement());
    }
    if (element.hasNumeratorCountElement()) {
      composeInteger("numeratorCount", element.getNumeratorCountElement());
    }
    if (element.hasPrecisionEstimate()) {
      for (RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent e : element
          .getPrecisionEstimate())
        composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent("precisionEstimate", e);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(String name,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentElements(
      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasLevelElement()) {
      composeDecimal("level", element.getLevelElement());
    }
    if (element.hasFromElement()) {
      composeDecimal("from", element.getFromElement());
    }
    if (element.hasToElement()) {
      composeDecimal("to", element.getToElement());
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(String name,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentElements(
      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRating()) {
      for (CodeableConcept e : element.getRating())
        composeCodeableConcept("rating", e);
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
    if (element.hasCertaintySubcomponent()) {
      for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element
          .getCertaintySubcomponent())
        composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
            "certaintySubcomponent", e);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name,
      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentElements(
      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRating()) {
      for (CodeableConcept e : element.getRating())
        composeCodeableConcept("rating", e);
    }
    if (element.hasNote()) {
      for (Annotation e : element.getNote())
        composeAnnotation("note", e);
    }
  }

  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()) {
      for (CodeableConcept e : element.getServiceCategory())
        composeCodeableConcept("serviceCategory", e);
    }
    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.hasDerivedFromElement()) {
      composeCanonical("derivedFrom", element.getDerivedFromElement());
    }
    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.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.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.hasMultipleOrElement()) {
      composeBoolean("multipleOr", element.getMultipleOrElement());
    }
    if (element.hasMultipleAndElement()) {
      composeBoolean("multipleAnd", element.getMultipleAndElement());
    }
    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 {
    composeBackboneElementElements(element);
    if (element.hasDefinitionElement()) {
      composeCanonical("definition", element.getDefinitionElement());
    }
    if (element.hasExpressionElement()) {
      composeString("expression", element.getExpressionElement());
    }
  }

  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeServiceRequestElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeServiceRequestElements(ServiceRequest element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    if (element.hasInstantiatesCanonical()) {
      for (CanonicalType e : element.getInstantiatesCanonical())
        composeCanonical("instantiatesCanonical", e);
    }
    if (element.hasInstantiatesUri()) {
      for (UriType e : element.getInstantiatesUri())
        composeUri("instantiatesUri", 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 ServiceRequest.ServiceRequestStatusEnumFactory());
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory());
    if (element.hasCategory()) {
      for (CodeableConcept e : element.getCategory())
        composeCodeableConcept("category", e);
    }
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(),
          new ServiceRequest.ServiceRequestPriorityEnumFactory());
    if (element.hasDoNotPerformElement()) {
      composeBoolean("doNotPerform", element.getDoNotPerformElement());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasOrderDetail()) {
      for (CodeableConcept e : element.getOrderDetail())
        composeCodeableConcept("orderDetail", e);
    }
    if (element.hasQuantity()) {
      composeType("quantity", element.getQuantity());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }
    if (element.hasAsNeeded()) {
      composeType("asNeeded", element.getAsNeeded());
    }
    if (element.hasAuthoredOnElement()) {
      composeDateTime("authoredOn", element.getAuthoredOnElement());
    }
    if (element.hasRequester()) {
      composeReference("requester", element.getRequester());
    }
    if (element.hasPerformerType()) {
      composeCodeableConcept("performerType", element.getPerformerType());
    }
    if (element.hasPerformer()) {
      for (Reference e : element.getPerformer())
        composeReference("performer", e);
    }
    if (element.hasLocationCode()) {
      for (CodeableConcept e : element.getLocationCode())
        composeCodeableConcept("locationCode", e);
    }
    if (element.hasLocationReference()) {
      for (Reference e : element.getLocationReference())
        composeReference("locationReference", 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.hasInsurance()) {
      for (Reference e : element.getInsurance())
        composeReference("insurance", 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.hasPatientInstructionElement()) {
      composeString("patientInstruction", element.getPatientInstructionElement());
    }
    if (element.hasRelevantHistory()) {
      for (Reference e : element.getRelevantHistory())
        composeReference("relevantHistory", e);
    }
  }

  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()) {
      for (CodeableConcept e : element.getServiceCategory())
        composeCodeableConcept("serviceCategory", e);
    }
    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.hasCondition()) {
      for (CodeableConcept e : element.getCondition())
        composeCodeableConcept("condition", 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 {
    composeBackboneElementElements(element);
    if (element.hasCollector()) {
      composeReference("collector", element.getCollector());
    }
    if (element.hasCollected()) {
      composeType("collected", element.getCollected());
    }
    if (element.hasDuration()) {
      composeDuration("duration", element.getDuration());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasMethod()) {
      composeCodeableConcept("method", element.getMethod());
    }
    if (element.hasBodySite()) {
      composeCodeableConcept("bodySite", element.getBodySite());
    }
    if (element.hasFastingStatus()) {
      composeType("fastingStatus", element.getFastingStatus());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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()) {
      composeQuantity("capacity", element.getCapacity());
    }
    if (element.hasSpecimenQuantity()) {
      composeQuantity("specimenQuantity", element.getSpecimenQuantity());
    }
    if (element.hasAdditive()) {
      composeType("additive", element.getAdditive());
    }
  }

  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionElements(SpecimenDefinition element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasTypeCollected()) {
      composeCodeableConcept("typeCollected", element.getTypeCollected());
    }
    if (element.hasPatientPreparation()) {
      for (CodeableConcept e : element.getPatientPreparation())
        composeCodeableConcept("patientPreparation", e);
    }
    if (element.hasTimeAspectElement()) {
      composeString("timeAspect", element.getTimeAspectElement());
    }
    if (element.hasCollection()) {
      for (CodeableConcept e : element.getCollection())
        composeCodeableConcept("collection", e);
    }
    if (element.hasTypeTested()) {
      for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested())
        composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent("typeTested", e);
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name,
      SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentElements(
      SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIsDerivedElement()) {
      composeBoolean("isDerived", element.getIsDerivedElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasPreferenceElement())
      composeEnumeration("preference", element.getPreferenceElement(),
          new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory());
    if (element.hasContainer()) {
      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
    }
    if (element.hasRequirementElement()) {
      composeString("requirement", element.getRequirementElement());
    }
    if (element.hasRetentionTime()) {
      composeDuration("retentionTime", element.getRetentionTime());
    }
    if (element.hasRejectionCriterion()) {
      for (CodeableConcept e : element.getRejectionCriterion())
        composeCodeableConcept("rejectionCriterion", e);
    }
    if (element.hasHandling()) {
      for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling())
        composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent("handling", e);
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name,
      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentElements(
      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasMaterial()) {
      composeCodeableConcept("material", element.getMaterial());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasCap()) {
      composeCodeableConcept("cap", element.getCap());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasCapacity()) {
      composeQuantity("capacity", element.getCapacity());
    }
    if (element.hasMinimumVolume()) {
      composeType("minimumVolume", element.getMinimumVolume());
    }
    if (element.hasAdditive()) {
      for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive())
        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent("additive", e);
    }
    if (element.hasPreparationElement()) {
      composeString("preparation", element.getPreparationElement());
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name,
      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentElements(
      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAdditive()) {
      composeType("additive", element.getAdditive());
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name,
      SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentElements(
      SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTemperatureQualifier()) {
      composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
    }
    if (element.hasTemperatureRange()) {
      composeRange("temperatureRange", element.getTemperatureRange());
    }
    if (element.hasMaxDuration()) {
      composeDuration("maxDuration", element.getMaxDuration());
    }
    if (element.hasInstructionElement()) {
      composeString("instruction", element.getInstructionElement());
    }
  }

  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())
      composeEnumeration("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory());
    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.hasContext()) {
      for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext())
        composeStructureDefinitionStructureDefinitionContextComponent("context", e);
    }
    if (element.hasContextInvariant()) {
      for (StringType e : element.getContextInvariant())
        composeString("contextInvariant", e);
    }
    if (element.hasTypeElement()) {
      composeUri("type", element.getTypeElement());
    }
    if (element.hasBaseDefinitionElement()) {
      composeCanonical("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 {
    composeBackboneElementElements(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 composeStructureDefinitionStructureDefinitionContextComponent(String name,
      StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionStructureDefinitionContextComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionStructureDefinitionContextComponentElements(
      StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory());
    if (element.hasExpressionElement()) {
      composeString("expression", element.getExpressionElement());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 (CanonicalType e : element.getImport())
        composeCanonical("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 {
    composeBackboneElementElements(element);
    if (element.hasUrlElement()) {
      composeCanonical("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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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());
    }
    if (element.hasLogMessageElement()) {
      composeString("logMessage", element.getLogMessageElement());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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());
    }
  }

  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 {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory());
    if (element.hasEndpointElement()) {
      composeUrl("endpoint", element.getEndpointElement());
    }
    if (element.hasPayloadElement()) {
      composeCode("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 {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasExpiryElement()) {
      composeDateTime("expiry", element.getExpiryElement());
    }
    if (element.hasQuantity()) {
      composeQuantity("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 {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeRatio("quantity", element.getQuantity());
    }
    if (element.hasSubstance()) {
      composeType("substance", element.getSubstance());
    }
  }

  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceNucleicAcidElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceNucleicAcidElements(SubstanceNucleicAcid element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasSequenceType()) {
      composeCodeableConcept("sequenceType", element.getSequenceType());
    }
    if (element.hasNumberOfSubunitsElement()) {
      composeInteger("numberOfSubunits", element.getNumberOfSubunitsElement());
    }
    if (element.hasAreaOfHybridisationElement()) {
      composeString("areaOfHybridisation", element.getAreaOfHybridisationElement());
    }
    if (element.hasOligoNucleotideType()) {
      composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
    }
    if (element.hasSubunit()) {
      for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit())
        composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent("subunit", e);
    }
  }

  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(String name,
      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentElements(
      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSubunitElement()) {
      composeInteger("subunit", element.getSubunitElement());
    }
    if (element.hasSequenceElement()) {
      composeString("sequence", element.getSequenceElement());
    }
    if (element.hasLengthElement()) {
      composeInteger("length", element.getLengthElement());
    }
    if (element.hasSequenceAttachment()) {
      composeAttachment("sequenceAttachment", element.getSequenceAttachment());
    }
    if (element.hasFivePrime()) {
      composeCodeableConcept("fivePrime", element.getFivePrime());
    }
    if (element.hasThreePrime()) {
      composeCodeableConcept("threePrime", element.getThreePrime());
    }
    if (element.hasLinkage()) {
      for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage())
        composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent("linkage", e);
    }
    if (element.hasSugar()) {
      for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar())
        composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent("sugar", e);
    }
  }

  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(String name,
      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentElements(
      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasConnectivityElement()) {
      composeString("connectivity", element.getConnectivityElement());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasResidueSiteElement()) {
      composeString("residueSite", element.getResidueSiteElement());
    }
  }

  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(String name,
      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentElements(
      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasResidueSiteElement()) {
      composeString("residueSite", element.getResidueSiteElement());
    }
  }

  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerElements(SubstancePolymer element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasClass_()) {
      composeCodeableConcept("class", element.getClass_());
    }
    if (element.hasGeometry()) {
      composeCodeableConcept("geometry", element.getGeometry());
    }
    if (element.hasCopolymerConnectivity()) {
      for (CodeableConcept e : element.getCopolymerConnectivity())
        composeCodeableConcept("copolymerConnectivity", e);
    }
    if (element.hasModification()) {
      for (StringType e : element.getModification())
        composeString("modification", e);
    }
    if (element.hasMonomerSet()) {
      for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet())
        composeSubstancePolymerSubstancePolymerMonomerSetComponent("monomerSet", e);
    }
    if (element.hasRepeat()) {
      for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat())
        composeSubstancePolymerSubstancePolymerRepeatComponent("repeat", e);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name,
      SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerSubstancePolymerMonomerSetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentElements(
      SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRatioType()) {
      composeCodeableConcept("ratioType", element.getRatioType());
    }
    if (element.hasStartingMaterial()) {
      for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial())
        composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent("startingMaterial", e);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name,
      SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentElements(
      SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasMaterial()) {
      composeCodeableConcept("material", element.getMaterial());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasIsDefiningElement()) {
      composeBoolean("isDefining", element.getIsDefiningElement());
    }
    if (element.hasAmount()) {
      composeSubstanceAmount("amount", element.getAmount());
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name,
      SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerSubstancePolymerRepeatComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatComponentElements(
      SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNumberOfUnitsElement()) {
      composeInteger("numberOfUnits", element.getNumberOfUnitsElement());
    }
    if (element.hasAverageMolecularFormulaElement()) {
      composeString("averageMolecularFormula", element.getAverageMolecularFormulaElement());
    }
    if (element.hasRepeatUnitAmountType()) {
      composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
    }
    if (element.hasRepeatUnit()) {
      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit())
        composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent("repeatUnit", e);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name,
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentElements(
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasOrientationOfPolymerisation()) {
      composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
    }
    if (element.hasRepeatUnitElement()) {
      composeString("repeatUnit", element.getRepeatUnitElement());
    }
    if (element.hasAmount()) {
      composeSubstanceAmount("amount", element.getAmount());
    }
    if (element.hasDegreeOfPolymerisation()) {
      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element
          .getDegreeOfPolymerisation())
        composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent("degreeOfPolymerisation",
            e);
    }
    if (element.hasStructuralRepresentation()) {
      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element
          .getStructuralRepresentation())
        composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(
            "structuralRepresentation", e);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name,
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentElements(
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDegree()) {
      composeCodeableConcept("degree", element.getDegree());
    }
    if (element.hasAmount()) {
      composeSubstanceAmount("amount", element.getAmount());
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name,
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentElements(
      SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRepresentationElement()) {
      composeString("representation", element.getRepresentationElement());
    }
    if (element.hasAttachment()) {
      composeAttachment("attachment", element.getAttachment());
    }
  }

  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceProteinElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceProteinElements(SubstanceProtein element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasSequenceType()) {
      composeCodeableConcept("sequenceType", element.getSequenceType());
    }
    if (element.hasNumberOfSubunitsElement()) {
      composeInteger("numberOfSubunits", element.getNumberOfSubunitsElement());
    }
    if (element.hasDisulfideLinkage()) {
      for (StringType e : element.getDisulfideLinkage())
        composeString("disulfideLinkage", e);
    }
    if (element.hasSubunit()) {
      for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit())
        composeSubstanceProteinSubstanceProteinSubunitComponent("subunit", e);
    }
  }

  protected void composeSubstanceProteinSubstanceProteinSubunitComponent(String name,
      SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceProteinSubstanceProteinSubunitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceProteinSubstanceProteinSubunitComponentElements(
      SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSubunitElement()) {
      composeInteger("subunit", element.getSubunitElement());
    }
    if (element.hasSequenceElement()) {
      composeString("sequence", element.getSequenceElement());
    }
    if (element.hasLengthElement()) {
      composeInteger("length", element.getLengthElement());
    }
    if (element.hasSequenceAttachment()) {
      composeAttachment("sequenceAttachment", element.getSequenceAttachment());
    }
    if (element.hasNTerminalModificationId()) {
      composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
    }
    if (element.hasNTerminalModificationElement()) {
      composeString("nTerminalModification", element.getNTerminalModificationElement());
    }
    if (element.hasCTerminalModificationId()) {
      composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
    }
    if (element.hasCTerminalModificationElement()) {
      composeString("cTerminalModification", element.getCTerminalModificationElement());
    }
  }

  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element)
      throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationElements(SubstanceReferenceInformation element)
      throws IOException {
    composeDomainResourceElements(element);
    if (element.hasCommentElement()) {
      composeString("comment", element.getCommentElement());
    }
    if (element.hasGene()) {
      for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene())
        composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent("gene", e);
    }
    if (element.hasGeneElement()) {
      for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement())
        composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent("geneElement", e);
    }
    if (element.hasClassification()) {
      for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element
          .getClassification())
        composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent("classification", e);
    }
    if (element.hasTarget()) {
      for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget())
        composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent("target", e);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name,
      SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentElements(
      SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasGeneSequenceOrigin()) {
      composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
    }
    if (element.hasGene()) {
      composeCodeableConcept("gene", element.getGene());
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name,
      SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentElements(
      SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasElement()) {
      composeIdentifier("element", element.getElement());
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name,
      SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentElements(
      SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDomain()) {
      composeCodeableConcept("domain", element.getDomain());
    }
    if (element.hasClassification()) {
      composeCodeableConcept("classification", element.getClassification());
    }
    if (element.hasSubtype()) {
      for (CodeableConcept e : element.getSubtype())
        composeCodeableConcept("subtype", e);
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name,
      SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentElements(
      SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTarget()) {
      composeIdentifier("target", element.getTarget());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasInteraction()) {
      composeCodeableConcept("interaction", element.getInteraction());
    }
    if (element.hasOrganism()) {
      composeCodeableConcept("organism", element.getOrganism());
    }
    if (element.hasOrganismType()) {
      composeCodeableConcept("organismType", element.getOrganismType());
    }
    if (element.hasAmount()) {
      composeType("amount", element.getAmount());
    }
    if (element.hasAmountType()) {
      composeCodeableConcept("amountType", element.getAmountType());
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
  }

  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialElements(SubstanceSourceMaterial element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasSourceMaterialClass()) {
      composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
    }
    if (element.hasSourceMaterialType()) {
      composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
    }
    if (element.hasSourceMaterialState()) {
      composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
    }
    if (element.hasOrganismId()) {
      composeIdentifier("organismId", element.getOrganismId());
    }
    if (element.hasOrganismNameElement()) {
      composeString("organismName", element.getOrganismNameElement());
    }
    if (element.hasParentSubstanceId()) {
      for (Identifier e : element.getParentSubstanceId())
        composeIdentifier("parentSubstanceId", e);
    }
    if (element.hasParentSubstanceName()) {
      for (StringType e : element.getParentSubstanceName())
        composeString("parentSubstanceName", e);
    }
    if (element.hasCountryOfOrigin()) {
      for (CodeableConcept e : element.getCountryOfOrigin())
        composeCodeableConcept("countryOfOrigin", e);
    }
    if (element.hasGeographicalLocation()) {
      for (StringType e : element.getGeographicalLocation())
        composeString("geographicalLocation", e);
    }
    if (element.hasDevelopmentStage()) {
      composeCodeableConcept("developmentStage", element.getDevelopmentStage());
    }
    if (element.hasFractionDescription()) {
      for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element
          .getFractionDescription())
        composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent("fractionDescription", e);
    }
    if (element.hasOrganism()) {
      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
    }
    if (element.hasPartDescription()) {
      for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription())
        composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent("partDescription", e);
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(String name,
      SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentElements(
      SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFractionElement()) {
      composeString("fraction", element.getFractionElement());
    }
    if (element.hasMaterialType()) {
      composeCodeableConcept("materialType", element.getMaterialType());
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(String name,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentElements(
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFamily()) {
      composeCodeableConcept("family", element.getFamily());
    }
    if (element.hasGenus()) {
      composeCodeableConcept("genus", element.getGenus());
    }
    if (element.hasSpecies()) {
      composeCodeableConcept("species", element.getSpecies());
    }
    if (element.hasIntraspecificType()) {
      composeCodeableConcept("intraspecificType", element.getIntraspecificType());
    }
    if (element.hasIntraspecificDescriptionElement()) {
      composeString("intraspecificDescription", element.getIntraspecificDescriptionElement());
    }
    if (element.hasAuthor()) {
      for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor())
        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent("author", e);
    }
    if (element.hasHybrid()) {
      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
    }
    if (element.hasOrganismGeneral()) {
      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral",
          element.getOrganismGeneral());
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(String name,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentElements(
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAuthorType()) {
      composeCodeableConcept("authorType", element.getAuthorType());
    }
    if (element.hasAuthorDescriptionElement()) {
      composeString("authorDescription", element.getAuthorDescriptionElement());
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(String name,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentElements(
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasMaternalOrganismIdElement()) {
      composeString("maternalOrganismId", element.getMaternalOrganismIdElement());
    }
    if (element.hasMaternalOrganismNameElement()) {
      composeString("maternalOrganismName", element.getMaternalOrganismNameElement());
    }
    if (element.hasPaternalOrganismIdElement()) {
      composeString("paternalOrganismId", element.getPaternalOrganismIdElement());
    }
    if (element.hasPaternalOrganismNameElement()) {
      composeString("paternalOrganismName", element.getPaternalOrganismNameElement());
    }
    if (element.hasHybridType()) {
      composeCodeableConcept("hybridType", element.getHybridType());
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name,
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentElements(
      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasKingdom()) {
      composeCodeableConcept("kingdom", element.getKingdom());
    }
    if (element.hasPhylum()) {
      composeCodeableConcept("phylum", element.getPhylum());
    }
    if (element.hasClass_()) {
      composeCodeableConcept("class", element.getClass_());
    }
    if (element.hasOrder()) {
      composeCodeableConcept("order", element.getOrder());
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(String name,
      SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentElements(
      SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPart()) {
      composeCodeableConcept("part", element.getPart());
    }
    if (element.hasPartLocation()) {
      composeCodeableConcept("partLocation", element.getPartLocation());
    }
  }

  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationElements(SubstanceSpecification element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasDomain()) {
      composeCodeableConcept("domain", element.getDomain());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
    if (element.hasCommentElement()) {
      composeString("comment", element.getCommentElement());
    }
    if (element.hasMoiety()) {
      for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety())
        composeSubstanceSpecificationSubstanceSpecificationMoietyComponent("moiety", e);
    }
    if (element.hasProperty()) {
      for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty())
        composeSubstanceSpecificationSubstanceSpecificationPropertyComponent("property", e);
    }
    if (element.hasReferenceInformation()) {
      composeReference("referenceInformation", element.getReferenceInformation());
    }
    if (element.hasStructure()) {
      composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
    }
    if (element.hasCode()) {
      for (SubstanceSpecification.SubstanceSpecificationCodeComponent e : element.getCode())
        composeSubstanceSpecificationSubstanceSpecificationCodeComponent("code", e);
    }
    if (element.hasName()) {
      for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getName())
        composeSubstanceSpecificationSubstanceSpecificationNameComponent("name", e);
    }
    if (element.hasMolecularWeight()) {
      for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element
          .getMolecularWeight())
        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight",
            e);
    }
    if (element.hasRelationship()) {
      for (SubstanceSpecification.SubstanceSpecificationRelationshipComponent e : element.getRelationship())
        composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent("relationship", e);
    }
    if (element.hasNucleicAcid()) {
      composeReference("nucleicAcid", element.getNucleicAcid());
    }
    if (element.hasPolymer()) {
      composeReference("polymer", element.getPolymer());
    }
    if (element.hasProtein()) {
      composeReference("protein", element.getProtein());
    }
    if (element.hasSourceMaterial()) {
      composeReference("sourceMaterial", element.getSourceMaterial());
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name,
      SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentElements(
      SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasStereochemistry()) {
      composeCodeableConcept("stereochemistry", element.getStereochemistry());
    }
    if (element.hasOpticalActivity()) {
      composeCodeableConcept("opticalActivity", element.getOpticalActivity());
    }
    if (element.hasMolecularFormulaElement()) {
      composeString("molecularFormula", element.getMolecularFormulaElement());
    }
    if (element.hasAmount()) {
      composeType("amount", element.getAmount());
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name,
      SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentElements(
      SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasParametersElement()) {
      composeString("parameters", element.getParametersElement());
    }
    if (element.hasDefiningSubstance()) {
      composeType("definingSubstance", element.getDefiningSubstance());
    }
    if (element.hasAmount()) {
      composeType("amount", element.getAmount());
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name,
      SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationStructureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentElements(
      SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasStereochemistry()) {
      composeCodeableConcept("stereochemistry", element.getStereochemistry());
    }
    if (element.hasOpticalActivity()) {
      composeCodeableConcept("opticalActivity", element.getOpticalActivity());
    }
    if (element.hasMolecularFormulaElement()) {
      composeString("molecularFormula", element.getMolecularFormulaElement());
    }
    if (element.hasMolecularFormulaByMoietyElement()) {
      composeString("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement());
    }
    if (element.hasIsotope()) {
      for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope())
        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent("isotope", e);
    }
    if (element.hasMolecularWeight()) {
      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight",
          element.getMolecularWeight());
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
    if (element.hasRepresentation()) {
      for (SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent e : element
          .getRepresentation())
        composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent("representation", e);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name,
      SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentElements(
      SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasName()) {
      composeCodeableConcept("name", element.getName());
    }
    if (element.hasSubstitution()) {
      composeCodeableConcept("substitution", element.getSubstitution());
    }
    if (element.hasHalfLife()) {
      composeQuantity("halfLife", element.getHalfLife());
    }
    if (element.hasMolecularWeight()) {
      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight",
          element.getMolecularWeight());
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(
      String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentElements(
      SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasMethod()) {
      composeCodeableConcept("method", element.getMethod());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasAmount()) {
      composeQuantity("amount", element.getAmount());
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(String name,
      SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentElements(
      SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRepresentationElement()) {
      composeString("representation", element.getRepresentationElement());
    }
    if (element.hasAttachment()) {
      composeAttachment("attachment", element.getAttachment());
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponent(String name,
      SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationCodeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponentElements(
      SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasStatusDateElement()) {
      composeDateTime("statusDate", element.getStatusDateElement());
    }
    if (element.hasCommentElement()) {
      composeString("comment", element.getCommentElement());
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponent(String name,
      SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponentElements(
      SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasPreferredElement()) {
      composeBoolean("preferred", element.getPreferredElement());
    }
    if (element.hasLanguage()) {
      for (CodeableConcept e : element.getLanguage())
        composeCodeableConcept("language", e);
    }
    if (element.hasDomain()) {
      for (CodeableConcept e : element.getDomain())
        composeCodeableConcept("domain", e);
    }
    if (element.hasJurisdiction()) {
      for (CodeableConcept e : element.getJurisdiction())
        composeCodeableConcept("jurisdiction", e);
    }
    if (element.hasSynonym()) {
      for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getSynonym())
        composeSubstanceSpecificationSubstanceSpecificationNameComponent("synonym", e);
    }
    if (element.hasTranslation()) {
      for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getTranslation())
        composeSubstanceSpecificationSubstanceSpecificationNameComponent("translation", e);
    }
    if (element.hasOfficial()) {
      for (SubstanceSpecification.SubstanceSpecificationNameOfficialComponent e : element.getOfficial())
        composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent("official", e);
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(String name,
      SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentElements(
      SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAuthority()) {
      composeCodeableConcept("authority", element.getAuthority());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(String name,
      SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentElements(
      SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSubstance()) {
      composeType("substance", element.getSubstance());
    }
    if (element.hasRelationship()) {
      composeCodeableConcept("relationship", element.getRelationship());
    }
    if (element.hasIsDefiningElement()) {
      composeBoolean("isDefining", element.getIsDefiningElement());
    }
    if (element.hasAmount()) {
      composeType("amount", element.getAmount());
    }
    if (element.hasAmountRatioLowLimit()) {
      composeRatio("amountRatioLowLimit", element.getAmountRatioLowLimit());
    }
    if (element.hasAmountType()) {
      composeCodeableConcept("amountType", element.getAmountType());
    }
    if (element.hasSource()) {
      for (Reference e : element.getSource())
        composeReference("source", e);
    }
  }

  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()) {
      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.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 {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeQuantity("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()) {
      for (Identifier e : element.getIdentifier())
        composeIdentifier("identifier", e);
    }
    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.hasItem()) {
      composeType("item", element.getItem());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasParameter()) {
      for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter())
        composeSupplyRequestSupplyRequestParameterComponent("parameter", e);
    }
    if (element.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }
    if (element.hasAuthoredOnElement()) {
      composeDateTime("authoredOn", element.getAuthoredOnElement());
    }
    if (element.hasRequester()) {
      composeReference("requester", element.getRequester());
    }
    if (element.hasSupplier()) {
      for (Reference e : element.getSupplier())
        composeReference("supplier", 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.hasDeliverFrom()) {
      composeReference("deliverFrom", element.getDeliverFrom());
    }
    if (element.hasDeliverTo()) {
      composeReference("deliverTo", element.getDeliverTo());
    }
  }

  protected void composeSupplyRequestSupplyRequestParameterComponent(String name,
      SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyRequestSupplyRequestParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyRequestSupplyRequestParameterComponentElements(
      SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
  }

  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.hasInstantiatesCanonicalElement()) {
      composeCanonical("instantiatesCanonical", element.getInstantiatesCanonicalElement());
    }
    if (element.hasInstantiatesUriElement()) {
      composeUri("instantiatesUri", element.getInstantiatesUriElement());
    }
    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.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    if (element.hasExecutionPeriod()) {
      composePeriod("executionPeriod", element.getExecutionPeriod());
    }
    if (element.hasAuthoredOnElement()) {
      composeDateTime("authoredOn", element.getAuthoredOnElement());
    }
    if (element.hasLastModifiedElement()) {
      composeDateTime("lastModified", element.getLastModifiedElement());
    }
    if (element.hasRequester()) {
      composeReference("requester", element.getRequester());
    }
    if (element.hasPerformerType()) {
      for (CodeableConcept e : element.getPerformerType())
        composeCodeableConcept("performerType", e);
    }
    if (element.hasOwner()) {
      composeReference("owner", element.getOwner());
    }
    if (element.hasLocation()) {
      composeReference("location", element.getLocation());
    }
    if (element.hasReasonCode()) {
      composeCodeableConcept("reasonCode", element.getReasonCode());
    }
    if (element.hasReasonReference()) {
      composeReference("reasonReference", element.getReasonReference());
    }
    if (element.hasInsurance()) {
      for (Reference e : element.getInsurance())
        composeReference("insurance", e);
    }
    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 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }
  }

  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesElements(TerminologyCapabilities 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 TerminologyCapabilities.CapabilityStatementKindEnumFactory());
    if (element.hasSoftware()) {
      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
    }
    if (element.hasImplementation()) {
      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation",
          element.getImplementation());
    }
    if (element.hasLockedDateElement()) {
      composeBoolean("lockedDate", element.getLockedDateElement());
    }
    if (element.hasCodeSystem()) {
      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem())
        composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent("codeSystem", e);
    }
    if (element.hasExpansion()) {
      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
    }
    if (element.hasCodeSearchElement())
      composeEnumeration("codeSearch", element.getCodeSearchElement(),
          new TerminologyCapabilities.CodeSearchSupportEnumFactory());
    if (element.hasValidateCode()) {
      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode",
          element.getValidateCode());
    }
    if (element.hasTranslation()) {
      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation",
          element.getTranslation());
    }
    if (element.hasClosure()) {
      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasUrlElement()) {
      composeUrl("url", element.getUrlElement());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasUriElement()) {
      composeCanonical("uri", element.getUriElement());
    }
    if (element.hasVersion()) {
      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion())
        composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent("version", e);
    }
    if (element.hasSubsumptionElement()) {
      composeBoolean("subsumption", element.getSubsumptionElement());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement()) {
      composeString("code", element.getCodeElement());
    }
    if (element.hasIsDefaultElement()) {
      composeBoolean("isDefault", element.getIsDefaultElement());
    }
    if (element.hasCompositionalElement()) {
      composeBoolean("compositional", element.getCompositionalElement());
    }
    if (element.hasLanguage()) {
      for (CodeType e : element.getLanguage())
        composeCode("language", e);
    }
    if (element.hasFilter()) {
      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter())
        composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent("filter", e);
    }
    if (element.hasProperty()) {
      for (CodeType e : element.getProperty())
        composeCode("property", e);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement()) {
      composeCode("code", element.getCodeElement());
    }
    if (element.hasOp()) {
      for (CodeType e : element.getOp())
        composeCode("op", e);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasHierarchicalElement()) {
      composeBoolean("hierarchical", element.getHierarchicalElement());
    }
    if (element.hasPagingElement()) {
      composeBoolean("paging", element.getPagingElement());
    }
    if (element.hasIncompleteElement()) {
      composeBoolean("incomplete", element.getIncompleteElement());
    }
    if (element.hasParameter()) {
      for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter())
        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent("parameter", e);
    }
    if (element.hasTextFilterElement()) {
      composeMarkdown("textFilter", element.getTextFilterElement());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeCode("name", element.getNameElement());
    }
    if (element.hasDocumentationElement()) {
      composeString("documentation", element.getDocumentationElement());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTranslationsElement()) {
      composeBoolean("translations", element.getTranslationsElement());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNeedsMapElement()) {
      composeBoolean("needsMap", element.getNeedsMapElement());
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name,
      TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentElements(
      TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTranslationElement()) {
      composeBoolean("translation", element.getTranslationElement());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.hasCapabilitiesElement()) {
      composeCanonical("capabilities", element.getCapabilitiesElement());
    }
  }

  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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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()) {
      composeCode("accept", element.getAcceptElement());
    }
    if (element.hasContentTypeElement()) {
      composeCode("contentType", element.getContentTypeElement());
    }
    if (element.hasDestinationElement()) {
      composeInteger("destination", element.getDestinationElement());
    }
    if (element.hasEncodeRequestUrlElement()) {
      composeBoolean("encodeRequestUrl", element.getEncodeRequestUrlElement());
    }
    if (element.hasMethodElement())
      composeEnumeration("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory());
    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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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()) {
      composeCode("contentType", element.getContentTypeElement());
    }
    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.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 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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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.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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 (CanonicalType e : element.getValueSet())
        composeCanonical("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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(element);
    if (element.hasPropertyElement()) {
      composeCode("property", element.getPropertyElement());
    }
    if (element.hasOpElement())
      composeEnumeration("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory());
    if (element.hasValueElement()) {
      composeString("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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 {
    composeBackboneElementElements(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 composeVerificationResult(String name, VerificationResult element) throws IOException {
    if (element != null) {
      composeDomainResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVerificationResultElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVerificationResultElements(VerificationResult element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasTarget()) {
      for (Reference e : element.getTarget())
        composeReference("target", e);
    }
    if (element.hasTargetLocation()) {
      for (StringType e : element.getTargetLocation())
        composeString("targetLocation", e);
    }
    if (element.hasNeed()) {
      composeCodeableConcept("need", element.getNeed());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory());
    if (element.hasStatusDateElement()) {
      composeDateTime("statusDate", element.getStatusDateElement());
    }
    if (element.hasValidationType()) {
      composeCodeableConcept("validationType", element.getValidationType());
    }
    if (element.hasValidationProcess()) {
      for (CodeableConcept e : element.getValidationProcess())
        composeCodeableConcept("validationProcess", e);
    }
    if (element.hasFrequency()) {
      composeTiming("frequency", element.getFrequency());
    }
    if (element.hasLastPerformedElement()) {
      composeDateTime("lastPerformed", element.getLastPerformedElement());
    }
    if (element.hasNextScheduledElement()) {
      composeDate("nextScheduled", element.getNextScheduledElement());
    }
    if (element.hasFailureAction()) {
      composeCodeableConcept("failureAction", element.getFailureAction());
    }
    if (element.hasPrimarySource()) {
      for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource())
        composeVerificationResultVerificationResultPrimarySourceComponent("primarySource", e);
    }
    if (element.hasAttestation()) {
      composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
    }
    if (element.hasValidator()) {
      for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator())
        composeVerificationResultVerificationResultValidatorComponent("validator", e);
    }
  }

  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name,
      VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVerificationResultVerificationResultPrimarySourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVerificationResultVerificationResultPrimarySourceComponentElements(
      VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasWho()) {
      composeReference("who", element.getWho());
    }
    if (element.hasType()) {
      for (CodeableConcept e : element.getType())
        composeCodeableConcept("type", e);
    }
    if (element.hasCommunicationMethod()) {
      for (CodeableConcept e : element.getCommunicationMethod())
        composeCodeableConcept("communicationMethod", e);
    }
    if (element.hasValidationStatus()) {
      composeCodeableConcept("validationStatus", element.getValidationStatus());
    }
    if (element.hasValidationDateElement()) {
      composeDateTime("validationDate", element.getValidationDateElement());
    }
    if (element.hasCanPushUpdates()) {
      composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
    }
    if (element.hasPushTypeAvailable()) {
      for (CodeableConcept e : element.getPushTypeAvailable())
        composeCodeableConcept("pushTypeAvailable", e);
    }
  }

  protected void composeVerificationResultVerificationResultAttestationComponent(String name,
      VerificationResult.VerificationResultAttestationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVerificationResultVerificationResultAttestationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVerificationResultVerificationResultAttestationComponentElements(
      VerificationResult.VerificationResultAttestationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasWho()) {
      composeReference("who", element.getWho());
    }
    if (element.hasOnBehalfOf()) {
      composeReference("onBehalfOf", element.getOnBehalfOf());
    }
    if (element.hasCommunicationMethod()) {
      composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
    }
    if (element.hasDateElement()) {
      composeDate("date", element.getDateElement());
    }
    if (element.hasSourceIdentityCertificateElement()) {
      composeString("sourceIdentityCertificate", element.getSourceIdentityCertificateElement());
    }
    if (element.hasProxyIdentityCertificateElement()) {
      composeString("proxyIdentityCertificate", element.getProxyIdentityCertificateElement());
    }
    if (element.hasProxySignature()) {
      composeSignature("proxySignature", element.getProxySignature());
    }
    if (element.hasSourceSignature()) {
      composeSignature("sourceSignature", element.getSourceSignature());
    }
  }

  protected void composeVerificationResultVerificationResultValidatorComponent(String name,
      VerificationResult.VerificationResultValidatorComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVerificationResultVerificationResultValidatorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVerificationResultVerificationResultValidatorComponentElements(
      VerificationResult.VerificationResultValidatorComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasOrganization()) {
      composeReference("organization", element.getOrganization());
    }
    if (element.hasIdentityCertificateElement()) {
      composeString("identityCertificate", element.getIdentityCertificateElement());
    }
    if (element.hasAttestationSignature()) {
      composeSignature("attestationSignature", element.getAttestationSignature());
    }
  }

  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.hasCreatedElement()) {
      composeDateTime("created", element.getCreatedElement());
    }
    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.hasLensSpecification()) {
      for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification())
        composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent("lensSpecification", e);
    }
  }

  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(String name,
      VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentElements(
      VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
    composeBackboneElementElements(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.hasPrism()) {
      for (VisionPrescription.PrismComponent e : element.getPrism())
        composeVisionPrescriptionPrismComponent("prism", e);
    }
    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()) {
      composeQuantity("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);
    }
  }

  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element)
      throws IOException {
    if (element != null) {
      composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVisionPrescriptionPrismComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVisionPrescriptionPrismComponentElements(VisionPrescription.PrismComponent element)
      throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAmountElement()) {
      composeDecimal("amount", element.getAmountElement());
    }
    if (element.hasBaseElement())
      composeEnumeration("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory());
  }

  @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 BiologicallyDerivedProduct)
      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct) resource);
    else if (resource instanceof BodyStructure)
      composeBodyStructure("BodyStructure", (BodyStructure) 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 CatalogEntry)
      composeCatalogEntry("CatalogEntry", (CatalogEntry) resource);
    else if (resource instanceof ChargeItem)
      composeChargeItem("ChargeItem", (ChargeItem) resource);
    else if (resource instanceof ChargeItemDefinition)
      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition) 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 CoverageEligibilityRequest)
      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest) resource);
    else if (resource instanceof CoverageEligibilityResponse)
      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse) resource);
    else if (resource instanceof DetectedIssue)
      composeDetectedIssue("DetectedIssue", (DetectedIssue) resource);
    else if (resource instanceof Device)
      composeDevice("Device", (Device) resource);
    else if (resource instanceof DeviceDefinition)
      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition) 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 EffectEvidenceSynthesis)
      composeEffectEvidenceSynthesis("EffectEvidenceSynthesis", (EffectEvidenceSynthesis) 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 EventDefinition)
      composeEventDefinition("EventDefinition", (EventDefinition) resource);
    else if (resource instanceof Evidence)
      composeEvidence("Evidence", (Evidence) resource);
    else if (resource instanceof EvidenceVariable)
      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable) resource);
    else if (resource instanceof ExampleScenario)
      composeExampleScenario("ExampleScenario", (ExampleScenario) 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 ImagingStudy)
      composeImagingStudy("ImagingStudy", (ImagingStudy) resource);
    else if (resource instanceof Immunization)
      composeImmunization("Immunization", (Immunization) resource);
    else if (resource instanceof ImmunizationEvaluation)
      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation) resource);
    else if (resource instanceof ImmunizationRecommendation)
      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation) resource);
    else if (resource instanceof ImplementationGuide)
      composeImplementationGuide("ImplementationGuide", (ImplementationGuide) resource);
    else if (resource instanceof InsurancePlan)
      composeInsurancePlan("InsurancePlan", (InsurancePlan) resource);
    else if (resource instanceof Invoice)
      composeInvoice("Invoice", (Invoice) 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 MedicationKnowledge)
      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge) resource);
    else if (resource instanceof MedicationRequest)
      composeMedicationRequest("MedicationRequest", (MedicationRequest) resource);
    else if (resource instanceof MedicationStatement)
      composeMedicationStatement("MedicationStatement", (MedicationStatement) resource);
    else if (resource instanceof MedicinalProduct)
      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct) resource);
    else if (resource instanceof MedicinalProductAuthorization)
      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization) resource);
    else if (resource instanceof MedicinalProductContraindication)
      composeMedicinalProductContraindication("MedicinalProductContraindication",
          (MedicinalProductContraindication) resource);
    else if (resource instanceof MedicinalProductIndication)
      composeMedicinalProductIndication("MedicinalProductIndication", (MedicinalProductIndication) resource);
    else if (resource instanceof MedicinalProductIngredient)
      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient) resource);
    else if (resource instanceof MedicinalProductInteraction)
      composeMedicinalProductInteraction("MedicinalProductInteraction", (MedicinalProductInteraction) resource);
    else if (resource instanceof MedicinalProductManufactured)
      composeMedicinalProductManufactured("MedicinalProductManufactured", (MedicinalProductManufactured) resource);
    else if (resource instanceof MedicinalProductPackaged)
      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged) resource);
    else if (resource instanceof MedicinalProductPharmaceutical)
      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical",
          (MedicinalProductPharmaceutical) resource);
    else if (resource instanceof MedicinalProductUndesirableEffect)
      composeMedicinalProductUndesirableEffect("MedicinalProductUndesirableEffect",
          (MedicinalProductUndesirableEffect) resource);
    else if (resource instanceof MessageDefinition)
      composeMessageDefinition("MessageDefinition", (MessageDefinition) resource);
    else if (resource instanceof MessageHeader)
      composeMessageHeader("MessageHeader", (MessageHeader) resource);
    else if (resource instanceof MolecularSequence)
      composeMolecularSequence("MolecularSequence", (MolecularSequence) 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 ObservationDefinition)
      composeObservationDefinition("ObservationDefinition", (ObservationDefinition) 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 OrganizationAffiliation)
      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation) 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 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 RelatedPerson)
      composeRelatedPerson("RelatedPerson", (RelatedPerson) resource);
    else if (resource instanceof RequestGroup)
      composeRequestGroup("RequestGroup", (RequestGroup) resource);
    else if (resource instanceof ResearchDefinition)
      composeResearchDefinition("ResearchDefinition", (ResearchDefinition) resource);
    else if (resource instanceof ResearchElementDefinition)
      composeResearchElementDefinition("ResearchElementDefinition", (ResearchElementDefinition) 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 RiskEvidenceSynthesis)
      composeRiskEvidenceSynthesis("RiskEvidenceSynthesis", (RiskEvidenceSynthesis) resource);
    else if (resource instanceof Schedule)
      composeSchedule("Schedule", (Schedule) resource);
    else if (resource instanceof SearchParameter)
      composeSearchParameter("SearchParameter", (SearchParameter) resource);
    else if (resource instanceof ServiceRequest)
      composeServiceRequest("ServiceRequest", (ServiceRequest) resource);
    else if (resource instanceof Slot)
      composeSlot("Slot", (Slot) resource);
    else if (resource instanceof Specimen)
      composeSpecimen("Specimen", (Specimen) resource);
    else if (resource instanceof SpecimenDefinition)
      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition) 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 SubstanceNucleicAcid)
      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid) resource);
    else if (resource instanceof SubstancePolymer)
      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer) resource);
    else if (resource instanceof SubstanceProtein)
      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein) resource);
    else if (resource instanceof SubstanceReferenceInformation)
      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation) resource);
    else if (resource instanceof SubstanceSourceMaterial)
      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial) resource);
    else if (resource instanceof SubstanceSpecification)
      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification) 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 TerminologyCapabilities)
      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities) 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 VerificationResult)
      composeVerificationResult("VerificationResult", (VerificationResult) 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 BiologicallyDerivedProduct)
      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct) resource);
    else if (resource instanceof BodyStructure)
      composeBodyStructure(name, (BodyStructure) 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 CatalogEntry)
      composeCatalogEntry(name, (CatalogEntry) resource);
    else if (resource instanceof ChargeItem)
      composeChargeItem(name, (ChargeItem) resource);
    else if (resource instanceof ChargeItemDefinition)
      composeChargeItemDefinition(name, (ChargeItemDefinition) 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 CoverageEligibilityRequest)
      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest) resource);
    else if (resource instanceof CoverageEligibilityResponse)
      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse) resource);
    else if (resource instanceof DetectedIssue)
      composeDetectedIssue(name, (DetectedIssue) resource);
    else if (resource instanceof Device)
      composeDevice(name, (Device) resource);
    else if (resource instanceof DeviceDefinition)
      composeDeviceDefinition(name, (DeviceDefinition) 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 EffectEvidenceSynthesis)
      composeEffectEvidenceSynthesis(name, (EffectEvidenceSynthesis) 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 EventDefinition)
      composeEventDefinition(name, (EventDefinition) resource);
    else if (resource instanceof Evidence)
      composeEvidence(name, (Evidence) resource);
    else if (resource instanceof EvidenceVariable)
      composeEvidenceVariable(name, (EvidenceVariable) resource);
    else if (resource instanceof ExampleScenario)
      composeExampleScenario(name, (ExampleScenario) 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 ImagingStudy)
      composeImagingStudy(name, (ImagingStudy) resource);
    else if (resource instanceof Immunization)
      composeImmunization(name, (Immunization) resource);
    else if (resource instanceof ImmunizationEvaluation)
      composeImmunizationEvaluation(name, (ImmunizationEvaluation) resource);
    else if (resource instanceof ImmunizationRecommendation)
      composeImmunizationRecommendation(name, (ImmunizationRecommendation) resource);
    else if (resource instanceof ImplementationGuide)
      composeImplementationGuide(name, (ImplementationGuide) resource);
    else if (resource instanceof InsurancePlan)
      composeInsurancePlan(name, (InsurancePlan) resource);
    else if (resource instanceof Invoice)
      composeInvoice(name, (Invoice) 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 MedicationKnowledge)
      composeMedicationKnowledge(name, (MedicationKnowledge) resource);
    else if (resource instanceof MedicationRequest)
      composeMedicationRequest(name, (MedicationRequest) resource);
    else if (resource instanceof MedicationStatement)
      composeMedicationStatement(name, (MedicationStatement) resource);
    else if (resource instanceof MedicinalProduct)
      composeMedicinalProduct(name, (MedicinalProduct) resource);
    else if (resource instanceof MedicinalProductAuthorization)
      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization) resource);
    else if (resource instanceof MedicinalProductContraindication)
      composeMedicinalProductContraindication(name, (MedicinalProductContraindication) resource);
    else if (resource instanceof MedicinalProductIndication)
      composeMedicinalProductIndication(name, (MedicinalProductIndication) resource);
    else if (resource instanceof MedicinalProductIngredient)
      composeMedicinalProductIngredient(name, (MedicinalProductIngredient) resource);
    else if (resource instanceof MedicinalProductInteraction)
      composeMedicinalProductInteraction(name, (MedicinalProductInteraction) resource);
    else if (resource instanceof MedicinalProductManufactured)
      composeMedicinalProductManufactured(name, (MedicinalProductManufactured) resource);
    else if (resource instanceof MedicinalProductPackaged)
      composeMedicinalProductPackaged(name, (MedicinalProductPackaged) resource);
    else if (resource instanceof MedicinalProductPharmaceutical)
      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical) resource);
    else if (resource instanceof MedicinalProductUndesirableEffect)
      composeMedicinalProductUndesirableEffect(name, (MedicinalProductUndesirableEffect) resource);
    else if (resource instanceof MessageDefinition)
      composeMessageDefinition(name, (MessageDefinition) resource);
    else if (resource instanceof MessageHeader)
      composeMessageHeader(name, (MessageHeader) resource);
    else if (resource instanceof MolecularSequence)
      composeMolecularSequence(name, (MolecularSequence) 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 ObservationDefinition)
      composeObservationDefinition(name, (ObservationDefinition) 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 OrganizationAffiliation)
      composeOrganizationAffiliation(name, (OrganizationAffiliation) 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 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 RelatedPerson)
      composeRelatedPerson(name, (RelatedPerson) resource);
    else if (resource instanceof RequestGroup)
      composeRequestGroup(name, (RequestGroup) resource);
    else if (resource instanceof ResearchDefinition)
      composeResearchDefinition(name, (ResearchDefinition) resource);
    else if (resource instanceof ResearchElementDefinition)
      composeResearchElementDefinition(name, (ResearchElementDefinition) 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 RiskEvidenceSynthesis)
      composeRiskEvidenceSynthesis(name, (RiskEvidenceSynthesis) resource);
    else if (resource instanceof Schedule)
      composeSchedule(name, (Schedule) resource);
    else if (resource instanceof SearchParameter)
      composeSearchParameter(name, (SearchParameter) resource);
    else if (resource instanceof ServiceRequest)
      composeServiceRequest(name, (ServiceRequest) resource);
    else if (resource instanceof Slot)
      composeSlot(name, (Slot) resource);
    else if (resource instanceof Specimen)
      composeSpecimen(name, (Specimen) resource);
    else if (resource instanceof SpecimenDefinition)
      composeSpecimenDefinition(name, (SpecimenDefinition) 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 SubstanceNucleicAcid)
      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid) resource);
    else if (resource instanceof SubstancePolymer)
      composeSubstancePolymer(name, (SubstancePolymer) resource);
    else if (resource instanceof SubstanceProtein)
      composeSubstanceProtein(name, (SubstanceProtein) resource);
    else if (resource instanceof SubstanceReferenceInformation)
      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation) resource);
    else if (resource instanceof SubstanceSourceMaterial)
      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial) resource);
    else if (resource instanceof SubstanceSpecification)
      composeSubstanceSpecification(name, (SubstanceSpecification) 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 TerminologyCapabilities)
      composeTerminologyCapabilities(name, (TerminologyCapabilities) 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 VerificationResult)
      composeVerificationResult(name, (VerificationResult) 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 Extension)
      composeExtension(prefix + "Extension", (Extension) type);
    else if (type instanceof Narrative)
      composeNarrative(prefix + "Narrative", (Narrative) type);
    else if (type instanceof Count)
      composeCount(prefix + "Count", (Count) type);
    else if (type instanceof Dosage)
      composeDosage(prefix + "Dosage", (Dosage) type);
    else if (type instanceof MarketingStatus)
      composeMarketingStatus(prefix + "MarketingStatus", (MarketingStatus) type);
    else if (type instanceof SubstanceAmount)
      composeSubstanceAmount(prefix + "SubstanceAmount", (SubstanceAmount) type);
    else if (type instanceof Population)
      composePopulation(prefix + "Population", (Population) 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 Duration)
      composeDuration(prefix + "Duration", (Duration) type);
    else if (type instanceof ProductShelfLife)
      composeProductShelfLife(prefix + "ProductShelfLife", (ProductShelfLife) type);
    else if (type instanceof Timing)
      composeTiming(prefix + "Timing", (Timing) type);
    else if (type instanceof ProdCharacteristic)
      composeProdCharacteristic(prefix + "ProdCharacteristic", (ProdCharacteristic) 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 Contributor)
      composeContributor(prefix + "Contributor", (Contributor) type);
    else if (type instanceof Attachment)
      composeAttachment(prefix + "Attachment", (Attachment) type);
    else if (type instanceof DataRequirement)
      composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
    else if (type instanceof Money)
      composeMoney(prefix + "Money", (Money) 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 Identifier)
      composeIdentifier(prefix + "Identifier", (Identifier) type);
    else if (type instanceof Coding)
      composeCoding(prefix + "Coding", (Coding) 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 Reference)
      composeReference(prefix + "Reference", (Reference) type);
    else if (type instanceof TriggerDefinition)
      composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) 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 Range)
      composeRange(prefix + "Range", (Range) type);
    else if (type instanceof RelatedArtifact)
      composeRelatedArtifact(prefix + "RelatedArtifact", (RelatedArtifact) type);
    else if (type instanceof Annotation)
      composeAnnotation(prefix + "Annotation", (Annotation) type);
    else if (type instanceof ContactDetail)
      composeContactDetail(prefix + "ContactDetail", (ContactDetail) type);
    else if (type instanceof UsageContext)
      composeUsageContext(prefix + "UsageContext", (UsageContext) type);
    else if (type instanceof Expression)
      composeExpression(prefix + "Expression", (Expression) type);
    else if (type instanceof Signature)
      composeSignature(prefix + "Signature", (Signature) type);
    else if (type instanceof CodeableConcept)
      composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) 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 CanonicalType)
      composeCanonical(prefix + "Canonical", (CanonicalType) type);
    else if (type instanceof UuidType)
      composeUuid(prefix + "Uuid", (UuidType) type);
    else if (type instanceof UrlType)
      composeUrl(prefix + "Url", (UrlType) 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